Skip to content

Commit 43f5ff1

Browse files
committed
app: remove unused gRPC metadata fields
1 parent b96b497 commit 43f5ff1

File tree

3 files changed

+11
-26
lines changed

3 files changed

+11
-26
lines changed

app/src/api/lnd.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
import * as LND from 'types/generated/lnd_pb';
22
import { Lightning } from 'types/generated/lnd_pb_service';
3-
import { DEV_MACAROON } from 'config';
43
import GrpcClient from './grpc';
54

65
/**
76
* An API wrapper to communicate with the LND node via GRPC
87
*/
98
class LndApi {
10-
_meta = {
11-
'X-Grpc-Backend': 'lnd',
12-
macaroon: DEV_MACAROON,
13-
};
149

1510
private _grpc: GrpcClient;
1611

@@ -23,7 +18,7 @@ class LndApi {
2318
*/
2419
async getInfo(): Promise<LND.GetInfoResponse.AsObject> {
2520
const req = new LND.GetInfoRequest();
26-
const res = await this._grpc.request(Lightning.GetInfo, req, this._meta);
21+
const res = await this._grpc.request(Lightning.GetInfo, req);
2722
return res.toObject();
2823
}
2924

@@ -32,7 +27,7 @@ class LndApi {
3227
*/
3328
async channelBalance(): Promise<LND.ChannelBalanceResponse.AsObject> {
3429
const req = new LND.ChannelBalanceRequest();
35-
const res = await this._grpc.request(Lightning.ChannelBalance, req, this._meta);
30+
const res = await this._grpc.request(Lightning.ChannelBalance, req);
3631
return res.toObject();
3732
}
3833

@@ -41,7 +36,7 @@ class LndApi {
4136
*/
4237
async walletBalance(): Promise<LND.WalletBalanceResponse.AsObject> {
4338
const req = new LND.WalletBalanceRequest();
44-
const res = await this._grpc.request(Lightning.WalletBalance, req, this._meta);
39+
const res = await this._grpc.request(Lightning.WalletBalance, req);
4540
return res.toObject();
4641
}
4742

@@ -50,7 +45,7 @@ class LndApi {
5045
*/
5146
async listChannels(): Promise<LND.ListChannelsResponse.AsObject> {
5247
const req = new LND.ListChannelsRequest();
53-
const res = await this._grpc.request(Lightning.ListChannels, req, this._meta);
48+
const res = await this._grpc.request(Lightning.ListChannels, req);
5449
return res.toObject();
5550
}
5651
}

app/src/api/loop.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ import GrpcClient from './grpc';
88
* An API wrapper to communicate with the Loop daemon via GRPC
99
*/
1010
class LoopApi {
11-
_meta = {
12-
'X-Grpc-Backend': 'loop',
13-
};
1411

1512
private _grpc: GrpcClient;
1613

@@ -23,7 +20,7 @@ class LoopApi {
2320
*/
2421
async listSwaps(): Promise<LOOP.ListSwapsResponse.AsObject> {
2522
const req = new LOOP.ListSwapsRequest();
26-
const res = await this._grpc.request(SwapClient.ListSwaps, req, this._meta);
23+
const res = await this._grpc.request(SwapClient.ListSwaps, req);
2724
return res.toObject();
2825
}
2926

@@ -32,7 +29,7 @@ class LoopApi {
3229
*/
3330
async getLoopInTerms(): Promise<LOOP.TermsResponse.AsObject> {
3431
const req = new LOOP.TermsRequest();
35-
const res = await this._grpc.request(SwapClient.GetLoopInTerms, req, this._meta);
32+
const res = await this._grpc.request(SwapClient.GetLoopInTerms, req);
3633
return res.toObject();
3734
}
3835

@@ -41,7 +38,7 @@ class LoopApi {
4138
*/
4239
async getLoopOutTerms(): Promise<LOOP.TermsResponse.AsObject> {
4340
const req = new LOOP.TermsRequest();
44-
const res = await this._grpc.request(SwapClient.LoopOutTerms, req, this._meta);
41+
const res = await this._grpc.request(SwapClient.LoopOutTerms, req);
4542
return res.toObject();
4643
}
4744

@@ -51,7 +48,7 @@ class LoopApi {
5148
async getLoopInQuote(amount: Big): Promise<LOOP.QuoteResponse.AsObject> {
5249
const req = new LOOP.QuoteRequest();
5350
req.setAmt(+amount);
54-
const res = await this._grpc.request(SwapClient.GetLoopInQuote, req, this._meta);
51+
const res = await this._grpc.request(SwapClient.GetLoopInQuote, req);
5552
return res.toObject();
5653
}
5754

@@ -61,7 +58,7 @@ class LoopApi {
6158
async getLoopOutQuote(amount: Big): Promise<LOOP.QuoteResponse.AsObject> {
6259
const req = new LOOP.QuoteRequest();
6360
req.setAmt(+amount);
64-
const res = await this._grpc.request(SwapClient.LoopOutQuote, req, this._meta);
61+
const res = await this._grpc.request(SwapClient.LoopOutQuote, req);
6562
return res.toObject();
6663
}
6764

@@ -78,7 +75,7 @@ class LoopApi {
7875
req.setMaxSwapFee(+quote.swapFee);
7976
req.setMaxMinerFee(+quote.minerFee);
8077
if (lastHop) req.setLastHop(Buffer.from(lastHop, 'hex').toString('base64'));
81-
const res = await this._grpc.request(SwapClient.LoopIn, req, this._meta);
78+
const res = await this._grpc.request(SwapClient.LoopIn, req);
8279
return res.toObject();
8380
}
8481

@@ -101,7 +98,7 @@ class LoopApi {
10198
req.setOutgoingChanSetList(chanIds);
10299
req.setSwapPublicationDeadline(deadline);
103100

104-
const res = await this._grpc.request(SwapClient.LoopOut, req, this._meta);
101+
const res = await this._grpc.request(SwapClient.LoopOut, req);
105102
return res.toObject();
106103
}
107104

app/src/config.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,6 @@ export const IS_PROD = process.env.NODE_ENV === 'production';
77
// flag to check if the app is running in a a test environment
88
export const IS_TEST = process.env.NODE_ENV === 'test';
99

10-
//
11-
// temporary placeholder values. these will be supplied via the UI in the future
12-
//
13-
14-
// macaroon to use for LND auth
15-
export const DEV_MACAROON = process.env.REACT_APP_DEV_MACAROON || '';
16-
1710
// detect the host currently serving the app files
1811
const { protocol, hostname, port } = window.location;
1912
const host = `${protocol}//${hostname}:${port}`;

0 commit comments

Comments
 (0)