mirror of
https://github.com/lightninglabs/lightning-terminal.git
synced 2026-08-13 12:33:36 +02:00
Merge pull request #1 from lightninglabs/init-backend
Init application structure
This commit is contained in:
commit
e4e7551e7e
48 changed files with 68241 additions and 1 deletions
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# generated proxy commands
|
||||
https.cert
|
||||
https.key
|
||||
35
README.md
35
README.md
|
|
@ -1 +1,34 @@
|
|||
# Shushtar
|
||||
> This document is currently a scratchpad for developer setup and temporary hacks to run the project. It will be made more user-friendly in the future
|
||||
|
||||
Requirements: [Go](https://golang.org/doc/install), [protoc](https://github.com/protocolbuffers/protobuf/releases), [nodejs](https://nodejs.org/en/download/)
|
||||
|
||||
## One-time Setup
|
||||
|
||||
Create certificate for browser to backend proxy communication
|
||||
```
|
||||
openssl genrsa -out https.key 2048
|
||||
openssl req -new -x509 -key https.key -out https.cert -days 365
|
||||
```
|
||||
|
||||
Install client app dependencies
|
||||
```sh
|
||||
npm install -g yarn # if yarn isn't already installed
|
||||
cd app/
|
||||
yarn
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
- Spin up a local regtest env with nautilus and loopd (See [docker-regtest](https://github.com/lightninglabs/dev-resources/tree/master/docker-regtest))
|
||||
- Copy admin.macaroon hex into App.tsx
|
||||
- Start backend server
|
||||
```sh
|
||||
go run . --lndhost=localhost:10011 --loophost=localhost:11010
|
||||
```
|
||||
- Run the client app in a separate terminal
|
||||
```sh
|
||||
cd app
|
||||
yarn start
|
||||
```
|
||||
|
||||
Open browser at https://localhost:3000 and accept invalid cert (may not work in Chrome, use Firefox)
|
||||
|
|
|
|||
23
app/.gitignore
vendored
Normal file
23
app/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
44
app/README.md
Normal file
44
app/README.md
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
|
||||
|
||||
## Available Scripts
|
||||
|
||||
In the project directory, you can run:
|
||||
|
||||
### `yarn start`
|
||||
|
||||
Runs the app in the development mode.<br />
|
||||
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
|
||||
|
||||
The page will reload if you make edits.<br />
|
||||
You will also see any lint errors in the console.
|
||||
|
||||
### `yarn test`
|
||||
|
||||
Launches the test runner in the interactive watch mode.<br />
|
||||
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
||||
|
||||
### `yarn build`
|
||||
|
||||
Builds the app for production to the `build` folder.<br />
|
||||
It correctly bundles React in production mode and optimizes the build for the best performance.
|
||||
|
||||
The build is minified and the filenames include the hashes.<br />
|
||||
Your app is ready to be deployed!
|
||||
|
||||
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
||||
|
||||
### `yarn eject`
|
||||
|
||||
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
|
||||
|
||||
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
||||
|
||||
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
|
||||
|
||||
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
|
||||
|
||||
## Learn More
|
||||
|
||||
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
||||
|
||||
To learn React, check out the [React documentation](https://reactjs.org/).
|
||||
52
app/package.json
Normal file
52
app/package.json
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
{
|
||||
"name": "shushtar",
|
||||
"version": "0.0.1",
|
||||
"description": "Dashboard for LND and Loop",
|
||||
"repository": "https://github.com/lightninglabs/shushtar",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "BROWSER=none react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject",
|
||||
"protos": "./scripts/build-protos.sh"
|
||||
},
|
||||
"proxy": "https://localhost:8443",
|
||||
"dependencies": {
|
||||
"@improbable-eng/grpc-web": "0.12.0",
|
||||
"@testing-library/jest-dom": "^4.2.4",
|
||||
"@testing-library/react": "^9.3.2",
|
||||
"@testing-library/user-event": "^7.1.2",
|
||||
"@types/jest": "^24.0.0",
|
||||
"@types/node": "^12.0.0",
|
||||
"@types/react": "^16.9.0",
|
||||
"@types/react-dom": "^16.9.0",
|
||||
"google-protobuf": "3.11.4",
|
||||
"react": "^16.13.1",
|
||||
"react-dom": "^16.13.1",
|
||||
"react-scripts": "3.4.1",
|
||||
"typescript": "~3.7.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/google-protobuf": "3.7.2",
|
||||
"ts-protoc-gen": "0.12.0"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "react-app",
|
||||
"ignorePatterns": [
|
||||
"src/types/generated/**/*.js"
|
||||
]
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.2%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"development": [
|
||||
"last 1 chrome version",
|
||||
"last 1 firefox version",
|
||||
"last 1 safari version"
|
||||
]
|
||||
}
|
||||
}
|
||||
BIN
app/public/favicon.ico
Normal file
BIN
app/public/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
43
app/public/index.html
Normal file
43
app/public/index.html
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<meta
|
||||
name="description"
|
||||
content="Web site created using create-react-app"
|
||||
/>
|
||||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
||||
<!--
|
||||
manifest.json provides metadata used when your web app is installed on a
|
||||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||
-->
|
||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
||||
<!--
|
||||
Notice the use of %PUBLIC_URL% in the tags above.
|
||||
It will be replaced with the URL of the `public` folder during the build.
|
||||
Only files inside the `public` folder can be referenced from the HTML.
|
||||
|
||||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
||||
work correctly both with client-side routing and a non-root public URL.
|
||||
Learn how to configure a non-root public URL by running `npm run build`.
|
||||
-->
|
||||
<title>React App</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
<!--
|
||||
This HTML file is a template.
|
||||
If you open it directly in the browser, you will see an empty page.
|
||||
|
||||
You can add webfonts, meta tags, or analytics to this file.
|
||||
The build step will place the bundled scripts into the <body> tag.
|
||||
|
||||
To begin the development, run `npm start` or `yarn start`.
|
||||
To create a production bundle, use `npm run build` or `yarn build`.
|
||||
-->
|
||||
</body>
|
||||
</html>
|
||||
BIN
app/public/logo192.png
Normal file
BIN
app/public/logo192.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.2 KiB |
BIN
app/public/logo512.png
Normal file
BIN
app/public/logo512.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.4 KiB |
25
app/public/manifest.json
Normal file
25
app/public/manifest.json
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"short_name": "React App",
|
||||
"name": "Create React App Sample",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon"
|
||||
},
|
||||
{
|
||||
"src": "logo192.png",
|
||||
"type": "image/png",
|
||||
"sizes": "192x192"
|
||||
},
|
||||
{
|
||||
"src": "logo512.png",
|
||||
"type": "image/png",
|
||||
"sizes": "512x512"
|
||||
}
|
||||
],
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"theme_color": "#000000",
|
||||
"background_color": "#ffffff"
|
||||
}
|
||||
3
app/public/robots.txt
Normal file
3
app/public/robots.txt
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# https://www.robotstxt.org/robotstxt.html
|
||||
User-agent: *
|
||||
Disallow:
|
||||
35
app/scripts/build-protos.sh
Executable file
35
app/scripts/build-protos.sh
Executable file
|
|
@ -0,0 +1,35 @@
|
|||
|
||||
#!/bin/bash
|
||||
|
||||
mkdir -p ./src/types/generated
|
||||
|
||||
if [[ "$GOBIN" == "" ]]; then
|
||||
if [[ "$GOPATH" == "" ]]; then
|
||||
echo "Required env var GOPATH is not set; aborting with error; see the following documentation which can be invoked via the 'go help gopath' command."
|
||||
go help gopath
|
||||
exit -1
|
||||
fi
|
||||
|
||||
echo "Optional env var GOBIN is not set; using default derived from GOPATH as: \"$GOPATH/bin\""
|
||||
export GOBIN="$GOPATH/bin"
|
||||
fi
|
||||
|
||||
PROTOC=`command -v protoc`
|
||||
if [[ "$PROTOC" == "" ]]; then
|
||||
echo "Required "protoc" to be installed. Please visit https://github.com/protocolbuffers/protobuf/releases (3.5.0 suggested)."
|
||||
exit -1
|
||||
fi
|
||||
|
||||
# Install protoc-gen-go from the vendored protobuf package to $GOBIN
|
||||
#(cd ../../vendor/github.com/golang/protobuf && make install)
|
||||
|
||||
echo "Compiling protobuf definitions"
|
||||
protoc \
|
||||
--plugin=protoc-gen-ts=./node_modules/.bin/protoc-gen-ts \
|
||||
-I ../proto \
|
||||
--js_out=import_style=commonjs,binary:./src/types/generated \
|
||||
--ts_out=service=grpc-web:./src/types/generated \
|
||||
../proto/google/api/annotations.proto \
|
||||
../proto/google/api/http.proto \
|
||||
../proto/lnd.proto \
|
||||
../proto/loop.proto
|
||||
50
app/src/App.css
Normal file
50
app/src/App.css
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
.App {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.App-logo {
|
||||
height: 40vmin;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.App-info {
|
||||
width: auto;
|
||||
min-width: 40vmin;
|
||||
height: 20vmin;
|
||||
margin: 0 auto 20px;
|
||||
overflow-y: scroll;
|
||||
font-size: 14px;
|
||||
text-align: left;
|
||||
background-color: #ccc;
|
||||
color: black;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
.App-logo {
|
||||
animation: App-logo-spin infinite 20s linear;
|
||||
}
|
||||
}
|
||||
|
||||
.App-header {
|
||||
background-color: #282c34;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: calc(10px + 2vmin);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.App-link {
|
||||
color: #61dafb;
|
||||
}
|
||||
|
||||
@keyframes App-logo-spin {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
9
app/src/App.test.tsx
Normal file
9
app/src/App.test.tsx
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import React from 'react';
|
||||
import { render } from '@testing-library/react';
|
||||
import App from './App';
|
||||
|
||||
test('renders learn react link', () => {
|
||||
const { getByText } = render(<App />);
|
||||
const linkElement = getByText(/learn react/i);
|
||||
expect(linkElement).toBeInTheDocument();
|
||||
});
|
||||
93
app/src/App.tsx
Normal file
93
app/src/App.tsx
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
import React, { useState, useEffect } from 'react';
|
||||
import logo from './logo.svg';
|
||||
import './App.css';
|
||||
import { GetInfoRequest } from './types/generated/lnd_pb';
|
||||
import { TermsRequest } from './types/generated/loop_pb';
|
||||
import { grpc } from '@improbable-eng/grpc-web';
|
||||
import { Lightning } from './types/generated/lnd_pb_service';
|
||||
import { SwapClient } from './types/generated/loop_pb_service';
|
||||
|
||||
function App() {
|
||||
const [lndInfo, setLndInfo] = useState('');
|
||||
const [loopInfo, setLoopInfo] = useState('');
|
||||
useEffect(() => {
|
||||
const { protocol, hostname, port = '' } = window.location;
|
||||
const req = new GetInfoRequest();
|
||||
grpc.unary(Lightning.GetInfo, {
|
||||
host: `${protocol}//${hostname}:${port}`,
|
||||
request: req,
|
||||
metadata: {
|
||||
'X-Grpc-Backend': 'lnd',
|
||||
macaroon: '0201036c6e6402eb01030a109527a0652f02cac93e6b7f540335ecb11201301a160a0761646472657373120472656164120577726974651a130a04696e666f120472656164120577726974651a170a08696e766f69636573120472656164120577726974651a140a086d616361726f6f6e120867656e65726174651a160a076d657373616765120472656164120577726974651a170a086f6666636861696e120472656164120577726974651a160a076f6e636861696e120472656164120577726974651a140a057065657273120472656164120577726974651a180a067369676e6572120867656e6572617465120472656164000006206a2b9f83f666dbf61040686007e5f4435f6a24073f73b125fcdaf728329d8196'
|
||||
},
|
||||
onEnd: ({ status, statusMessage, headers, message, trailers }) => {
|
||||
console.log("GetInfo.status", status, statusMessage);
|
||||
console.log("GetInfo.headers", headers);
|
||||
if (status === grpc.Code.OK && message) {
|
||||
setLndInfo(JSON.stringify(message.toObject(), null, 2));
|
||||
console.log("GetInfo.message", message.toObject());
|
||||
} else {
|
||||
setLndInfo(statusMessage);
|
||||
}
|
||||
console.log("GetInfo.trailers", trailers);
|
||||
}
|
||||
});
|
||||
}, [setLndInfo]);
|
||||
|
||||
useEffect(() => {
|
||||
const { protocol, hostname, port = '' } = window.location;
|
||||
const req = new TermsRequest();
|
||||
grpc.unary(SwapClient.LoopOutTerms, {
|
||||
host: `${protocol}//${hostname}:${port}`,
|
||||
request: req,
|
||||
metadata: {
|
||||
'X-Grpc-Backend': 'loop',
|
||||
},
|
||||
onEnd: ({ status, statusMessage, headers, message, trailers }) => {
|
||||
console.log("LoopOutTerms.status", status, statusMessage);
|
||||
console.log("LoopOutTerms.headers", headers);
|
||||
if (status === grpc.Code.OK && message) {
|
||||
setLoopInfo(JSON.stringify(message.toObject(), null, 2));
|
||||
console.log("LoopOutTerms.message", message.toObject());
|
||||
} else {
|
||||
setLoopInfo(statusMessage);
|
||||
}
|
||||
console.log("LoopOutTerms.trailers", trailers);
|
||||
}
|
||||
});
|
||||
}, [setLoopInfo]);
|
||||
|
||||
return (
|
||||
<div className="App">
|
||||
<header className="App-header">
|
||||
{lndInfo && loopInfo ? (
|
||||
<>
|
||||
<p>LND Info</p>
|
||||
<pre className="App-info">
|
||||
{lndInfo}
|
||||
</pre>
|
||||
<p>Loop Terms</p>
|
||||
<pre className="App-info">
|
||||
{loopInfo}
|
||||
</pre>
|
||||
</>
|
||||
) : (
|
||||
<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>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
||||
13
app/src/index.css
Normal file
13
app/src/index.css
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
body {
|
||||
margin: 0;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
||||
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
||||
sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
||||
monospace;
|
||||
}
|
||||
17
app/src/index.tsx
Normal file
17
app/src/index.tsx
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import './index.css';
|
||||
import App from './App';
|
||||
import * as serviceWorker from './serviceWorker';
|
||||
|
||||
ReactDOM.render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>,
|
||||
document.getElementById('root')
|
||||
);
|
||||
|
||||
// If you want your app to work offline and load faster, you can change
|
||||
// unregister() to register() below. Note this comes with some pitfalls.
|
||||
// Learn more about service workers: https://bit.ly/CRA-PWA
|
||||
serviceWorker.unregister();
|
||||
7
app/src/logo.svg
Normal file
7
app/src/logo.svg
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3">
|
||||
<g fill="#61DAFB">
|
||||
<path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/>
|
||||
<circle cx="420.9" cy="296.5" r="45.7"/>
|
||||
<path d="M520.5 78.1z"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.6 KiB |
1
app/src/react-app-env.d.ts
vendored
Normal file
1
app/src/react-app-env.d.ts
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
/// <reference types="react-scripts" />
|
||||
149
app/src/serviceWorker.ts
Normal file
149
app/src/serviceWorker.ts
Normal file
|
|
@ -0,0 +1,149 @@
|
|||
// This optional code is used to register a service worker.
|
||||
// register() is not called by default.
|
||||
|
||||
// This lets the app load faster on subsequent visits in production, and gives
|
||||
// it offline capabilities. However, it also means that developers (and users)
|
||||
// will only see deployed updates on subsequent visits to a page, after all the
|
||||
// existing tabs open on the page have been closed, since previously cached
|
||||
// resources are updated in the background.
|
||||
|
||||
// To learn more about the benefits of this model and instructions on how to
|
||||
// opt-in, read https://bit.ly/CRA-PWA
|
||||
|
||||
const isLocalhost = Boolean(
|
||||
window.location.hostname === 'localhost' ||
|
||||
// [::1] is the IPv6 localhost address.
|
||||
window.location.hostname === '[::1]' ||
|
||||
// 127.0.0.0/8 are considered localhost for IPv4.
|
||||
window.location.hostname.match(
|
||||
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
|
||||
)
|
||||
);
|
||||
|
||||
type Config = {
|
||||
onSuccess?: (registration: ServiceWorkerRegistration) => void;
|
||||
onUpdate?: (registration: ServiceWorkerRegistration) => void;
|
||||
};
|
||||
|
||||
export function register(config?: Config) {
|
||||
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
|
||||
// The URL constructor is available in all browsers that support SW.
|
||||
const publicUrl = new URL(
|
||||
process.env.PUBLIC_URL,
|
||||
window.location.href
|
||||
);
|
||||
if (publicUrl.origin !== window.location.origin) {
|
||||
// Our service worker won't work if PUBLIC_URL is on a different origin
|
||||
// from what our page is served on. This might happen if a CDN is used to
|
||||
// serve assets; see https://github.com/facebook/create-react-app/issues/2374
|
||||
return;
|
||||
}
|
||||
|
||||
window.addEventListener('load', () => {
|
||||
const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
|
||||
|
||||
if (isLocalhost) {
|
||||
// This is running on localhost. Let's check if a service worker still exists or not.
|
||||
checkValidServiceWorker(swUrl, config);
|
||||
|
||||
// Add some additional logging to localhost, pointing developers to the
|
||||
// service worker/PWA documentation.
|
||||
navigator.serviceWorker.ready.then(() => {
|
||||
console.log(
|
||||
'This web app is being served cache-first by a service ' +
|
||||
'worker. To learn more, visit https://bit.ly/CRA-PWA'
|
||||
);
|
||||
});
|
||||
} else {
|
||||
// Is not localhost. Just register service worker
|
||||
registerValidSW(swUrl, config);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function registerValidSW(swUrl: string, config?: Config) {
|
||||
navigator.serviceWorker
|
||||
.register(swUrl)
|
||||
.then(registration => {
|
||||
registration.onupdatefound = () => {
|
||||
const installingWorker = registration.installing;
|
||||
if (installingWorker == null) {
|
||||
return;
|
||||
}
|
||||
installingWorker.onstatechange = () => {
|
||||
if (installingWorker.state === 'installed') {
|
||||
if (navigator.serviceWorker.controller) {
|
||||
// At this point, the updated precached content has been fetched,
|
||||
// but the previous service worker will still serve the older
|
||||
// content until all client tabs are closed.
|
||||
console.log(
|
||||
'New content is available and will be used when all ' +
|
||||
'tabs for this page are closed. See https://bit.ly/CRA-PWA.'
|
||||
);
|
||||
|
||||
// Execute callback
|
||||
if (config && config.onUpdate) {
|
||||
config.onUpdate(registration);
|
||||
}
|
||||
} else {
|
||||
// At this point, everything has been precached.
|
||||
// It's the perfect time to display a
|
||||
// "Content is cached for offline use." message.
|
||||
console.log('Content is cached for offline use.');
|
||||
|
||||
// Execute callback
|
||||
if (config && config.onSuccess) {
|
||||
config.onSuccess(registration);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error during service worker registration:', error);
|
||||
});
|
||||
}
|
||||
|
||||
function checkValidServiceWorker(swUrl: string, config?: Config) {
|
||||
// Check if the service worker can be found. If it can't reload the page.
|
||||
fetch(swUrl, {
|
||||
headers: { 'Service-Worker': 'script' }
|
||||
})
|
||||
.then(response => {
|
||||
// Ensure service worker exists, and that we really are getting a JS file.
|
||||
const contentType = response.headers.get('content-type');
|
||||
if (
|
||||
response.status === 404 ||
|
||||
(contentType != null && contentType.indexOf('javascript') === -1)
|
||||
) {
|
||||
// No service worker found. Probably a different app. Reload the page.
|
||||
navigator.serviceWorker.ready.then(registration => {
|
||||
registration.unregister().then(() => {
|
||||
window.location.reload();
|
||||
});
|
||||
});
|
||||
} else {
|
||||
// Service worker found. Proceed as normal.
|
||||
registerValidSW(swUrl, config);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
console.log(
|
||||
'No internet connection found. App is running in offline mode.'
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
export function unregister() {
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.ready
|
||||
.then(registration => {
|
||||
registration.unregister();
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(error.message);
|
||||
});
|
||||
}
|
||||
}
|
||||
5
app/src/setupTests.ts
Normal file
5
app/src/setupTests.ts
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
// jest-dom adds custom jest matchers for asserting on DOM nodes.
|
||||
// allows you to do things like:
|
||||
// expect(element).toHaveTextContent(/react/i)
|
||||
// learn more: https://github.com/testing-library/jest-dom
|
||||
import '@testing-library/jest-dom/extend-expect';
|
||||
9
app/src/types/generated/google/api/annotations_pb.d.ts
vendored
Normal file
9
app/src/types/generated/google/api/annotations_pb.d.ts
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
// package: google.api
|
||||
// file: google/api/annotations.proto
|
||||
|
||||
import * as jspb from "google-protobuf";
|
||||
import * as google_api_http_pb from "../../google/api/http_pb";
|
||||
import * as google_protobuf_descriptor_pb from "google-protobuf/google/protobuf/descriptor_pb";
|
||||
|
||||
export const http: jspb.ExtensionFieldInfo<google_api_http_pb.HttpRule>;
|
||||
|
||||
48
app/src/types/generated/google/api/annotations_pb.js
Normal file
48
app/src/types/generated/google/api/annotations_pb.js
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
/* eslint-disable */
|
||||
var proto = { google: { api: {} } };
|
||||
|
||||
// source: google/api/annotations.proto
|
||||
/**
|
||||
* @fileoverview
|
||||
* @enhanceable
|
||||
* @suppress {messageConventions} JS Compiler reports an error if a variable or
|
||||
* field starts with 'MSG_' and isn't a translatable message.
|
||||
* @public
|
||||
*/
|
||||
// GENERATED CODE -- DO NOT EDIT!
|
||||
|
||||
var jspb = require('google-protobuf');
|
||||
var goog = jspb;
|
||||
var global = Function('return this')();
|
||||
|
||||
var google_api_http_pb = require('../../google/api/http_pb.js');
|
||||
goog.object.extend(proto, google_api_http_pb);
|
||||
var google_protobuf_descriptor_pb = require('google-protobuf/google/protobuf/descriptor_pb.js');
|
||||
goog.object.extend(proto, google_protobuf_descriptor_pb);
|
||||
goog.exportSymbol('proto.google.api.http', null, global);
|
||||
|
||||
/**
|
||||
* A tuple of {field number, class constructor} for the extension
|
||||
* field named `http`.
|
||||
* @type {!jspb.ExtensionFieldInfo<!proto.google.api.HttpRule>}
|
||||
*/
|
||||
proto.google.api.http = new jspb.ExtensionFieldInfo(
|
||||
72295728,
|
||||
{http: 0},
|
||||
google_api_http_pb.HttpRule,
|
||||
/** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ (
|
||||
google_api_http_pb.HttpRule.toObject),
|
||||
0);
|
||||
|
||||
google_protobuf_descriptor_pb.MethodOptions.extensionsBinary[72295728] = new jspb.ExtensionFieldBinaryInfo(
|
||||
proto.google.api.http,
|
||||
jspb.BinaryReader.prototype.readMessage,
|
||||
jspb.BinaryWriter.prototype.writeMessage,
|
||||
google_api_http_pb.HttpRule.serializeBinaryToWriter,
|
||||
google_api_http_pb.HttpRule.deserializeBinaryFromReader,
|
||||
false);
|
||||
// This registers the extension field with the extended class, so that
|
||||
// toObject() will function correctly.
|
||||
google_protobuf_descriptor_pb.MethodOptions.extensions[72295728] = proto.google.api.http;
|
||||
|
||||
goog.object.extend(exports, proto.google.api);
|
||||
3
app/src/types/generated/google/api/annotations_pb_service.d.ts
vendored
Normal file
3
app/src/types/generated/google/api/annotations_pb_service.d.ts
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
// package: google.api
|
||||
// file: google/api/annotations.proto
|
||||
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
// package: google.api
|
||||
// file: google/api/annotations.proto
|
||||
|
||||
136
app/src/types/generated/google/api/http_pb.d.ts
vendored
Normal file
136
app/src/types/generated/google/api/http_pb.d.ts
vendored
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
// package: google.api
|
||||
// file: google/api/http.proto
|
||||
|
||||
import * as jspb from "google-protobuf";
|
||||
|
||||
export class Http extends jspb.Message {
|
||||
clearRulesList(): void;
|
||||
getRulesList(): Array<HttpRule>;
|
||||
setRulesList(value: Array<HttpRule>): void;
|
||||
addRules(value?: HttpRule, index?: number): HttpRule;
|
||||
|
||||
getFullyDecodeReservedExpansion(): boolean;
|
||||
setFullyDecodeReservedExpansion(value: boolean): void;
|
||||
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): Http.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: Http): Http.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: Http, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): Http;
|
||||
static deserializeBinaryFromReader(message: Http, reader: jspb.BinaryReader): Http;
|
||||
}
|
||||
|
||||
export namespace Http {
|
||||
export type AsObject = {
|
||||
rulesList: Array<HttpRule.AsObject>,
|
||||
fullyDecodeReservedExpansion: boolean,
|
||||
}
|
||||
}
|
||||
|
||||
export class HttpRule extends jspb.Message {
|
||||
getSelector(): string;
|
||||
setSelector(value: string): void;
|
||||
|
||||
hasGet(): boolean;
|
||||
clearGet(): void;
|
||||
getGet(): string;
|
||||
setGet(value: string): void;
|
||||
|
||||
hasPut(): boolean;
|
||||
clearPut(): void;
|
||||
getPut(): string;
|
||||
setPut(value: string): void;
|
||||
|
||||
hasPost(): boolean;
|
||||
clearPost(): void;
|
||||
getPost(): string;
|
||||
setPost(value: string): void;
|
||||
|
||||
hasDelete(): boolean;
|
||||
clearDelete(): void;
|
||||
getDelete(): string;
|
||||
setDelete(value: string): void;
|
||||
|
||||
hasPatch(): boolean;
|
||||
clearPatch(): void;
|
||||
getPatch(): string;
|
||||
setPatch(value: string): void;
|
||||
|
||||
hasCustom(): boolean;
|
||||
clearCustom(): void;
|
||||
getCustom(): CustomHttpPattern | undefined;
|
||||
setCustom(value?: CustomHttpPattern): void;
|
||||
|
||||
getBody(): string;
|
||||
setBody(value: string): void;
|
||||
|
||||
getResponseBody(): string;
|
||||
setResponseBody(value: string): void;
|
||||
|
||||
clearAdditionalBindingsList(): void;
|
||||
getAdditionalBindingsList(): Array<HttpRule>;
|
||||
setAdditionalBindingsList(value: Array<HttpRule>): void;
|
||||
addAdditionalBindings(value?: HttpRule, index?: number): HttpRule;
|
||||
|
||||
getPatternCase(): HttpRule.PatternCase;
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): HttpRule.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: HttpRule): HttpRule.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: HttpRule, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): HttpRule;
|
||||
static deserializeBinaryFromReader(message: HttpRule, reader: jspb.BinaryReader): HttpRule;
|
||||
}
|
||||
|
||||
export namespace HttpRule {
|
||||
export type AsObject = {
|
||||
selector: string,
|
||||
get: string,
|
||||
put: string,
|
||||
post: string,
|
||||
pb_delete: string,
|
||||
patch: string,
|
||||
custom?: CustomHttpPattern.AsObject,
|
||||
body: string,
|
||||
responseBody: string,
|
||||
additionalBindingsList: Array<HttpRule.AsObject>,
|
||||
}
|
||||
|
||||
export enum PatternCase {
|
||||
PATTERN_NOT_SET = 0,
|
||||
GET = 2,
|
||||
PUT = 3,
|
||||
POST = 4,
|
||||
DELETE = 5,
|
||||
PATCH = 6,
|
||||
CUSTOM = 8,
|
||||
}
|
||||
}
|
||||
|
||||
export class CustomHttpPattern extends jspb.Message {
|
||||
getKind(): string;
|
||||
setKind(value: string): void;
|
||||
|
||||
getPath(): string;
|
||||
setPath(value: string): void;
|
||||
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): CustomHttpPattern.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: CustomHttpPattern): CustomHttpPattern.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: CustomHttpPattern, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): CustomHttpPattern;
|
||||
static deserializeBinaryFromReader(message: CustomHttpPattern, reader: jspb.BinaryReader): CustomHttpPattern;
|
||||
}
|
||||
|
||||
export namespace CustomHttpPattern {
|
||||
export type AsObject = {
|
||||
kind: string,
|
||||
path: string,
|
||||
}
|
||||
}
|
||||
|
||||
1006
app/src/types/generated/google/api/http_pb.js
Normal file
1006
app/src/types/generated/google/api/http_pb.js
Normal file
File diff suppressed because it is too large
Load diff
3
app/src/types/generated/google/api/http_pb_service.d.ts
vendored
Normal file
3
app/src/types/generated/google/api/http_pb_service.d.ts
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
// package: google.api
|
||||
// file: google/api/http.proto
|
||||
|
||||
3
app/src/types/generated/google/api/http_pb_service.js
Normal file
3
app/src/types/generated/google/api/http_pb_service.js
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
// package: google.api
|
||||
// file: google/api/http.proto
|
||||
|
||||
4942
app/src/types/generated/lnd_pb.d.ts
vendored
Normal file
4942
app/src/types/generated/lnd_pb.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load diff
37868
app/src/types/generated/lnd_pb.js
Normal file
37868
app/src/types/generated/lnd_pb.js
Normal file
File diff suppressed because it is too large
Load diff
1068
app/src/types/generated/lnd_pb_service.d.ts
vendored
Normal file
1068
app/src/types/generated/lnd_pb_service.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load diff
2462
app/src/types/generated/lnd_pb_service.js
Normal file
2462
app/src/types/generated/lnd_pb_service.js
Normal file
File diff suppressed because it is too large
Load diff
488
app/src/types/generated/loop_pb.d.ts
vendored
Normal file
488
app/src/types/generated/loop_pb.d.ts
vendored
Normal file
|
|
@ -0,0 +1,488 @@
|
|||
// package: looprpc
|
||||
// file: loop.proto
|
||||
|
||||
import * as jspb from "google-protobuf";
|
||||
import * as google_api_annotations_pb from "./google/api/annotations_pb";
|
||||
|
||||
export class LoopOutRequest extends jspb.Message {
|
||||
getAmt(): number;
|
||||
setAmt(value: number): void;
|
||||
|
||||
getDest(): string;
|
||||
setDest(value: string): void;
|
||||
|
||||
getMaxSwapRoutingFee(): number;
|
||||
setMaxSwapRoutingFee(value: number): void;
|
||||
|
||||
getMaxPrepayRoutingFee(): number;
|
||||
setMaxPrepayRoutingFee(value: number): void;
|
||||
|
||||
getMaxSwapFee(): number;
|
||||
setMaxSwapFee(value: number): void;
|
||||
|
||||
getMaxPrepayAmt(): number;
|
||||
setMaxPrepayAmt(value: number): void;
|
||||
|
||||
getMaxMinerFee(): number;
|
||||
setMaxMinerFee(value: number): void;
|
||||
|
||||
getLoopOutChannel(): number;
|
||||
setLoopOutChannel(value: number): void;
|
||||
|
||||
getSweepConfTarget(): number;
|
||||
setSweepConfTarget(value: number): void;
|
||||
|
||||
getSwapPublicationDeadline(): number;
|
||||
setSwapPublicationDeadline(value: number): void;
|
||||
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): LoopOutRequest.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: LoopOutRequest): LoopOutRequest.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: LoopOutRequest, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): LoopOutRequest;
|
||||
static deserializeBinaryFromReader(message: LoopOutRequest, reader: jspb.BinaryReader): LoopOutRequest;
|
||||
}
|
||||
|
||||
export namespace LoopOutRequest {
|
||||
export type AsObject = {
|
||||
amt: number,
|
||||
dest: string,
|
||||
maxSwapRoutingFee: number,
|
||||
maxPrepayRoutingFee: number,
|
||||
maxSwapFee: number,
|
||||
maxPrepayAmt: number,
|
||||
maxMinerFee: number,
|
||||
loopOutChannel: number,
|
||||
sweepConfTarget: number,
|
||||
swapPublicationDeadline: number,
|
||||
}
|
||||
}
|
||||
|
||||
export class LoopInRequest extends jspb.Message {
|
||||
getAmt(): number;
|
||||
setAmt(value: number): void;
|
||||
|
||||
getMaxSwapFee(): number;
|
||||
setMaxSwapFee(value: number): void;
|
||||
|
||||
getMaxMinerFee(): number;
|
||||
setMaxMinerFee(value: number): void;
|
||||
|
||||
getLastHop(): Uint8Array | string;
|
||||
getLastHop_asU8(): Uint8Array;
|
||||
getLastHop_asB64(): string;
|
||||
setLastHop(value: Uint8Array | string): void;
|
||||
|
||||
getExternalHtlc(): boolean;
|
||||
setExternalHtlc(value: boolean): void;
|
||||
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): LoopInRequest.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: LoopInRequest): LoopInRequest.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: LoopInRequest, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): LoopInRequest;
|
||||
static deserializeBinaryFromReader(message: LoopInRequest, reader: jspb.BinaryReader): LoopInRequest;
|
||||
}
|
||||
|
||||
export namespace LoopInRequest {
|
||||
export type AsObject = {
|
||||
amt: number,
|
||||
maxSwapFee: number,
|
||||
maxMinerFee: number,
|
||||
lastHop: Uint8Array | string,
|
||||
externalHtlc: boolean,
|
||||
}
|
||||
}
|
||||
|
||||
export class SwapResponse extends jspb.Message {
|
||||
getId(): string;
|
||||
setId(value: string): void;
|
||||
|
||||
getIdBytes(): Uint8Array | string;
|
||||
getIdBytes_asU8(): Uint8Array;
|
||||
getIdBytes_asB64(): string;
|
||||
setIdBytes(value: Uint8Array | string): void;
|
||||
|
||||
getHtlcAddress(): string;
|
||||
setHtlcAddress(value: string): void;
|
||||
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): SwapResponse.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: SwapResponse): SwapResponse.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: SwapResponse, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): SwapResponse;
|
||||
static deserializeBinaryFromReader(message: SwapResponse, reader: jspb.BinaryReader): SwapResponse;
|
||||
}
|
||||
|
||||
export namespace SwapResponse {
|
||||
export type AsObject = {
|
||||
id: string,
|
||||
idBytes: Uint8Array | string,
|
||||
htlcAddress: string,
|
||||
}
|
||||
}
|
||||
|
||||
export class MonitorRequest extends jspb.Message {
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): MonitorRequest.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: MonitorRequest): MonitorRequest.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: MonitorRequest, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): MonitorRequest;
|
||||
static deserializeBinaryFromReader(message: MonitorRequest, reader: jspb.BinaryReader): MonitorRequest;
|
||||
}
|
||||
|
||||
export namespace MonitorRequest {
|
||||
export type AsObject = {
|
||||
}
|
||||
}
|
||||
|
||||
export class SwapStatus extends jspb.Message {
|
||||
getAmt(): number;
|
||||
setAmt(value: number): void;
|
||||
|
||||
getId(): string;
|
||||
setId(value: string): void;
|
||||
|
||||
getIdBytes(): Uint8Array | string;
|
||||
getIdBytes_asU8(): Uint8Array;
|
||||
getIdBytes_asB64(): string;
|
||||
setIdBytes(value: Uint8Array | string): void;
|
||||
|
||||
getType(): SwapTypeMap[keyof SwapTypeMap];
|
||||
setType(value: SwapTypeMap[keyof SwapTypeMap]): void;
|
||||
|
||||
getState(): SwapStateMap[keyof SwapStateMap];
|
||||
setState(value: SwapStateMap[keyof SwapStateMap]): void;
|
||||
|
||||
getInitiationTime(): number;
|
||||
setInitiationTime(value: number): void;
|
||||
|
||||
getLastUpdateTime(): number;
|
||||
setLastUpdateTime(value: number): void;
|
||||
|
||||
getHtlcAddress(): string;
|
||||
setHtlcAddress(value: string): void;
|
||||
|
||||
getCostServer(): number;
|
||||
setCostServer(value: number): void;
|
||||
|
||||
getCostOnchain(): number;
|
||||
setCostOnchain(value: number): void;
|
||||
|
||||
getCostOffchain(): number;
|
||||
setCostOffchain(value: number): void;
|
||||
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): SwapStatus.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: SwapStatus): SwapStatus.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: SwapStatus, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): SwapStatus;
|
||||
static deserializeBinaryFromReader(message: SwapStatus, reader: jspb.BinaryReader): SwapStatus;
|
||||
}
|
||||
|
||||
export namespace SwapStatus {
|
||||
export type AsObject = {
|
||||
amt: number,
|
||||
id: string,
|
||||
idBytes: Uint8Array | string,
|
||||
type: SwapTypeMap[keyof SwapTypeMap],
|
||||
state: SwapStateMap[keyof SwapStateMap],
|
||||
initiationTime: number,
|
||||
lastUpdateTime: number,
|
||||
htlcAddress: string,
|
||||
costServer: number,
|
||||
costOnchain: number,
|
||||
costOffchain: number,
|
||||
}
|
||||
}
|
||||
|
||||
export class ListSwapsRequest extends jspb.Message {
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): ListSwapsRequest.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: ListSwapsRequest): ListSwapsRequest.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: ListSwapsRequest, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): ListSwapsRequest;
|
||||
static deserializeBinaryFromReader(message: ListSwapsRequest, reader: jspb.BinaryReader): ListSwapsRequest;
|
||||
}
|
||||
|
||||
export namespace ListSwapsRequest {
|
||||
export type AsObject = {
|
||||
}
|
||||
}
|
||||
|
||||
export class ListSwapsResponse extends jspb.Message {
|
||||
clearSwapsList(): void;
|
||||
getSwapsList(): Array<SwapStatus>;
|
||||
setSwapsList(value: Array<SwapStatus>): void;
|
||||
addSwaps(value?: SwapStatus, index?: number): SwapStatus;
|
||||
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): ListSwapsResponse.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: ListSwapsResponse): ListSwapsResponse.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: ListSwapsResponse, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): ListSwapsResponse;
|
||||
static deserializeBinaryFromReader(message: ListSwapsResponse, reader: jspb.BinaryReader): ListSwapsResponse;
|
||||
}
|
||||
|
||||
export namespace ListSwapsResponse {
|
||||
export type AsObject = {
|
||||
swapsList: Array<SwapStatus.AsObject>,
|
||||
}
|
||||
}
|
||||
|
||||
export class SwapInfoRequest extends jspb.Message {
|
||||
getId(): Uint8Array | string;
|
||||
getId_asU8(): Uint8Array;
|
||||
getId_asB64(): string;
|
||||
setId(value: Uint8Array | string): void;
|
||||
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): SwapInfoRequest.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: SwapInfoRequest): SwapInfoRequest.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: SwapInfoRequest, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): SwapInfoRequest;
|
||||
static deserializeBinaryFromReader(message: SwapInfoRequest, reader: jspb.BinaryReader): SwapInfoRequest;
|
||||
}
|
||||
|
||||
export namespace SwapInfoRequest {
|
||||
export type AsObject = {
|
||||
id: Uint8Array | string,
|
||||
}
|
||||
}
|
||||
|
||||
export class TermsRequest extends jspb.Message {
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): TermsRequest.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: TermsRequest): TermsRequest.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: TermsRequest, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): TermsRequest;
|
||||
static deserializeBinaryFromReader(message: TermsRequest, reader: jspb.BinaryReader): TermsRequest;
|
||||
}
|
||||
|
||||
export namespace TermsRequest {
|
||||
export type AsObject = {
|
||||
}
|
||||
}
|
||||
|
||||
export class TermsResponse extends jspb.Message {
|
||||
getMinSwapAmount(): number;
|
||||
setMinSwapAmount(value: number): void;
|
||||
|
||||
getMaxSwapAmount(): number;
|
||||
setMaxSwapAmount(value: number): void;
|
||||
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): TermsResponse.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: TermsResponse): TermsResponse.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: TermsResponse, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): TermsResponse;
|
||||
static deserializeBinaryFromReader(message: TermsResponse, reader: jspb.BinaryReader): TermsResponse;
|
||||
}
|
||||
|
||||
export namespace TermsResponse {
|
||||
export type AsObject = {
|
||||
minSwapAmount: number,
|
||||
maxSwapAmount: number,
|
||||
}
|
||||
}
|
||||
|
||||
export class QuoteRequest extends jspb.Message {
|
||||
getAmt(): number;
|
||||
setAmt(value: number): void;
|
||||
|
||||
getConfTarget(): number;
|
||||
setConfTarget(value: number): void;
|
||||
|
||||
getExternalHtlc(): boolean;
|
||||
setExternalHtlc(value: boolean): void;
|
||||
|
||||
getSwapPublicationDeadline(): number;
|
||||
setSwapPublicationDeadline(value: number): void;
|
||||
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): QuoteRequest.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: QuoteRequest): QuoteRequest.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: QuoteRequest, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): QuoteRequest;
|
||||
static deserializeBinaryFromReader(message: QuoteRequest, reader: jspb.BinaryReader): QuoteRequest;
|
||||
}
|
||||
|
||||
export namespace QuoteRequest {
|
||||
export type AsObject = {
|
||||
amt: number,
|
||||
confTarget: number,
|
||||
externalHtlc: boolean,
|
||||
swapPublicationDeadline: number,
|
||||
}
|
||||
}
|
||||
|
||||
export class QuoteResponse extends jspb.Message {
|
||||
getSwapFee(): number;
|
||||
setSwapFee(value: number): void;
|
||||
|
||||
getPrepayAmt(): number;
|
||||
setPrepayAmt(value: number): void;
|
||||
|
||||
getMinerFee(): number;
|
||||
setMinerFee(value: number): void;
|
||||
|
||||
getSwapPaymentDest(): Uint8Array | string;
|
||||
getSwapPaymentDest_asU8(): Uint8Array;
|
||||
getSwapPaymentDest_asB64(): string;
|
||||
setSwapPaymentDest(value: Uint8Array | string): void;
|
||||
|
||||
getCltvDelta(): number;
|
||||
setCltvDelta(value: number): void;
|
||||
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): QuoteResponse.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: QuoteResponse): QuoteResponse.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: QuoteResponse, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): QuoteResponse;
|
||||
static deserializeBinaryFromReader(message: QuoteResponse, reader: jspb.BinaryReader): QuoteResponse;
|
||||
}
|
||||
|
||||
export namespace QuoteResponse {
|
||||
export type AsObject = {
|
||||
swapFee: number,
|
||||
prepayAmt: number,
|
||||
minerFee: number,
|
||||
swapPaymentDest: Uint8Array | string,
|
||||
cltvDelta: number,
|
||||
}
|
||||
}
|
||||
|
||||
export class TokensRequest extends jspb.Message {
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): TokensRequest.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: TokensRequest): TokensRequest.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: TokensRequest, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): TokensRequest;
|
||||
static deserializeBinaryFromReader(message: TokensRequest, reader: jspb.BinaryReader): TokensRequest;
|
||||
}
|
||||
|
||||
export namespace TokensRequest {
|
||||
export type AsObject = {
|
||||
}
|
||||
}
|
||||
|
||||
export class TokensResponse extends jspb.Message {
|
||||
clearTokensList(): void;
|
||||
getTokensList(): Array<LsatToken>;
|
||||
setTokensList(value: Array<LsatToken>): void;
|
||||
addTokens(value?: LsatToken, index?: number): LsatToken;
|
||||
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): TokensResponse.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: TokensResponse): TokensResponse.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: TokensResponse, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): TokensResponse;
|
||||
static deserializeBinaryFromReader(message: TokensResponse, reader: jspb.BinaryReader): TokensResponse;
|
||||
}
|
||||
|
||||
export namespace TokensResponse {
|
||||
export type AsObject = {
|
||||
tokensList: Array<LsatToken.AsObject>,
|
||||
}
|
||||
}
|
||||
|
||||
export class LsatToken extends jspb.Message {
|
||||
getBaseMacaroon(): Uint8Array | string;
|
||||
getBaseMacaroon_asU8(): Uint8Array;
|
||||
getBaseMacaroon_asB64(): string;
|
||||
setBaseMacaroon(value: Uint8Array | string): void;
|
||||
|
||||
getPaymentHash(): Uint8Array | string;
|
||||
getPaymentHash_asU8(): Uint8Array;
|
||||
getPaymentHash_asB64(): string;
|
||||
setPaymentHash(value: Uint8Array | string): void;
|
||||
|
||||
getPaymentPreimage(): Uint8Array | string;
|
||||
getPaymentPreimage_asU8(): Uint8Array;
|
||||
getPaymentPreimage_asB64(): string;
|
||||
setPaymentPreimage(value: Uint8Array | string): void;
|
||||
|
||||
getAmountPaidMsat(): number;
|
||||
setAmountPaidMsat(value: number): void;
|
||||
|
||||
getRoutingFeePaidMsat(): number;
|
||||
setRoutingFeePaidMsat(value: number): void;
|
||||
|
||||
getTimeCreated(): number;
|
||||
setTimeCreated(value: number): void;
|
||||
|
||||
getExpired(): boolean;
|
||||
setExpired(value: boolean): void;
|
||||
|
||||
getStorageName(): string;
|
||||
setStorageName(value: string): void;
|
||||
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): LsatToken.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: LsatToken): LsatToken.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: LsatToken, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): LsatToken;
|
||||
static deserializeBinaryFromReader(message: LsatToken, reader: jspb.BinaryReader): LsatToken;
|
||||
}
|
||||
|
||||
export namespace LsatToken {
|
||||
export type AsObject = {
|
||||
baseMacaroon: Uint8Array | string,
|
||||
paymentHash: Uint8Array | string,
|
||||
paymentPreimage: Uint8Array | string,
|
||||
amountPaidMsat: number,
|
||||
routingFeePaidMsat: number,
|
||||
timeCreated: number,
|
||||
expired: boolean,
|
||||
storageName: string,
|
||||
}
|
||||
}
|
||||
|
||||
export interface SwapTypeMap {
|
||||
LOOP_OUT: 0;
|
||||
LOOP_IN: 1;
|
||||
}
|
||||
|
||||
export const SwapType: SwapTypeMap;
|
||||
|
||||
export interface SwapStateMap {
|
||||
INITIATED: 0;
|
||||
PREIMAGE_REVEALED: 1;
|
||||
HTLC_PUBLISHED: 2;
|
||||
SUCCESS: 3;
|
||||
FAILED: 4;
|
||||
INVOICE_SETTLED: 5;
|
||||
}
|
||||
|
||||
export const SwapState: SwapStateMap;
|
||||
|
||||
3658
app/src/types/generated/loop_pb.js
Normal file
3658
app/src/types/generated/loop_pb.js
Normal file
File diff suppressed because it is too large
Load diff
226
app/src/types/generated/loop_pb_service.d.ts
vendored
Normal file
226
app/src/types/generated/loop_pb_service.d.ts
vendored
Normal file
|
|
@ -0,0 +1,226 @@
|
|||
// package: looprpc
|
||||
// file: loop.proto
|
||||
|
||||
import * as loop_pb from "./loop_pb";
|
||||
import {grpc} from "@improbable-eng/grpc-web";
|
||||
|
||||
type SwapClientLoopOut = {
|
||||
readonly methodName: string;
|
||||
readonly service: typeof SwapClient;
|
||||
readonly requestStream: false;
|
||||
readonly responseStream: false;
|
||||
readonly requestType: typeof loop_pb.LoopOutRequest;
|
||||
readonly responseType: typeof loop_pb.SwapResponse;
|
||||
};
|
||||
|
||||
type SwapClientLoopIn = {
|
||||
readonly methodName: string;
|
||||
readonly service: typeof SwapClient;
|
||||
readonly requestStream: false;
|
||||
readonly responseStream: false;
|
||||
readonly requestType: typeof loop_pb.LoopInRequest;
|
||||
readonly responseType: typeof loop_pb.SwapResponse;
|
||||
};
|
||||
|
||||
type SwapClientMonitor = {
|
||||
readonly methodName: string;
|
||||
readonly service: typeof SwapClient;
|
||||
readonly requestStream: false;
|
||||
readonly responseStream: true;
|
||||
readonly requestType: typeof loop_pb.MonitorRequest;
|
||||
readonly responseType: typeof loop_pb.SwapStatus;
|
||||
};
|
||||
|
||||
type SwapClientListSwaps = {
|
||||
readonly methodName: string;
|
||||
readonly service: typeof SwapClient;
|
||||
readonly requestStream: false;
|
||||
readonly responseStream: false;
|
||||
readonly requestType: typeof loop_pb.ListSwapsRequest;
|
||||
readonly responseType: typeof loop_pb.ListSwapsResponse;
|
||||
};
|
||||
|
||||
type SwapClientSwapInfo = {
|
||||
readonly methodName: string;
|
||||
readonly service: typeof SwapClient;
|
||||
readonly requestStream: false;
|
||||
readonly responseStream: false;
|
||||
readonly requestType: typeof loop_pb.SwapInfoRequest;
|
||||
readonly responseType: typeof loop_pb.SwapStatus;
|
||||
};
|
||||
|
||||
type SwapClientLoopOutTerms = {
|
||||
readonly methodName: string;
|
||||
readonly service: typeof SwapClient;
|
||||
readonly requestStream: false;
|
||||
readonly responseStream: false;
|
||||
readonly requestType: typeof loop_pb.TermsRequest;
|
||||
readonly responseType: typeof loop_pb.TermsResponse;
|
||||
};
|
||||
|
||||
type SwapClientLoopOutQuote = {
|
||||
readonly methodName: string;
|
||||
readonly service: typeof SwapClient;
|
||||
readonly requestStream: false;
|
||||
readonly responseStream: false;
|
||||
readonly requestType: typeof loop_pb.QuoteRequest;
|
||||
readonly responseType: typeof loop_pb.QuoteResponse;
|
||||
};
|
||||
|
||||
type SwapClientGetLoopInTerms = {
|
||||
readonly methodName: string;
|
||||
readonly service: typeof SwapClient;
|
||||
readonly requestStream: false;
|
||||
readonly responseStream: false;
|
||||
readonly requestType: typeof loop_pb.TermsRequest;
|
||||
readonly responseType: typeof loop_pb.TermsResponse;
|
||||
};
|
||||
|
||||
type SwapClientGetLoopInQuote = {
|
||||
readonly methodName: string;
|
||||
readonly service: typeof SwapClient;
|
||||
readonly requestStream: false;
|
||||
readonly responseStream: false;
|
||||
readonly requestType: typeof loop_pb.QuoteRequest;
|
||||
readonly responseType: typeof loop_pb.QuoteResponse;
|
||||
};
|
||||
|
||||
type SwapClientGetLsatTokens = {
|
||||
readonly methodName: string;
|
||||
readonly service: typeof SwapClient;
|
||||
readonly requestStream: false;
|
||||
readonly responseStream: false;
|
||||
readonly requestType: typeof loop_pb.TokensRequest;
|
||||
readonly responseType: typeof loop_pb.TokensResponse;
|
||||
};
|
||||
|
||||
export class SwapClient {
|
||||
static readonly serviceName: string;
|
||||
static readonly LoopOut: SwapClientLoopOut;
|
||||
static readonly LoopIn: SwapClientLoopIn;
|
||||
static readonly Monitor: SwapClientMonitor;
|
||||
static readonly ListSwaps: SwapClientListSwaps;
|
||||
static readonly SwapInfo: SwapClientSwapInfo;
|
||||
static readonly LoopOutTerms: SwapClientLoopOutTerms;
|
||||
static readonly LoopOutQuote: SwapClientLoopOutQuote;
|
||||
static readonly GetLoopInTerms: SwapClientGetLoopInTerms;
|
||||
static readonly GetLoopInQuote: SwapClientGetLoopInQuote;
|
||||
static readonly GetLsatTokens: SwapClientGetLsatTokens;
|
||||
}
|
||||
|
||||
export type ServiceError = { message: string, code: number; metadata: grpc.Metadata }
|
||||
export type Status = { details: string, code: number; metadata: grpc.Metadata }
|
||||
|
||||
interface UnaryResponse {
|
||||
cancel(): void;
|
||||
}
|
||||
interface ResponseStream<T> {
|
||||
cancel(): void;
|
||||
on(type: 'data', handler: (message: T) => void): ResponseStream<T>;
|
||||
on(type: 'end', handler: (status?: Status) => void): ResponseStream<T>;
|
||||
on(type: 'status', handler: (status: Status) => void): ResponseStream<T>;
|
||||
}
|
||||
interface RequestStream<T> {
|
||||
write(message: T): RequestStream<T>;
|
||||
end(): void;
|
||||
cancel(): void;
|
||||
on(type: 'end', handler: (status?: Status) => void): RequestStream<T>;
|
||||
on(type: 'status', handler: (status: Status) => void): RequestStream<T>;
|
||||
}
|
||||
interface BidirectionalStream<ReqT, ResT> {
|
||||
write(message: ReqT): BidirectionalStream<ReqT, ResT>;
|
||||
end(): void;
|
||||
cancel(): void;
|
||||
on(type: 'data', handler: (message: ResT) => void): BidirectionalStream<ReqT, ResT>;
|
||||
on(type: 'end', handler: (status?: Status) => void): BidirectionalStream<ReqT, ResT>;
|
||||
on(type: 'status', handler: (status: Status) => void): BidirectionalStream<ReqT, ResT>;
|
||||
}
|
||||
|
||||
export class SwapClientClient {
|
||||
readonly serviceHost: string;
|
||||
|
||||
constructor(serviceHost: string, options?: grpc.RpcOptions);
|
||||
loopOut(
|
||||
requestMessage: loop_pb.LoopOutRequest,
|
||||
metadata: grpc.Metadata,
|
||||
callback: (error: ServiceError|null, responseMessage: loop_pb.SwapResponse|null) => void
|
||||
): UnaryResponse;
|
||||
loopOut(
|
||||
requestMessage: loop_pb.LoopOutRequest,
|
||||
callback: (error: ServiceError|null, responseMessage: loop_pb.SwapResponse|null) => void
|
||||
): UnaryResponse;
|
||||
loopIn(
|
||||
requestMessage: loop_pb.LoopInRequest,
|
||||
metadata: grpc.Metadata,
|
||||
callback: (error: ServiceError|null, responseMessage: loop_pb.SwapResponse|null) => void
|
||||
): UnaryResponse;
|
||||
loopIn(
|
||||
requestMessage: loop_pb.LoopInRequest,
|
||||
callback: (error: ServiceError|null, responseMessage: loop_pb.SwapResponse|null) => void
|
||||
): UnaryResponse;
|
||||
monitor(requestMessage: loop_pb.MonitorRequest, metadata?: grpc.Metadata): ResponseStream<loop_pb.SwapStatus>;
|
||||
listSwaps(
|
||||
requestMessage: loop_pb.ListSwapsRequest,
|
||||
metadata: grpc.Metadata,
|
||||
callback: (error: ServiceError|null, responseMessage: loop_pb.ListSwapsResponse|null) => void
|
||||
): UnaryResponse;
|
||||
listSwaps(
|
||||
requestMessage: loop_pb.ListSwapsRequest,
|
||||
callback: (error: ServiceError|null, responseMessage: loop_pb.ListSwapsResponse|null) => void
|
||||
): UnaryResponse;
|
||||
swapInfo(
|
||||
requestMessage: loop_pb.SwapInfoRequest,
|
||||
metadata: grpc.Metadata,
|
||||
callback: (error: ServiceError|null, responseMessage: loop_pb.SwapStatus|null) => void
|
||||
): UnaryResponse;
|
||||
swapInfo(
|
||||
requestMessage: loop_pb.SwapInfoRequest,
|
||||
callback: (error: ServiceError|null, responseMessage: loop_pb.SwapStatus|null) => void
|
||||
): UnaryResponse;
|
||||
loopOutTerms(
|
||||
requestMessage: loop_pb.TermsRequest,
|
||||
metadata: grpc.Metadata,
|
||||
callback: (error: ServiceError|null, responseMessage: loop_pb.TermsResponse|null) => void
|
||||
): UnaryResponse;
|
||||
loopOutTerms(
|
||||
requestMessage: loop_pb.TermsRequest,
|
||||
callback: (error: ServiceError|null, responseMessage: loop_pb.TermsResponse|null) => void
|
||||
): UnaryResponse;
|
||||
loopOutQuote(
|
||||
requestMessage: loop_pb.QuoteRequest,
|
||||
metadata: grpc.Metadata,
|
||||
callback: (error: ServiceError|null, responseMessage: loop_pb.QuoteResponse|null) => void
|
||||
): UnaryResponse;
|
||||
loopOutQuote(
|
||||
requestMessage: loop_pb.QuoteRequest,
|
||||
callback: (error: ServiceError|null, responseMessage: loop_pb.QuoteResponse|null) => void
|
||||
): UnaryResponse;
|
||||
getLoopInTerms(
|
||||
requestMessage: loop_pb.TermsRequest,
|
||||
metadata: grpc.Metadata,
|
||||
callback: (error: ServiceError|null, responseMessage: loop_pb.TermsResponse|null) => void
|
||||
): UnaryResponse;
|
||||
getLoopInTerms(
|
||||
requestMessage: loop_pb.TermsRequest,
|
||||
callback: (error: ServiceError|null, responseMessage: loop_pb.TermsResponse|null) => void
|
||||
): UnaryResponse;
|
||||
getLoopInQuote(
|
||||
requestMessage: loop_pb.QuoteRequest,
|
||||
metadata: grpc.Metadata,
|
||||
callback: (error: ServiceError|null, responseMessage: loop_pb.QuoteResponse|null) => void
|
||||
): UnaryResponse;
|
||||
getLoopInQuote(
|
||||
requestMessage: loop_pb.QuoteRequest,
|
||||
callback: (error: ServiceError|null, responseMessage: loop_pb.QuoteResponse|null) => void
|
||||
): UnaryResponse;
|
||||
getLsatTokens(
|
||||
requestMessage: loop_pb.TokensRequest,
|
||||
metadata: grpc.Metadata,
|
||||
callback: (error: ServiceError|null, responseMessage: loop_pb.TokensResponse|null) => void
|
||||
): UnaryResponse;
|
||||
getLsatTokens(
|
||||
requestMessage: loop_pb.TokensRequest,
|
||||
callback: (error: ServiceError|null, responseMessage: loop_pb.TokensResponse|null) => void
|
||||
): UnaryResponse;
|
||||
}
|
||||
|
||||
429
app/src/types/generated/loop_pb_service.js
Normal file
429
app/src/types/generated/loop_pb_service.js
Normal file
|
|
@ -0,0 +1,429 @@
|
|||
// package: looprpc
|
||||
// file: loop.proto
|
||||
|
||||
var loop_pb = require("./loop_pb");
|
||||
var grpc = require("@improbable-eng/grpc-web").grpc;
|
||||
|
||||
var SwapClient = (function () {
|
||||
function SwapClient() {}
|
||||
SwapClient.serviceName = "looprpc.SwapClient";
|
||||
return SwapClient;
|
||||
}());
|
||||
|
||||
SwapClient.LoopOut = {
|
||||
methodName: "LoopOut",
|
||||
service: SwapClient,
|
||||
requestStream: false,
|
||||
responseStream: false,
|
||||
requestType: loop_pb.LoopOutRequest,
|
||||
responseType: loop_pb.SwapResponse
|
||||
};
|
||||
|
||||
SwapClient.LoopIn = {
|
||||
methodName: "LoopIn",
|
||||
service: SwapClient,
|
||||
requestStream: false,
|
||||
responseStream: false,
|
||||
requestType: loop_pb.LoopInRequest,
|
||||
responseType: loop_pb.SwapResponse
|
||||
};
|
||||
|
||||
SwapClient.Monitor = {
|
||||
methodName: "Monitor",
|
||||
service: SwapClient,
|
||||
requestStream: false,
|
||||
responseStream: true,
|
||||
requestType: loop_pb.MonitorRequest,
|
||||
responseType: loop_pb.SwapStatus
|
||||
};
|
||||
|
||||
SwapClient.ListSwaps = {
|
||||
methodName: "ListSwaps",
|
||||
service: SwapClient,
|
||||
requestStream: false,
|
||||
responseStream: false,
|
||||
requestType: loop_pb.ListSwapsRequest,
|
||||
responseType: loop_pb.ListSwapsResponse
|
||||
};
|
||||
|
||||
SwapClient.SwapInfo = {
|
||||
methodName: "SwapInfo",
|
||||
service: SwapClient,
|
||||
requestStream: false,
|
||||
responseStream: false,
|
||||
requestType: loop_pb.SwapInfoRequest,
|
||||
responseType: loop_pb.SwapStatus
|
||||
};
|
||||
|
||||
SwapClient.LoopOutTerms = {
|
||||
methodName: "LoopOutTerms",
|
||||
service: SwapClient,
|
||||
requestStream: false,
|
||||
responseStream: false,
|
||||
requestType: loop_pb.TermsRequest,
|
||||
responseType: loop_pb.TermsResponse
|
||||
};
|
||||
|
||||
SwapClient.LoopOutQuote = {
|
||||
methodName: "LoopOutQuote",
|
||||
service: SwapClient,
|
||||
requestStream: false,
|
||||
responseStream: false,
|
||||
requestType: loop_pb.QuoteRequest,
|
||||
responseType: loop_pb.QuoteResponse
|
||||
};
|
||||
|
||||
SwapClient.GetLoopInTerms = {
|
||||
methodName: "GetLoopInTerms",
|
||||
service: SwapClient,
|
||||
requestStream: false,
|
||||
responseStream: false,
|
||||
requestType: loop_pb.TermsRequest,
|
||||
responseType: loop_pb.TermsResponse
|
||||
};
|
||||
|
||||
SwapClient.GetLoopInQuote = {
|
||||
methodName: "GetLoopInQuote",
|
||||
service: SwapClient,
|
||||
requestStream: false,
|
||||
responseStream: false,
|
||||
requestType: loop_pb.QuoteRequest,
|
||||
responseType: loop_pb.QuoteResponse
|
||||
};
|
||||
|
||||
SwapClient.GetLsatTokens = {
|
||||
methodName: "GetLsatTokens",
|
||||
service: SwapClient,
|
||||
requestStream: false,
|
||||
responseStream: false,
|
||||
requestType: loop_pb.TokensRequest,
|
||||
responseType: loop_pb.TokensResponse
|
||||
};
|
||||
|
||||
exports.SwapClient = SwapClient;
|
||||
|
||||
function SwapClientClient(serviceHost, options) {
|
||||
this.serviceHost = serviceHost;
|
||||
this.options = options || {};
|
||||
}
|
||||
|
||||
SwapClientClient.prototype.loopOut = function loopOut(requestMessage, metadata, callback) {
|
||||
if (arguments.length === 2) {
|
||||
callback = arguments[1];
|
||||
}
|
||||
var client = grpc.unary(SwapClient.LoopOut, {
|
||||
request: requestMessage,
|
||||
host: this.serviceHost,
|
||||
metadata: metadata,
|
||||
transport: this.options.transport,
|
||||
debug: this.options.debug,
|
||||
onEnd: function (response) {
|
||||
if (callback) {
|
||||
if (response.status !== grpc.Code.OK) {
|
||||
var err = new Error(response.statusMessage);
|
||||
err.code = response.status;
|
||||
err.metadata = response.trailers;
|
||||
callback(err, null);
|
||||
} else {
|
||||
callback(null, response.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return {
|
||||
cancel: function () {
|
||||
callback = null;
|
||||
client.close();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
SwapClientClient.prototype.loopIn = function loopIn(requestMessage, metadata, callback) {
|
||||
if (arguments.length === 2) {
|
||||
callback = arguments[1];
|
||||
}
|
||||
var client = grpc.unary(SwapClient.LoopIn, {
|
||||
request: requestMessage,
|
||||
host: this.serviceHost,
|
||||
metadata: metadata,
|
||||
transport: this.options.transport,
|
||||
debug: this.options.debug,
|
||||
onEnd: function (response) {
|
||||
if (callback) {
|
||||
if (response.status !== grpc.Code.OK) {
|
||||
var err = new Error(response.statusMessage);
|
||||
err.code = response.status;
|
||||
err.metadata = response.trailers;
|
||||
callback(err, null);
|
||||
} else {
|
||||
callback(null, response.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return {
|
||||
cancel: function () {
|
||||
callback = null;
|
||||
client.close();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
SwapClientClient.prototype.monitor = function monitor(requestMessage, metadata) {
|
||||
var listeners = {
|
||||
data: [],
|
||||
end: [],
|
||||
status: []
|
||||
};
|
||||
var client = grpc.invoke(SwapClient.Monitor, {
|
||||
request: requestMessage,
|
||||
host: this.serviceHost,
|
||||
metadata: metadata,
|
||||
transport: this.options.transport,
|
||||
debug: this.options.debug,
|
||||
onMessage: function (responseMessage) {
|
||||
listeners.data.forEach(function (handler) {
|
||||
handler(responseMessage);
|
||||
});
|
||||
},
|
||||
onEnd: function (status, statusMessage, trailers) {
|
||||
listeners.status.forEach(function (handler) {
|
||||
handler({ code: status, details: statusMessage, metadata: trailers });
|
||||
});
|
||||
listeners.end.forEach(function (handler) {
|
||||
handler({ code: status, details: statusMessage, metadata: trailers });
|
||||
});
|
||||
listeners = null;
|
||||
}
|
||||
});
|
||||
return {
|
||||
on: function (type, handler) {
|
||||
listeners[type].push(handler);
|
||||
return this;
|
||||
},
|
||||
cancel: function () {
|
||||
listeners = null;
|
||||
client.close();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
SwapClientClient.prototype.listSwaps = function listSwaps(requestMessage, metadata, callback) {
|
||||
if (arguments.length === 2) {
|
||||
callback = arguments[1];
|
||||
}
|
||||
var client = grpc.unary(SwapClient.ListSwaps, {
|
||||
request: requestMessage,
|
||||
host: this.serviceHost,
|
||||
metadata: metadata,
|
||||
transport: this.options.transport,
|
||||
debug: this.options.debug,
|
||||
onEnd: function (response) {
|
||||
if (callback) {
|
||||
if (response.status !== grpc.Code.OK) {
|
||||
var err = new Error(response.statusMessage);
|
||||
err.code = response.status;
|
||||
err.metadata = response.trailers;
|
||||
callback(err, null);
|
||||
} else {
|
||||
callback(null, response.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return {
|
||||
cancel: function () {
|
||||
callback = null;
|
||||
client.close();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
SwapClientClient.prototype.swapInfo = function swapInfo(requestMessage, metadata, callback) {
|
||||
if (arguments.length === 2) {
|
||||
callback = arguments[1];
|
||||
}
|
||||
var client = grpc.unary(SwapClient.SwapInfo, {
|
||||
request: requestMessage,
|
||||
host: this.serviceHost,
|
||||
metadata: metadata,
|
||||
transport: this.options.transport,
|
||||
debug: this.options.debug,
|
||||
onEnd: function (response) {
|
||||
if (callback) {
|
||||
if (response.status !== grpc.Code.OK) {
|
||||
var err = new Error(response.statusMessage);
|
||||
err.code = response.status;
|
||||
err.metadata = response.trailers;
|
||||
callback(err, null);
|
||||
} else {
|
||||
callback(null, response.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return {
|
||||
cancel: function () {
|
||||
callback = null;
|
||||
client.close();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
SwapClientClient.prototype.loopOutTerms = function loopOutTerms(requestMessage, metadata, callback) {
|
||||
if (arguments.length === 2) {
|
||||
callback = arguments[1];
|
||||
}
|
||||
var client = grpc.unary(SwapClient.LoopOutTerms, {
|
||||
request: requestMessage,
|
||||
host: this.serviceHost,
|
||||
metadata: metadata,
|
||||
transport: this.options.transport,
|
||||
debug: this.options.debug,
|
||||
onEnd: function (response) {
|
||||
if (callback) {
|
||||
if (response.status !== grpc.Code.OK) {
|
||||
var err = new Error(response.statusMessage);
|
||||
err.code = response.status;
|
||||
err.metadata = response.trailers;
|
||||
callback(err, null);
|
||||
} else {
|
||||
callback(null, response.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return {
|
||||
cancel: function () {
|
||||
callback = null;
|
||||
client.close();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
SwapClientClient.prototype.loopOutQuote = function loopOutQuote(requestMessage, metadata, callback) {
|
||||
if (arguments.length === 2) {
|
||||
callback = arguments[1];
|
||||
}
|
||||
var client = grpc.unary(SwapClient.LoopOutQuote, {
|
||||
request: requestMessage,
|
||||
host: this.serviceHost,
|
||||
metadata: metadata,
|
||||
transport: this.options.transport,
|
||||
debug: this.options.debug,
|
||||
onEnd: function (response) {
|
||||
if (callback) {
|
||||
if (response.status !== grpc.Code.OK) {
|
||||
var err = new Error(response.statusMessage);
|
||||
err.code = response.status;
|
||||
err.metadata = response.trailers;
|
||||
callback(err, null);
|
||||
} else {
|
||||
callback(null, response.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return {
|
||||
cancel: function () {
|
||||
callback = null;
|
||||
client.close();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
SwapClientClient.prototype.getLoopInTerms = function getLoopInTerms(requestMessage, metadata, callback) {
|
||||
if (arguments.length === 2) {
|
||||
callback = arguments[1];
|
||||
}
|
||||
var client = grpc.unary(SwapClient.GetLoopInTerms, {
|
||||
request: requestMessage,
|
||||
host: this.serviceHost,
|
||||
metadata: metadata,
|
||||
transport: this.options.transport,
|
||||
debug: this.options.debug,
|
||||
onEnd: function (response) {
|
||||
if (callback) {
|
||||
if (response.status !== grpc.Code.OK) {
|
||||
var err = new Error(response.statusMessage);
|
||||
err.code = response.status;
|
||||
err.metadata = response.trailers;
|
||||
callback(err, null);
|
||||
} else {
|
||||
callback(null, response.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return {
|
||||
cancel: function () {
|
||||
callback = null;
|
||||
client.close();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
SwapClientClient.prototype.getLoopInQuote = function getLoopInQuote(requestMessage, metadata, callback) {
|
||||
if (arguments.length === 2) {
|
||||
callback = arguments[1];
|
||||
}
|
||||
var client = grpc.unary(SwapClient.GetLoopInQuote, {
|
||||
request: requestMessage,
|
||||
host: this.serviceHost,
|
||||
metadata: metadata,
|
||||
transport: this.options.transport,
|
||||
debug: this.options.debug,
|
||||
onEnd: function (response) {
|
||||
if (callback) {
|
||||
if (response.status !== grpc.Code.OK) {
|
||||
var err = new Error(response.statusMessage);
|
||||
err.code = response.status;
|
||||
err.metadata = response.trailers;
|
||||
callback(err, null);
|
||||
} else {
|
||||
callback(null, response.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return {
|
||||
cancel: function () {
|
||||
callback = null;
|
||||
client.close();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
SwapClientClient.prototype.getLsatTokens = function getLsatTokens(requestMessage, metadata, callback) {
|
||||
if (arguments.length === 2) {
|
||||
callback = arguments[1];
|
||||
}
|
||||
var client = grpc.unary(SwapClient.GetLsatTokens, {
|
||||
request: requestMessage,
|
||||
host: this.serviceHost,
|
||||
metadata: metadata,
|
||||
transport: this.options.transport,
|
||||
debug: this.options.debug,
|
||||
onEnd: function (response) {
|
||||
if (callback) {
|
||||
if (response.status !== grpc.Code.OK) {
|
||||
var err = new Error(response.statusMessage);
|
||||
err.code = response.status;
|
||||
err.metadata = response.trailers;
|
||||
callback(err, null);
|
||||
} else {
|
||||
callback(null, response.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return {
|
||||
cancel: function () {
|
||||
callback = null;
|
||||
client.close();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
exports.SwapClientClient = SwapClientClient;
|
||||
|
||||
28
app/tsconfig.json
Normal file
28
app/tsconfig.json
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"lib": [
|
||||
"dom",
|
||||
"dom.iterable",
|
||||
"esnext"
|
||||
],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"noEmit": true,
|
||||
"jsx": "react"
|
||||
},
|
||||
"include": [
|
||||
"src"
|
||||
],
|
||||
"exclude": [
|
||||
"src/types/generated/**"
|
||||
]
|
||||
}
|
||||
10811
app/yarn.lock
Normal file
10811
app/yarn.lock
Normal file
File diff suppressed because it is too large
Load diff
42
config.go
Normal file
42
config.go
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/jessevdk/go-flags"
|
||||
)
|
||||
|
||||
var (
|
||||
defaultHTTPSListen = "localhost:8443"
|
||||
defaultLndHost = "localhost:10009"
|
||||
defaultLoopHost = "localhost:10010"
|
||||
defaultTLSCertPath = "https.cert"
|
||||
defaultTLSKeyPath = "https.key"
|
||||
)
|
||||
|
||||
type config struct {
|
||||
HTTPSListen string `long:"httpslisten" description:"host:port to listen for incoming HTTP/2 connections on"`
|
||||
LNDHost string `long:"lndhost" description:"host:port that LND listens for RPC connections on"`
|
||||
LoopHost string `long:"loophost" description:"host:port that Loop listens for RPC connections on"`
|
||||
TLSCertPath string `long:"tlscertpath" description:"path to the TLS cert to use for HTTPS requests"`
|
||||
TLSKeyPath string `long:"tlskeypath" description:"path to the TLS key to use for HTTPS requests"`
|
||||
}
|
||||
|
||||
// loadConfig starts with a skeleton default config, and reads in user provided
|
||||
// configuration from the command line. It does not provide a full set of
|
||||
// defaults or validate user input.
|
||||
func loadConfig() (*config, error) {
|
||||
// Start with a default config.
|
||||
config := &config{
|
||||
HTTPSListen: defaultHTTPSListen,
|
||||
LNDHost: defaultLndHost,
|
||||
LoopHost: defaultLoopHost,
|
||||
TLSCertPath: defaultTLSCertPath,
|
||||
TLSKeyPath: defaultTLSKeyPath,
|
||||
}
|
||||
|
||||
// Parse command line options to obtain user specified values.
|
||||
if _, err := flags.Parse(config); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return config, nil
|
||||
}
|
||||
23
go.mod
Normal file
23
go.mod
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
module github.com/lightninglabs/shushtar
|
||||
|
||||
go 1.14
|
||||
|
||||
require (
|
||||
github.com/btcsuite/btcutil v1.0.1
|
||||
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect
|
||||
github.com/gorilla/websocket v1.4.2 // indirect
|
||||
github.com/grpc-ecosystem/go-grpc-middleware v1.2.0
|
||||
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
|
||||
github.com/improbable-eng/grpc-web v0.12.0
|
||||
github.com/jessevdk/go-flags v1.4.0
|
||||
github.com/jpillora/backoff v1.0.0 // indirect
|
||||
github.com/mitranim/gow v0.0.0-20200310140433-1453861c60a5 // indirect
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f
|
||||
github.com/mwitkow/grpc-proxy v0.0.0-20181017164139-0f1106ef9c76
|
||||
github.com/prometheus/client_golang v1.5.1
|
||||
github.com/rs/cors v1.7.0 // indirect
|
||||
github.com/sirupsen/logrus v1.5.0
|
||||
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e
|
||||
golang.org/x/sys v0.0.0-20200406155108-e3b113bbe6a4 // indirect
|
||||
google.golang.org/grpc v1.28.0
|
||||
)
|
||||
205
go.sum
Normal file
205
go.sum
Normal file
|
|
@ -0,0 +1,205 @@
|
|||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
|
||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
||||
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
||||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
||||
github.com/btcsuite/btcd v0.20.1-beta h1:Ik4hyJqN8Jfyv3S4AGBOmyouMsYE3EdYODkMbQjwPGw=
|
||||
github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
|
||||
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
|
||||
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
|
||||
github.com/btcsuite/btcutil v1.0.1 h1:GKOz8BnRjYrb/JTKgaOk+zh26NWNdSNvdvv0xoAZMSA=
|
||||
github.com/btcsuite/btcutil v1.0.1/go.mod h1:j9HUFwoQRsZL3V4n+qG+CUnEGHOarIxfC3Le2Yhbcts=
|
||||
github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg=
|
||||
github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY=
|
||||
github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc=
|
||||
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY=
|
||||
github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
|
||||
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
||||
github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f h1:U5y3Y5UE0w7amNe7Z5G/twsBW0KEalRQXZzf8ufSh9I=
|
||||
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f/go.mod h1:xH/i4TFMt8koVQZ6WFms69WAsDWr2XsYL3Hkl7jkoLE=
|
||||
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
||||
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I=
|
||||
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
|
||||
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/grpc-ecosystem/go-grpc-middleware v1.2.0 h1:0IKlLyQ3Hs9nDaiK5cSHAGmcQEIC8l2Ts1u6x5Dfrqg=
|
||||
github.com/grpc-ecosystem/go-grpc-middleware v1.2.0/go.mod h1:mJzapYve32yjrKlk9GbyCZHuPgZsrbyIbyKhSzOpg6s=
|
||||
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho=
|
||||
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
|
||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||
github.com/improbable-eng/grpc-web v0.12.0 h1:GlCS+lMZzIkfouf7CNqY+qqpowdKuJLSLLcKVfM1oLc=
|
||||
github.com/improbable-eng/grpc-web v0.12.0/go.mod h1:6hRR09jOEG81ADP5wCQju1z71g6OL4eEvELdran/3cs=
|
||||
github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
||||
github.com/jessevdk/go-flags v1.4.0 h1:4IU2WS7AumrZ/40jfhf4QVDMsQwqA7VEHozFRrGARJA=
|
||||
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
||||
github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA=
|
||||
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
|
||||
github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ=
|
||||
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
||||
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
||||
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
|
||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||
github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||
github.com/mitranim/gow v0.0.0-20200310140433-1453861c60a5 h1:N3/iCEmJnqnS/eiK4Qf/VdzGHGq3NSaSaYWRZ9TcTYA=
|
||||
github.com/mitranim/gow v0.0.0-20200310140433-1453861c60a5/go.mod h1:Du3tFX2ohe7OugtDEVvBFqFpbAoHZTxv9I/+R7WO9vs=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU=
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||
github.com/mwitkow/grpc-proxy v0.0.0-20181017164139-0f1106ef9c76 h1:0xuRacu/Zr+jX+KyLLPPktbwXqyOvnOPUQmMLzX1jxU=
|
||||
github.com/mwitkow/grpc-proxy v0.0.0-20181017164139-0f1106ef9c76/go.mod h1:x5OoJHDHqxHS801UIuhqGl6QdSAEJvtausosHSdazIo=
|
||||
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
|
||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
||||
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
|
||||
github.com/prometheus/client_golang v1.5.1 h1:bdHYieyGlH+6OLEk2YQha8THib30KP0/yD0YH9m6xcA=
|
||||
github.com/prometheus/client_golang v1.5.1/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU=
|
||||
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
||||
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M=
|
||||
github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
||||
github.com/prometheus/common v0.9.1 h1:KOMtN28tlbam3/7ZKEYKHhKoJZYYj3gMH4uc62x7X7U=
|
||||
github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4=
|
||||
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
||||
github.com/prometheus/procfs v0.0.8 h1:+fpWZdT24pJBiqJdAwYBjPSk+5YmQzYNPYzQsdzLkt8=
|
||||
github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
|
||||
github.com/rjeczalik/notify v0.9.2 h1:MiTWrPj55mNDHEiIX5YUSKefw/+lCQVoAFmD6oQm5w8=
|
||||
github.com/rjeczalik/notify v0.9.2/go.mod h1:aErll2f0sUX9PXZnVNyeiObbmTlk5jnMoCa4QEjJeqM=
|
||||
github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik=
|
||||
github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
|
||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||
github.com/sirupsen/logrus v1.5.0 h1:1N5EYkVAPEywqZRJd7cwnRtCb6xJx7NH3T3WUTF980Q=
|
||||
github.com/sirupsen/logrus v1.5.0/go.mod h1:+F7Ogzej0PZc/94MaYx/nvG9jOFMD2osvC3s+Squfpo=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
|
||||
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
|
||||
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
|
||||
golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d h1:2+ZP7EfsZV7Vvmx3TIqSlSzATMkTAKqM14YGFPoSKjI=
|
||||
golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e h1:3G+cUijn7XD+S4eJFddp53Pv7+slrESplyjG25HgL+k=
|
||||
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180926160741-c2ed4eda69e7/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200217220822-9197077df867/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884=
|
||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200406155108-e3b113bbe6a4 h1:c1Sgqkh8v6ZxafNGG64r8C8UisIW2TKMJN8P86tKjr0=
|
||||
golang.org/x/sys v0.0.0-20200406155108-e3b113bbe6a4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE=
|
||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
|
||||
google.golang.org/grpc v1.28.0 h1:bO/TA4OxCOummhSf10siHuG7vJOiwh7SpRpFZDkOgl4=
|
||||
google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60=
|
||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.5 h1:ymVxjfMaHvXD8RqPRmzHHsB3VvucivSkIAvJFDI5O3c=
|
||||
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
31
proto/google/api/annotations.proto
Normal file
31
proto/google/api/annotations.proto
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
// Copyright (c) 2015, Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.api;
|
||||
|
||||
import "google/api/http.proto";
|
||||
import "google/protobuf/descriptor.proto";
|
||||
|
||||
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "AnnotationsProto";
|
||||
option java_package = "com.google.api";
|
||||
option objc_class_prefix = "GAPI";
|
||||
|
||||
extend google.protobuf.MethodOptions {
|
||||
// See `HttpRule`.
|
||||
HttpRule http = 72295728;
|
||||
}
|
||||
376
proto/google/api/http.proto
Normal file
376
proto/google/api/http.proto
Normal file
|
|
@ -0,0 +1,376 @@
|
|||
// Copyright 2019 Google LLC.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.api;
|
||||
|
||||
option cc_enable_arenas = true;
|
||||
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "HttpProto";
|
||||
option java_package = "com.google.api";
|
||||
option objc_class_prefix = "GAPI";
|
||||
|
||||
// Defines the HTTP configuration for an API service. It contains a list of
|
||||
// [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method
|
||||
// to one or more HTTP REST API methods.
|
||||
message Http {
|
||||
// A list of HTTP configuration rules that apply to individual API methods.
|
||||
//
|
||||
// **NOTE:** All service configuration rules follow "last one wins" order.
|
||||
repeated HttpRule rules = 1;
|
||||
|
||||
// When set to true, URL path parameters will be fully URI-decoded except in
|
||||
// cases of single segment matches in reserved expansion, where "%2F" will be
|
||||
// left encoded.
|
||||
//
|
||||
// The default behavior is to not decode RFC 6570 reserved characters in multi
|
||||
// segment matches.
|
||||
bool fully_decode_reserved_expansion = 2;
|
||||
}
|
||||
|
||||
// # gRPC Transcoding
|
||||
//
|
||||
// gRPC Transcoding is a feature for mapping between a gRPC method and one or
|
||||
// more HTTP REST endpoints. It allows developers to build a single API service
|
||||
// that supports both gRPC APIs and REST APIs. Many systems, including [Google
|
||||
// APIs](https://github.com/googleapis/googleapis),
|
||||
// [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC
|
||||
// Gateway](https://github.com/grpc-ecosystem/grpc-gateway),
|
||||
// and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature
|
||||
// and use it for large scale production services.
|
||||
//
|
||||
// `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies
|
||||
// how different portions of the gRPC request message are mapped to the URL
|
||||
// path, URL query parameters, and HTTP request body. It also controls how the
|
||||
// gRPC response message is mapped to the HTTP response body. `HttpRule` is
|
||||
// typically specified as an `google.api.http` annotation on the gRPC method.
|
||||
//
|
||||
// Each mapping specifies a URL path template and an HTTP method. The path
|
||||
// template may refer to one or more fields in the gRPC request message, as long
|
||||
// as each field is a non-repeated field with a primitive (non-message) type.
|
||||
// The path template controls how fields of the request message are mapped to
|
||||
// the URL path.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// service Messaging {
|
||||
// rpc GetMessage(GetMessageRequest) returns (Message) {
|
||||
// option (google.api.http) = {
|
||||
// get: "/v1/{name=messages/*}"
|
||||
// };
|
||||
// }
|
||||
// }
|
||||
// message GetMessageRequest {
|
||||
// string name = 1; // Mapped to URL path.
|
||||
// }
|
||||
// message Message {
|
||||
// string text = 1; // The resource content.
|
||||
// }
|
||||
//
|
||||
// This enables an HTTP REST to gRPC mapping as below:
|
||||
//
|
||||
// HTTP | gRPC
|
||||
// -----|-----
|
||||
// `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")`
|
||||
//
|
||||
// Any fields in the request message which are not bound by the path template
|
||||
// automatically become HTTP query parameters if there is no HTTP request body.
|
||||
// For example:
|
||||
//
|
||||
// service Messaging {
|
||||
// rpc GetMessage(GetMessageRequest) returns (Message) {
|
||||
// option (google.api.http) = {
|
||||
// get:"/v1/messages/{message_id}"
|
||||
// };
|
||||
// }
|
||||
// }
|
||||
// message GetMessageRequest {
|
||||
// message SubMessage {
|
||||
// string subfield = 1;
|
||||
// }
|
||||
// string message_id = 1; // Mapped to URL path.
|
||||
// int64 revision = 2; // Mapped to URL query parameter `revision`.
|
||||
// SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`.
|
||||
// }
|
||||
//
|
||||
// This enables a HTTP JSON to RPC mapping as below:
|
||||
//
|
||||
// HTTP | gRPC
|
||||
// -----|-----
|
||||
// `GET /v1/messages/123456?revision=2&sub.subfield=foo` |
|
||||
// `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield:
|
||||
// "foo"))`
|
||||
//
|
||||
// Note that fields which are mapped to URL query parameters must have a
|
||||
// primitive type or a repeated primitive type or a non-repeated message type.
|
||||
// In the case of a repeated type, the parameter can be repeated in the URL
|
||||
// as `...?param=A¶m=B`. In the case of a message type, each field of the
|
||||
// message is mapped to a separate parameter, such as
|
||||
// `...?foo.a=A&foo.b=B&foo.c=C`.
|
||||
//
|
||||
// For HTTP methods that allow a request body, the `body` field
|
||||
// specifies the mapping. Consider a REST update method on the
|
||||
// message resource collection:
|
||||
//
|
||||
// service Messaging {
|
||||
// rpc UpdateMessage(UpdateMessageRequest) returns (Message) {
|
||||
// option (google.api.http) = {
|
||||
// patch: "/v1/messages/{message_id}"
|
||||
// body: "message"
|
||||
// };
|
||||
// }
|
||||
// }
|
||||
// message UpdateMessageRequest {
|
||||
// string message_id = 1; // mapped to the URL
|
||||
// Message message = 2; // mapped to the body
|
||||
// }
|
||||
//
|
||||
// The following HTTP JSON to RPC mapping is enabled, where the
|
||||
// representation of the JSON in the request body is determined by
|
||||
// protos JSON encoding:
|
||||
//
|
||||
// HTTP | gRPC
|
||||
// -----|-----
|
||||
// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id:
|
||||
// "123456" message { text: "Hi!" })`
|
||||
//
|
||||
// The special name `*` can be used in the body mapping to define that
|
||||
// every field not bound by the path template should be mapped to the
|
||||
// request body. This enables the following alternative definition of
|
||||
// the update method:
|
||||
//
|
||||
// service Messaging {
|
||||
// rpc UpdateMessage(Message) returns (Message) {
|
||||
// option (google.api.http) = {
|
||||
// patch: "/v1/messages/{message_id}"
|
||||
// body: "*"
|
||||
// };
|
||||
// }
|
||||
// }
|
||||
// message Message {
|
||||
// string message_id = 1;
|
||||
// string text = 2;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// The following HTTP JSON to RPC mapping is enabled:
|
||||
//
|
||||
// HTTP | gRPC
|
||||
// -----|-----
|
||||
// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id:
|
||||
// "123456" text: "Hi!")`
|
||||
//
|
||||
// Note that when using `*` in the body mapping, it is not possible to
|
||||
// have HTTP parameters, as all fields not bound by the path end in
|
||||
// the body. This makes this option more rarely used in practice when
|
||||
// defining REST APIs. The common usage of `*` is in custom methods
|
||||
// which don't use the URL at all for transferring data.
|
||||
//
|
||||
// It is possible to define multiple HTTP methods for one RPC by using
|
||||
// the `additional_bindings` option. Example:
|
||||
//
|
||||
// service Messaging {
|
||||
// rpc GetMessage(GetMessageRequest) returns (Message) {
|
||||
// option (google.api.http) = {
|
||||
// get: "/v1/messages/{message_id}"
|
||||
// additional_bindings {
|
||||
// get: "/v1/users/{user_id}/messages/{message_id}"
|
||||
// }
|
||||
// };
|
||||
// }
|
||||
// }
|
||||
// message GetMessageRequest {
|
||||
// string message_id = 1;
|
||||
// string user_id = 2;
|
||||
// }
|
||||
//
|
||||
// This enables the following two alternative HTTP JSON to RPC mappings:
|
||||
//
|
||||
// HTTP | gRPC
|
||||
// -----|-----
|
||||
// `GET /v1/messages/123456` | `GetMessage(message_id: "123456")`
|
||||
// `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id:
|
||||
// "123456")`
|
||||
//
|
||||
// ## Rules for HTTP mapping
|
||||
//
|
||||
// 1. Leaf request fields (recursive expansion nested messages in the request
|
||||
// message) are classified into three categories:
|
||||
// - Fields referred by the path template. They are passed via the URL path.
|
||||
// - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They are passed via the HTTP
|
||||
// request body.
|
||||
// - All other fields are passed via the URL query parameters, and the
|
||||
// parameter name is the field path in the request message. A repeated
|
||||
// field can be represented as multiple query parameters under the same
|
||||
// name.
|
||||
// 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL query parameter, all fields
|
||||
// are passed via URL path and HTTP request body.
|
||||
// 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP request body, all
|
||||
// fields are passed via URL path and URL query parameters.
|
||||
//
|
||||
// ### Path template syntax
|
||||
//
|
||||
// Template = "/" Segments [ Verb ] ;
|
||||
// Segments = Segment { "/" Segment } ;
|
||||
// Segment = "*" | "**" | LITERAL | Variable ;
|
||||
// Variable = "{" FieldPath [ "=" Segments ] "}" ;
|
||||
// FieldPath = IDENT { "." IDENT } ;
|
||||
// Verb = ":" LITERAL ;
|
||||
//
|
||||
// The syntax `*` matches a single URL path segment. The syntax `**` matches
|
||||
// zero or more URL path segments, which must be the last part of the URL path
|
||||
// except the `Verb`.
|
||||
//
|
||||
// The syntax `Variable` matches part of the URL path as specified by its
|
||||
// template. A variable template must not contain other variables. If a variable
|
||||
// matches a single path segment, its template may be omitted, e.g. `{var}`
|
||||
// is equivalent to `{var=*}`.
|
||||
//
|
||||
// The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL`
|
||||
// contains any reserved character, such characters should be percent-encoded
|
||||
// before the matching.
|
||||
//
|
||||
// If a variable contains exactly one path segment, such as `"{var}"` or
|
||||
// `"{var=*}"`, when such a variable is expanded into a URL path on the client
|
||||
// side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The
|
||||
// server side does the reverse decoding. Such variables show up in the
|
||||
// [Discovery
|
||||
// Document](https://developers.google.com/discovery/v1/reference/apis) as
|
||||
// `{var}`.
|
||||
//
|
||||
// If a variable contains multiple path segments, such as `"{var=foo/*}"`
|
||||
// or `"{var=**}"`, when such a variable is expanded into a URL path on the
|
||||
// client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded.
|
||||
// The server side does the reverse decoding, except "%2F" and "%2f" are left
|
||||
// unchanged. Such variables show up in the
|
||||
// [Discovery
|
||||
// Document](https://developers.google.com/discovery/v1/reference/apis) as
|
||||
// `{+var}`.
|
||||
//
|
||||
// ## Using gRPC API Service Configuration
|
||||
//
|
||||
// gRPC API Service Configuration (service config) is a configuration language
|
||||
// for configuring a gRPC service to become a user-facing product. The
|
||||
// service config is simply the YAML representation of the `google.api.Service`
|
||||
// proto message.
|
||||
//
|
||||
// As an alternative to annotating your proto file, you can configure gRPC
|
||||
// transcoding in your service config YAML files. You do this by specifying a
|
||||
// `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same
|
||||
// effect as the proto annotation. This can be particularly useful if you
|
||||
// have a proto that is reused in multiple services. Note that any transcoding
|
||||
// specified in the service config will override any matching transcoding
|
||||
// configuration in the proto.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// http:
|
||||
// rules:
|
||||
// # Selects a gRPC method and applies HttpRule to it.
|
||||
// - selector: example.v1.Messaging.GetMessage
|
||||
// get: /v1/messages/{message_id}/{sub.subfield}
|
||||
//
|
||||
// ## Special notes
|
||||
//
|
||||
// When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the
|
||||
// proto to JSON conversion must follow the [proto3
|
||||
// specification](https://developers.google.com/protocol-buffers/docs/proto3#json).
|
||||
//
|
||||
// While the single segment variable follows the semantics of
|
||||
// [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String
|
||||
// Expansion, the multi segment variable **does not** follow RFC 6570 Section
|
||||
// 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion
|
||||
// does not expand special characters like `?` and `#`, which would lead
|
||||
// to invalid URLs. As the result, gRPC Transcoding uses a custom encoding
|
||||
// for multi segment variables.
|
||||
//
|
||||
// The path variables **must not** refer to any repeated or mapped field,
|
||||
// because client libraries are not capable of handling such variable expansion.
|
||||
//
|
||||
// The path variables **must not** capture the leading "/" character. The reason
|
||||
// is that the most common use case "{var}" does not capture the leading "/"
|
||||
// character. For consistency, all path variables must share the same behavior.
|
||||
//
|
||||
// Repeated message fields must not be mapped to URL query parameters, because
|
||||
// no client library can support such complicated mapping.
|
||||
//
|
||||
// If an API needs to use a JSON array for request or response body, it can map
|
||||
// the request or response body to a repeated field. However, some gRPC
|
||||
// Transcoding implementations may not support this feature.
|
||||
message HttpRule {
|
||||
// Selects a method to which this rule applies.
|
||||
//
|
||||
// Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
|
||||
string selector = 1;
|
||||
|
||||
// Determines the URL pattern is matched by this rules. This pattern can be
|
||||
// used with any of the {get|put|post|delete|patch} methods. A custom method
|
||||
// can be defined using the 'custom' field.
|
||||
oneof pattern {
|
||||
// Maps to HTTP GET. Used for listing and getting information about
|
||||
// resources.
|
||||
string get = 2;
|
||||
|
||||
// Maps to HTTP PUT. Used for replacing a resource.
|
||||
string put = 3;
|
||||
|
||||
// Maps to HTTP POST. Used for creating a resource or performing an action.
|
||||
string post = 4;
|
||||
|
||||
// Maps to HTTP DELETE. Used for deleting a resource.
|
||||
string delete = 5;
|
||||
|
||||
// Maps to HTTP PATCH. Used for updating a resource.
|
||||
string patch = 6;
|
||||
|
||||
// The custom pattern is used for specifying an HTTP method that is not
|
||||
// included in the `pattern` field, such as HEAD, or "*" to leave the
|
||||
// HTTP method unspecified for this rule. The wild-card rule is useful
|
||||
// for services that provide content to Web (HTML) clients.
|
||||
CustomHttpPattern custom = 8;
|
||||
}
|
||||
|
||||
// The name of the request field whose value is mapped to the HTTP request
|
||||
// body, or `*` for mapping all request fields not captured by the path
|
||||
// pattern to the HTTP body, or omitted for not having any HTTP request body.
|
||||
//
|
||||
// NOTE: the referred field must be present at the top-level of the request
|
||||
// message type.
|
||||
string body = 7;
|
||||
|
||||
// Optional. The name of the response field whose value is mapped to the HTTP
|
||||
// response body. When omitted, the entire response message will be used
|
||||
// as the HTTP response body.
|
||||
//
|
||||
// NOTE: The referred field must be present at the top-level of the response
|
||||
// message type.
|
||||
string response_body = 12;
|
||||
|
||||
// Additional HTTP bindings for the selector. Nested bindings must
|
||||
// not contain an `additional_bindings` field themselves (that is,
|
||||
// the nesting may only be one level deep).
|
||||
repeated HttpRule additional_bindings = 11;
|
||||
}
|
||||
|
||||
// A custom pattern is used for defining custom HTTP verb.
|
||||
message CustomHttpPattern {
|
||||
// The name of this custom HTTP verb.
|
||||
string kind = 1;
|
||||
|
||||
// The path matched by this custom verb.
|
||||
string path = 2;
|
||||
}
|
||||
3075
proto/lnd.proto
Normal file
3075
proto/lnd.proto
Normal file
File diff suppressed because it is too large
Load diff
507
proto/loop.proto
Normal file
507
proto/loop.proto
Normal file
|
|
@ -0,0 +1,507 @@
|
|||
syntax = "proto3";
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
|
||||
package looprpc;
|
||||
|
||||
/**
|
||||
SwapClient is a service that handles the client side process of onchain/offchain
|
||||
swaps. The service is designed for a single client.
|
||||
*/
|
||||
service SwapClient {
|
||||
/** loop: `out`
|
||||
LoopOut initiates an loop out swap with the given parameters. The call
|
||||
returns after the swap has been set up with the swap server. From that
|
||||
point onwards, progress can be tracked via the SwapStatus stream that is
|
||||
returned from Monitor().
|
||||
*/
|
||||
rpc LoopOut (LoopOutRequest) returns (SwapResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v1/loop/out"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
/** loop: `in`
|
||||
LoopIn initiates a loop in swap with the given parameters. The call
|
||||
returns after the swap has been set up with the swap server. From that
|
||||
point onwards, progress can be tracked via the SwapStatus stream
|
||||
that is returned from Monitor().
|
||||
*/
|
||||
rpc LoopIn (LoopInRequest) returns (SwapResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v1/loop/in"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
/** loop: `monitor`
|
||||
Monitor will return a stream of swap updates for currently active swaps.
|
||||
*/
|
||||
rpc Monitor (MonitorRequest) returns (stream SwapStatus);
|
||||
|
||||
/** loop: `listswaps`
|
||||
ListSwaps returns a list of all currently known swaps and their current
|
||||
status.
|
||||
*/
|
||||
rpc ListSwaps (ListSwapsRequest) returns (ListSwapsResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v1/loop/swaps"
|
||||
};
|
||||
}
|
||||
|
||||
/** loop: `swapinfo`
|
||||
SwapInfo returns all known details about a single swap.
|
||||
*/
|
||||
rpc SwapInfo (SwapInfoRequest) returns (SwapStatus) {
|
||||
option (google.api.http) = {
|
||||
get: "/v1/loop/swap/{id}"
|
||||
};
|
||||
}
|
||||
|
||||
/** loop: `terms`
|
||||
LoopOutTerms returns the terms that the server enforces for a loop out swap.
|
||||
*/
|
||||
rpc LoopOutTerms (TermsRequest) returns (TermsResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v1/loop/out/terms"
|
||||
};
|
||||
}
|
||||
|
||||
/** loop: `quote`
|
||||
LoopOutQuote returns a quote for a loop out swap with the provided
|
||||
parameters.
|
||||
*/
|
||||
rpc LoopOutQuote (QuoteRequest) returns (QuoteResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v1/loop/out/quote/{amt}"
|
||||
};
|
||||
}
|
||||
|
||||
/** loop: `terms`
|
||||
GetTerms returns the terms that the server enforces for swaps.
|
||||
*/
|
||||
rpc GetLoopInTerms (TermsRequest) returns (TermsResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v1/loop/in/terms"
|
||||
};
|
||||
}
|
||||
|
||||
/** loop: `quote`
|
||||
GetQuote returns a quote for a swap with the provided parameters.
|
||||
*/
|
||||
rpc GetLoopInQuote (QuoteRequest) returns (QuoteResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v1/loop/in/quote/{amt}"
|
||||
};
|
||||
}
|
||||
|
||||
/** loop: `listauth`
|
||||
GetLsatTokens returns all LSAT tokens the daemon ever paid for.
|
||||
*/
|
||||
rpc GetLsatTokens (TokensRequest) returns (TokensResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v1/lsat/tokens"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
message LoopOutRequest {
|
||||
/**
|
||||
Requested swap amount in sat. This does not include the swap and miner fee.
|
||||
*/
|
||||
int64 amt = 1;
|
||||
|
||||
/**
|
||||
Base58 encoded destination address for the swap.
|
||||
*/
|
||||
string dest = 2;
|
||||
|
||||
/**
|
||||
Maximum off-chain fee in msat that may be paid for payment to the server.
|
||||
This limit is applied during path finding. Typically this value is taken
|
||||
from the response of the GetQuote call.
|
||||
*/
|
||||
int64 max_swap_routing_fee = 3;
|
||||
|
||||
/**
|
||||
Maximum off-chain fee in msat that may be paid for payment to the server.
|
||||
This limit is applied during path finding. Typically this value is taken
|
||||
from the response of the GetQuote call.
|
||||
*/
|
||||
int64 max_prepay_routing_fee = 4;
|
||||
|
||||
/**
|
||||
Maximum we are willing to pay the server for the swap. This value is not
|
||||
disclosed in the swap initiation call, but if the server asks for a
|
||||
higher fee, we abort the swap. Typically this value is taken from the
|
||||
response of the GetQuote call. It includes the prepay amount.
|
||||
*/
|
||||
int64 max_swap_fee = 5;
|
||||
|
||||
/**
|
||||
Maximum amount of the swap fee that may be charged as a prepayment.
|
||||
*/
|
||||
int64 max_prepay_amt = 6;
|
||||
|
||||
/**
|
||||
Maximum in on-chain fees that we are willing to spent. If we want to
|
||||
sweep the on-chain htlc and the fee estimate turns out higher than this
|
||||
value, we cancel the swap. If the fee estimate is lower, we publish the
|
||||
sweep tx.
|
||||
|
||||
If the sweep tx is not confirmed, we are forced to ratchet up fees until it
|
||||
is swept. Possibly even exceeding max_miner_fee if we get close to the htlc
|
||||
timeout. Because the initial publication revealed the preimage, we have no
|
||||
other choice. The server may already have pulled the off-chain htlc. Only
|
||||
when the fee becomes higher than the swap amount, we can only wait for fees
|
||||
to come down and hope - if we are past the timeout - that the server is not
|
||||
publishing the revocation.
|
||||
|
||||
max_miner_fee is typically taken from the response of the GetQuote call.
|
||||
*/
|
||||
int64 max_miner_fee = 7;
|
||||
|
||||
/**
|
||||
The channel to loop out, the channel to loop out is selected based on the
|
||||
lowest routing fee for the swap payment to the server.
|
||||
*/
|
||||
uint64 loop_out_channel = 8;
|
||||
|
||||
/**
|
||||
The number of blocks from the on-chain HTLC's confirmation height that it
|
||||
should be swept within.
|
||||
*/
|
||||
int32 sweep_conf_target = 9;
|
||||
|
||||
/**
|
||||
The latest time (in unix seconds) we allow the server to wait before
|
||||
publishing the HTLC on chain. Setting this to a larger value will give the
|
||||
server the opportunity to batch multiple swaps together, and wait for
|
||||
low-fee periods before publishing the HTLC, potentially resulting in a
|
||||
lower total swap fee.
|
||||
*/
|
||||
uint64 swap_publication_deadline = 10;
|
||||
}
|
||||
|
||||
message LoopInRequest {
|
||||
/**
|
||||
Requested swap amount in sat. This does not include the swap and miner
|
||||
fee.
|
||||
*/
|
||||
int64 amt = 1;
|
||||
|
||||
/**
|
||||
Maximum we are willing to pay the server for the swap. This value is not
|
||||
disclosed in the swap initiation call, but if the server asks for a
|
||||
higher fee, we abort the swap. Typically this value is taken from the
|
||||
response of the GetQuote call.
|
||||
*/
|
||||
int64 max_swap_fee = 2;
|
||||
|
||||
/**
|
||||
Maximum in on-chain fees that we are willing to spent. If we want to
|
||||
publish the on-chain htlc and the fee estimate turns out higher than this
|
||||
value, we cancel the swap.
|
||||
|
||||
max_miner_fee is typically taken from the response of the GetQuote call.
|
||||
*/
|
||||
int64 max_miner_fee = 3;
|
||||
|
||||
/**
|
||||
The last hop to use for the loop in swap. If empty, the last hop is selected
|
||||
based on the lowest routing fee for the swap payment from the server.
|
||||
*/
|
||||
bytes last_hop = 4;
|
||||
|
||||
/**
|
||||
If external_htlc is true, we expect the htlc to be published by an external
|
||||
actor.
|
||||
*/
|
||||
bool external_htlc = 5;
|
||||
}
|
||||
|
||||
message SwapResponse {
|
||||
/**
|
||||
Swap identifier to track status in the update stream that is returned from
|
||||
the Start() call. Currently this is the hash that locks the htlcs.
|
||||
DEPRECATED: To make the API more consistent, this field is deprecated in
|
||||
favor of id_bytes and will be removed in a future release.
|
||||
*/
|
||||
string id = 1 [deprecated = true];
|
||||
|
||||
/**
|
||||
Swap identifier to track status in the update stream that is returned from
|
||||
the Start() call. Currently this is the hash that locks the htlcs.
|
||||
*/
|
||||
bytes id_bytes = 3;
|
||||
|
||||
/**
|
||||
The address of the on-chain htlc.
|
||||
*/
|
||||
string htlc_address = 2;
|
||||
}
|
||||
|
||||
message MonitorRequest {
|
||||
}
|
||||
|
||||
message SwapStatus {
|
||||
/**
|
||||
Requested swap amount in sat. This does not include the swap and miner
|
||||
fee.
|
||||
*/
|
||||
int64 amt = 1;
|
||||
|
||||
/**
|
||||
Swap identifier to track status in the update stream that is returned from
|
||||
the Start() call. Currently this is the hash that locks the htlcs.
|
||||
DEPRECATED: To make the API more consistent, this field is deprecated in
|
||||
favor of id_bytes and will be removed in a future release.
|
||||
*/
|
||||
string id = 2 [deprecated = true];
|
||||
|
||||
/**
|
||||
Swap identifier to track status in the update stream that is returned from
|
||||
the Start() call. Currently this is the hash that locks the htlcs.
|
||||
*/
|
||||
bytes id_bytes = 11;
|
||||
|
||||
/**
|
||||
Swap type
|
||||
*/
|
||||
SwapType type = 3;
|
||||
|
||||
/**
|
||||
State the swap is currently in, see State enum.
|
||||
*/
|
||||
SwapState state = 4;
|
||||
|
||||
/**
|
||||
Initiation time of the swap.
|
||||
*/
|
||||
int64 initiation_time = 5;
|
||||
|
||||
/**
|
||||
Initiation time of the swap.
|
||||
*/
|
||||
int64 last_update_time = 6;
|
||||
|
||||
/**
|
||||
Htlc address.
|
||||
*/
|
||||
string htlc_address = 7;
|
||||
|
||||
/// Swap server cost
|
||||
int64 cost_server = 8;
|
||||
|
||||
// On-chain transaction cost
|
||||
int64 cost_onchain = 9;
|
||||
|
||||
// Off-chain routing fees
|
||||
int64 cost_offchain = 10;
|
||||
}
|
||||
|
||||
enum SwapType {
|
||||
// LOOP_OUT indicates an loop out swap (off-chain to on-chain)
|
||||
LOOP_OUT = 0;
|
||||
|
||||
// LOOP_IN indicates a loop in swap (on-chain to off-chain)
|
||||
LOOP_IN = 1;
|
||||
}
|
||||
|
||||
enum SwapState {
|
||||
/**
|
||||
INITIATED is the initial state of a swap. At that point, the initiation
|
||||
call to the server has been made and the payment process has been started
|
||||
for the swap and prepayment invoices.
|
||||
*/
|
||||
INITIATED = 0;
|
||||
|
||||
/**
|
||||
PREIMAGE_REVEALED is reached when the sweep tx publication is first
|
||||
attempted. From that point on, we should consider the preimage to no
|
||||
longer be secret and we need to do all we can to get the sweep confirmed.
|
||||
This state will mostly coalesce with StateHtlcConfirmed, except in the
|
||||
case where we wait for fees to come down before we sweep.
|
||||
*/
|
||||
PREIMAGE_REVEALED = 1;
|
||||
|
||||
/**
|
||||
HTLC_PUBLISHED is reached when the htlc tx has been published in a loop in
|
||||
swap.
|
||||
*/
|
||||
HTLC_PUBLISHED = 2;
|
||||
|
||||
/**
|
||||
SUCCESS is the final swap state that is reached when the sweep tx has
|
||||
the required confirmation depth.
|
||||
*/
|
||||
SUCCESS = 3;
|
||||
|
||||
/**
|
||||
FAILED is the final swap state for a failed swap with or without loss of
|
||||
the swap amount.
|
||||
*/
|
||||
FAILED = 4;
|
||||
|
||||
/**
|
||||
INVOICE_SETTLED is reached when the swap invoice in a loop in swap has been
|
||||
paid, but we are still waiting for the htlc spend to confirm.
|
||||
*/
|
||||
INVOICE_SETTLED = 5;
|
||||
}
|
||||
|
||||
message ListSwapsRequest {
|
||||
}
|
||||
|
||||
message ListSwapsResponse {
|
||||
/**
|
||||
The list of all currently known swaps and their status.
|
||||
*/
|
||||
repeated SwapStatus swaps = 1;
|
||||
}
|
||||
|
||||
message SwapInfoRequest {
|
||||
/**
|
||||
The swap identifier which currently is the hash that locks the HTLCs. When
|
||||
using REST, this field must be encoded as URL safe base64.
|
||||
*/
|
||||
bytes id = 1;
|
||||
}
|
||||
|
||||
message TermsRequest {
|
||||
}
|
||||
|
||||
message TermsResponse {
|
||||
|
||||
reserved 1, 2, 3, 4, 7;
|
||||
|
||||
/**
|
||||
Minimum swap amount (sat)
|
||||
*/
|
||||
int64 min_swap_amount = 5;
|
||||
|
||||
/**
|
||||
Maximum swap amount (sat)
|
||||
*/
|
||||
int64 max_swap_amount = 6;
|
||||
}
|
||||
|
||||
message QuoteRequest {
|
||||
/**
|
||||
The amount to swap in satoshis.
|
||||
*/
|
||||
int64 amt = 1;
|
||||
|
||||
/**
|
||||
The confirmation target that should be used either for the sweep of the
|
||||
on-chain HTLC broadcast by the swap server in the case of a Loop Out, or for
|
||||
the confirmation of the on-chain HTLC broadcast by the swap client in the
|
||||
case of a Loop In.
|
||||
*/
|
||||
int32 conf_target = 2;
|
||||
|
||||
/**
|
||||
If external_htlc is true, we expect the htlc to be published by an external
|
||||
actor.
|
||||
*/
|
||||
bool external_htlc = 3;
|
||||
|
||||
/**
|
||||
The latest time (in unix seconds) we allow the server to wait before
|
||||
publishing the HTLC on chain. Setting this to a larger value will give the
|
||||
server the opportunity to batch multiple swaps together, and wait for
|
||||
low-fee periods before publishing the HTLC, potentially resulting in a
|
||||
lower total swap fee. This only has an effect on loop out quotes.
|
||||
*/
|
||||
uint64 swap_publication_deadline = 4;
|
||||
}
|
||||
|
||||
message QuoteResponse {
|
||||
/**
|
||||
The fee that the swap server is charging for the swap.
|
||||
*/
|
||||
int64 swap_fee = 1;
|
||||
|
||||
/**
|
||||
The part of the swap fee that is requested as a prepayment.
|
||||
*/
|
||||
int64 prepay_amt = 2;
|
||||
|
||||
/**
|
||||
An estimate of the on-chain fee that needs to be paid to sweep the HTLC for
|
||||
a loop out or to pay to the HTLC for loop in. If a miner fee of 0 is
|
||||
returned, it means the external_htlc flag was set for a loop in and the fee
|
||||
estimation was skipped. If a miner fee of -1 is returned, it means lnd's
|
||||
wallet tried to estimate the fee but was unable to create a sample
|
||||
estimation transaction because not enough funds are available. An
|
||||
information message should be shown to the user in this case.
|
||||
*/
|
||||
int64 miner_fee = 3;
|
||||
|
||||
/**
|
||||
The node pubkey where the swap payment needs to be paid
|
||||
to. This can be used to test connectivity before initiating the swap.
|
||||
*/
|
||||
bytes swap_payment_dest = 4;
|
||||
|
||||
/**
|
||||
On-chain cltv expiry delta
|
||||
*/
|
||||
int32 cltv_delta = 5;
|
||||
}
|
||||
|
||||
message TokensRequest {
|
||||
}
|
||||
|
||||
message TokensResponse {
|
||||
/**
|
||||
List of all tokens the daemon knows of, including old/expired tokens.
|
||||
*/
|
||||
repeated LsatToken tokens = 1;
|
||||
}
|
||||
|
||||
message LsatToken {
|
||||
/**
|
||||
The base macaroon that was baked by the auth server.
|
||||
*/
|
||||
bytes base_macaroon = 1;
|
||||
|
||||
/**
|
||||
The payment hash of the payment that was paid to obtain the token.
|
||||
*/
|
||||
bytes payment_hash = 2;
|
||||
|
||||
/**
|
||||
The preimage of the payment hash, knowledge of this is proof that the
|
||||
payment has been paid. If the preimage is set to all zeros, this means the
|
||||
payment is still pending and the token is not yet fully valid.
|
||||
*/
|
||||
bytes payment_preimage = 3;
|
||||
|
||||
/**
|
||||
The amount of millisatoshis that was paid to get the token.
|
||||
*/
|
||||
int64 amount_paid_msat = 4;
|
||||
|
||||
/**
|
||||
The amount of millisatoshis paid in routing fee to pay for the token.
|
||||
*/
|
||||
int64 routing_fee_paid_msat = 5;
|
||||
|
||||
/**
|
||||
The creation time of the token as UNIX timestamp in seconds.
|
||||
*/
|
||||
int64 time_created = 6;
|
||||
|
||||
/**
|
||||
Indicates whether the token is expired or still valid.
|
||||
*/
|
||||
bool expired = 7;
|
||||
|
||||
/**
|
||||
Identifying attribute of this token in the store. Currently represents the
|
||||
file name of the token where it's stored on the file system.
|
||||
*/
|
||||
string storage_name = 8;
|
||||
}
|
||||
88
proxy.go
Normal file
88
proxy.go
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
|
||||
grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
|
||||
grpc_logrus "github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus"
|
||||
grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
|
||||
"github.com/improbable-eng/grpc-web/go/grpcweb"
|
||||
"github.com/mwitkow/grpc-proxy/proxy"
|
||||
"github.com/sirupsen/logrus"
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials"
|
||||
"google.golang.org/grpc/metadata"
|
||||
)
|
||||
|
||||
func buildGrpcProxyServer(logger *logrus.Entry, grpcAddr string, secure bool) *grpcweb.WrappedGrpcServer {
|
||||
// gRPC-wide changes.
|
||||
grpc.EnableTracing = true
|
||||
grpc_logrus.ReplaceGrpcLogger(logger)
|
||||
|
||||
// gRPC proxy logic.
|
||||
backendConn := dialBackendOrFail(grpcAddr, secure)
|
||||
director := func(ctx context.Context, fullMethodName string) (context.Context, *grpc.ClientConn, error) {
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
outCtx, _ := context.WithCancel(ctx)
|
||||
mdCopy := md.Copy()
|
||||
|
||||
delete(mdCopy, "user-agent")
|
||||
// If this header is present in the request from the web client,
|
||||
// the actual connection to the backend will not be established.
|
||||
// https://github.com/improbable-eng/grpc-web/issues/568
|
||||
delete(mdCopy, "connection")
|
||||
outCtx = metadata.NewOutgoingContext(outCtx, mdCopy)
|
||||
return outCtx, backendConn, nil
|
||||
}
|
||||
// Server with logging and monitoring enabled.
|
||||
grpcServer := grpc.NewServer(
|
||||
grpc.CustomCodec(proxy.Codec()), // needed for proxy to function.
|
||||
grpc.UnknownServiceHandler(proxy.TransparentHandler(director)),
|
||||
// The current maximum receive msg size per https://github.com/grpc/grpc-go/blob/v1.8.2/server.go#L54
|
||||
grpc.MaxRecvMsgSize(1024*1024*4),
|
||||
grpc_middleware.WithUnaryServerChain(
|
||||
grpc_logrus.UnaryServerInterceptor(logger),
|
||||
grpc_prometheus.UnaryServerInterceptor,
|
||||
),
|
||||
grpc_middleware.WithStreamServerChain(
|
||||
grpc_logrus.StreamServerInterceptor(logger),
|
||||
grpc_prometheus.StreamServerInterceptor,
|
||||
),
|
||||
)
|
||||
options := []grpcweb.Option{
|
||||
grpcweb.WithCorsForRegisteredEndpointsOnly(false),
|
||||
grpcweb.WithOriginFunc(func(origin string) bool {
|
||||
// allow all CORS requests
|
||||
return true
|
||||
}),
|
||||
}
|
||||
|
||||
return grpcweb.WrapServer(grpcServer, options...)
|
||||
}
|
||||
|
||||
func dialBackendOrFail(grpcAddr string, secure bool) *grpc.ClientConn {
|
||||
opt := []grpc.DialOption{}
|
||||
opt = append(opt, grpc.WithCodec(proxy.Codec()))
|
||||
|
||||
if secure {
|
||||
tlsConfig := &tls.Config{}
|
||||
tlsConfig.MinVersion = tls.VersionTLS12
|
||||
tlsConfig.InsecureSkipVerify = true
|
||||
opt = append(opt, grpc.WithTransportCredentials(credentials.NewTLS(tlsConfig)))
|
||||
} else {
|
||||
opt = append(opt, grpc.WithInsecure())
|
||||
}
|
||||
|
||||
opt = append(opt,
|
||||
grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(1024*1024*4)),
|
||||
grpc.WithBackoffMaxDelay(grpc.DefaultBackoffConfig.MaxDelay),
|
||||
)
|
||||
|
||||
logrus.Infof("Dialing backend GRPC server at %s", grpcAddr)
|
||||
cc, err := grpc.Dial(grpcAddr, opt...)
|
||||
if err != nil {
|
||||
logrus.Fatalf("failed dialing backend: %v", err)
|
||||
}
|
||||
return cc
|
||||
}
|
||||
97
shustar.go
Normal file
97
shustar.go
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
_ "net/http/pprof" // register in DefaultServerMux
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"crypto/tls"
|
||||
|
||||
"github.com/mwitkow/go-conntrack"
|
||||
"github.com/mwitkow/go-conntrack/connhelpers"
|
||||
"github.com/sirupsen/logrus"
|
||||
_ "golang.org/x/net/trace" // register in DefaultServerMux
|
||||
)
|
||||
|
||||
func main() {
|
||||
config, err := loadConfig()
|
||||
if err != nil {
|
||||
logrus.Errorf("error loading config: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
logrus.SetOutput(os.Stdout)
|
||||
logEntry := logrus.NewEntry(logrus.StandardLogger())
|
||||
|
||||
errChan := make(chan error)
|
||||
|
||||
lndGrpcServer := buildGrpcProxyServer(logEntry, config.LNDHost, true)
|
||||
loopGrpcServer := buildGrpcProxyServer(logEntry, config.LoopHost, false)
|
||||
staticFileServer := http.FileServer(http.Dir("./app/build"))
|
||||
|
||||
httpHandler := func(resp http.ResponseWriter, req *http.Request) {
|
||||
if lndGrpcServer.IsGrpcWebRequest(req) {
|
||||
backend := req.Header.Get("X-Grpc-Backend")
|
||||
switch backend {
|
||||
case "lnd":
|
||||
logrus.Info("Handle LND GRPC request: ", req.URL.Path)
|
||||
lndGrpcServer.ServeHTTP(resp, req)
|
||||
case "loop":
|
||||
logrus.Info("Handle Loop GRPC request: ", req.URL.Path)
|
||||
loopGrpcServer.ServeHTTP(resp, req)
|
||||
default:
|
||||
resp.WriteHeader(500)
|
||||
resp.Write([]byte("HTTP header 'X-Grpc-Backend' is missing"))
|
||||
}
|
||||
} else {
|
||||
// fallback to static file hosting for client app
|
||||
logrus.Info("Handle static file request: ", req.URL.Path)
|
||||
staticFileServer.ServeHTTP(resp, req)
|
||||
}
|
||||
}
|
||||
httpServer := &http.Server{
|
||||
WriteTimeout: time.Second * 10,
|
||||
ReadTimeout: time.Second * 10,
|
||||
Handler: http.HandlerFunc(httpHandler),
|
||||
}
|
||||
httpListener := buildListenerOrFail("http", config.HTTPSListen)
|
||||
httpListener = tls.NewListener(httpListener, buildServerTLSOrFail(config))
|
||||
|
||||
go func() {
|
||||
logrus.Infof("Listening for http_tls on: %v", httpListener.Addr().String())
|
||||
if err := httpServer.Serve(httpListener); err != nil {
|
||||
errChan <- fmt.Errorf("http_tls server error: %v", err)
|
||||
}
|
||||
}()
|
||||
|
||||
<-errChan
|
||||
}
|
||||
|
||||
func buildListenerOrFail(name string, addr string) net.Listener {
|
||||
listener, err := net.Listen("tcp", addr)
|
||||
if err != nil {
|
||||
logrus.Fatalf("failed listening for '%v' on %v: %v", name, addr, err)
|
||||
}
|
||||
return conntrack.NewListener(listener,
|
||||
conntrack.TrackWithName(name),
|
||||
conntrack.TrackWithTcpKeepAlive(20*time.Second),
|
||||
conntrack.TrackWithTracing(),
|
||||
)
|
||||
}
|
||||
|
||||
func buildServerTLSOrFail(config *config) *tls.Config {
|
||||
tlsConfig, err := connhelpers.TlsConfigForServerCerts(config.TLSCertPath, config.TLSKeyPath)
|
||||
if err != nil {
|
||||
logrus.Fatalf("failed reading TLS server keys: %v", err)
|
||||
}
|
||||
tlsConfig.MinVersion = tls.VersionTLS12
|
||||
tlsConfig.ClientAuth = tls.NoClientCert
|
||||
tlsConfig, err = connhelpers.TlsConfigWithHttp2Enabled(tlsConfig)
|
||||
if err != nil {
|
||||
logrus.Fatalf("can't configure h2 handling: %v", err)
|
||||
}
|
||||
return tlsConfig
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue