Skip to content

Commit ad5e49b

Browse files
authored
Merge pull request #176 from lightninglabs/pool-user-agent
Add Pool user agent
2 parents 93523cd + 955920a commit ad5e49b

32 files changed

+423
-337
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ RUN apk add --no-cache --update alpine-sdk \
2929

3030
# The first stage is already done and all static assets should now be generated
3131
# in the app/build sub directory.
32-
FROM golang:1.15.5-alpine as golangbuilder
32+
FROM golang:1.15.7-alpine as golangbuilder
3333

3434
# Instead of checking out from git again, we just copy the whole working
3535
# directory of the previous stage that includes the generated static assets.

Makefile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ PKG := github.com/lightninglabs/lightning-terminal
22
ESCPKG := github.com\/lightninglabs\/lightning-terminal
33
LND_PKG := github.com/lightningnetwork/lnd
44
LOOP_PKG := github.com/lightninglabs/loop
5+
POOL_PKG := github.com/lightninglabs/pool
56

67
LINT_PKG := github.com/golangci/golangci-lint/cmd/golangci-lint
78
GOVERALLS_PKG := github.com/mattn/goveralls
@@ -23,6 +24,12 @@ LOOP_COMMIT := $(shell cat go.mod | \
2324
awk -F " " '{ print $$2 }' | \
2425
awk -F "/" '{ print $$1 }')
2526

27+
POOL_COMMIT := $(shell cat go.mod | \
28+
grep $(POOL_PKG) | \
29+
head -n1 | \
30+
awk -F " " '{ print $$2 }' | \
31+
awk -F "/" '{ print $$1 }')
32+
2633
LINT_COMMIT := v1.18.0
2734
GOACC_COMMIT := ddc355013f90fea78d83d3a6c71f1d37ac07ecd5
2835

@@ -52,7 +59,8 @@ make_ldflags = $(2) -X $(LND_PKG)/build.Commit=lightning-terminal-$(COMMIT) \
5259
-X $(LND_PKG)/build.CommitHash=$(COMMIT_HASH) \
5360
-X $(LND_PKG)/build.GoVersion=$(GOVERSION) \
5461
-X $(LND_PKG)/build.RawTags=$(shell echo $(1) | sed -e 's/ /,/g') \
55-
-X $(LOOP_PKG).Commit=$(LOOP_COMMIT)
62+
-X $(LOOP_PKG).Commit=$(LOOP_COMMIT) \
63+
-X $(POOL_PKG).Commit=$(POOL_COMMIT)
5664

5765
LDFLAGS := $(call make_ldflags, $(LND_RELEASE_TAGS))
5866

@@ -119,7 +127,7 @@ go-install-cli:
119127
$(GOINSTALL) -trimpath -tags="$(LND_RELEASE_TAGS)" -ldflags "$(LDFLAGS)" github.com/lightningnetwork/lnd/cmd/lncli
120128
$(GOINSTALL) -trimpath -ldflags "$(LDFLAGS)" github.com/lightninglabs/loop/cmd/loop
121129
$(GOINSTALL) -trimpath github.com/lightninglabs/faraday/cmd/frcli
122-
$(GOINSTALL) -trimpath github.com/lightninglabs/pool/cmd/pool
130+
$(GOINSTALL) -trimpath -ldflags "$(LDFLAGS)" github.com/lightninglabs/pool/cmd/pool
123131

124132
app-build: yarn-install
125133
@$(call print, "Building production app.")

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ Lightning Terminal is backwards compatible with `lnd` back to version v0.11.1-be
6666

6767
| LiT | LND |
6868
| ---------------- | ------------ |
69+
| **v0.4.0-alpha** | v0.11.1-beta |
6970
| **v0.3.4-alpha** | v0.11.1-beta |
7071
| **v0.3.3-alpha** | v0.11.1-beta |
7172
| **v0.3.2-alpha** | v0.11.1-beta |
@@ -77,6 +78,7 @@ Lightning Terminal is backwards compatible with `lnd` back to version v0.11.1-be
7778

7879
| LiT | LND | Loop | Faraday | Pool |
7980
| ---------------- | ------------ | ----------- | ------------ |---------------|
81+
| **v0.4.0-alpha** | v0.12.0-beta | v0.11.2-beta | v0.2.3-alpha | v0.4.3-alpha |
8082
| **v0.3.4-alpha** | v0.11.1-beta | v0.11.2-beta | v0.2.2-alpha | v0.3.4-alpha |
8183
| **v0.3.3-alpha** | v0.11.1-beta | v0.11.2-beta | v0.2.2-alpha | v0.3.4-alpha |
8284
| **v0.3.2-alpha** | v0.11.1-beta | v0.11.1-beta | v0.2.2-alpha | v0.3.4-alpha |

app/scripts/build-protos.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
const util = require('util');
33
const https = require('https');
44
const exec = util.promisify(require('child_process').exec);
5-
const { promises: fs } = require('fs');
6-
const { join, sep } = require('path');
5+
const { promises: fs, mkdirSync } = require('fs');
6+
const { join, sep, dirname } = require('path');
77
const { platform } = require('os');
88
const appPath = join(__dirname, '..');
99

@@ -41,7 +41,7 @@ const protoSources = async () => {
4141
lnd: `lightningnetwork/lnd/${lndVersion[1]}/lnrpc/rpc.proto`,
4242
loop: `lightninglabs/loop/${loopVersion[1]}/looprpc/client.proto`,
4343
trader: `lightninglabs/pool/${poolVersion[1]}/poolrpc/trader.proto`,
44-
auctioneer: `lightninglabs/pool/${poolVersion[1]}/poolrpc/auctioneer.proto`,
44+
'auctioneerrpc/auctioneer': `lightninglabs/pool/${poolVersion[1]}/auctioneerrpc/auctioneer.proto`,
4545
};
4646
};
4747

@@ -50,7 +50,7 @@ const filePatches = {
5050
lnd: 'lnrpc: {}',
5151
loop: 'looprpc: {}',
5252
trader: 'poolrpc: {}',
53-
auctioneer: 'poolrpc: {}',
53+
'auctioneerrpc/auctioneer': 'poolrpc: {}',
5454
'google/api/annotations': 'google: { api: {} }',
5555
'google/api/http': 'google: { api: {} }',
5656
};
@@ -63,6 +63,7 @@ const download = async () => {
6363
for ([name, urlPath] of Object.entries(await protoSources())) {
6464
const url = `https://raw.githubusercontent.com/${urlPath}`;
6565
const filePath = join(appPath, '..', 'proto', `${name}.proto`);
66+
mkdirSync(dirname(filePath), {recursive: true});
6667
console.log(`${url}`);
6768
console.log(` -> ${filePath}`);
6869
const content = await new Promise((resolve, reject) => {
@@ -92,6 +93,7 @@ const generate = async () => {
9293
);
9394
const protocCmd = [
9495
'protoc',
96+
`-I../proto`,
9597
`--plugin=protoc-gen-ts=${protocGen}`,
9698
'--proto_path=../proto',
9799
'--js_out=import_style=commonjs,binary:./src/types/generated',

app/src/__tests__/store/batchStore.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { keys, runInAction, values } from 'mobx';
2-
import * as AUCT from 'types/generated/auctioneer_pb';
2+
import * as AUCT from 'types/generated/auctioneerrpc/auctioneer_pb';
33
import { grpc } from '@improbable-eng/grpc-web';
44
import { waitFor } from '@testing-library/react';
55
import * as config from 'config';

app/src/__tests__/store/orderStore.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { values } from 'mobx';
2-
import * as AUCT from 'types/generated/auctioneer_pb';
2+
import * as AUCT from 'types/generated/auctioneerrpc/auctioneer_pb';
33
import * as POOL from 'types/generated/trader_pb';
44
import { grpc } from '@improbable-eng/grpc-web';
55
import { waitFor } from '@testing-library/react';

app/src/api/pool.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as AUCT from 'types/generated/auctioneer_pb';
1+
import * as AUCT from 'types/generated/auctioneerrpc/auctioneer_pb';
22
import * as POOL from 'types/generated/trader_pb';
33
import { Trader } from 'types/generated/trader_pb_service';
44
import { b64 } from 'util/strings';
@@ -22,6 +22,8 @@ export const MIN_FEE_RATE_KW = 253;
2222
// see: https://github.com/lightninglabs/pool/blob/master/order/interface.go#L35
2323
export const ORDER_VERSION = 2;
2424

25+
const POOL_INITIATOR = 'lit-ui';
26+
2527
/** the names and argument types for the subscription events */
2628
// eslint-disable-next-line @typescript-eslint/no-empty-interface
2729
interface PoolEvents {}
@@ -63,6 +65,7 @@ class PoolApi extends BaseApi<PoolEvents> {
6365
req.setAccountValue(amount);
6466
req.setRelativeHeight(expiryBlocks);
6567
req.setConfTarget(confTarget);
68+
req.setInitiator(POOL_INITIATOR);
6669
const res = await this._grpc.request(Trader.InitAccount, req, this._meta);
6770
return res.toObject();
6871
}
@@ -176,6 +179,7 @@ class PoolApi extends BaseApi<PoolEvents> {
176179
}
177180

178181
const req = new POOL.SubmitOrderRequest();
182+
req.setInitiator(POOL_INITIATOR);
179183

180184
const order = new POOL.Order();
181185
order.setTraderKey(b64(traderKey));

app/src/store/models/batch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { makeAutoObservable, observable } from 'mobx';
2-
import * as AUCT from 'types/generated/auctioneer_pb';
2+
import * as AUCT from 'types/generated/auctioneerrpc/auctioneer_pb';
33
import { LeaseDuration } from 'types/state';
44
import Big from 'big.js';
55
import { toPercent } from 'util/bigmath';

app/src/store/models/lease.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { makeAutoObservable } from 'mobx';
2-
import * as AUCT from 'types/generated/auctioneer_pb';
2+
import * as AUCT from 'types/generated/auctioneerrpc/auctioneer_pb';
33
import * as POOL from 'types/generated/trader_pb';
44
import Big from 'big.js';
55
import { CsvColumns } from 'util/csv';

app/src/store/models/market.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { makeAutoObservable, observable, ObservableMap } from 'mobx';
2-
import * as AUCT from 'types/generated/auctioneer_pb';
2+
import * as AUCT from 'types/generated/auctioneerrpc/auctioneer_pb';
33
import { hex } from 'util/strings';
44
import { Store } from 'store';
55
import { Batch } from './';

0 commit comments

Comments
 (0)