Skip to content

Commit bebaeac

Browse files
committed
api: Add litd and loop GetInfo commands for version detection
1 parent 1462832 commit bebaeac

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

app/src/api/lit.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import * as ACCOUNT from 'types/generated/lit-accounts_pb';
22
import * as SESSION from 'types/generated/lit-sessions_pb';
33
import * as STATUS from 'types/generated/lit-status_pb';
4+
import * as PROXY from 'types/generated/proxy_pb';
45
import { Accounts } from 'types/generated/lit-accounts_pb_service';
56
import { Sessions } from 'types/generated/lit-sessions_pb_service';
67
import { Status } from 'types/generated/lit-status_pb_service';
8+
import { Proxy } from 'types/generated/proxy_pb_service';
79
import { b64 } from 'util/strings';
810
import { MAX_DATE } from 'util/constants';
911
import BaseApi from './base';
@@ -21,6 +23,12 @@ class LitApi extends BaseApi<LitEvents> {
2123
this._grpc = grpc;
2224
}
2325

26+
async getInfo(): Promise<PROXY.GetInfoResponse.AsObject> {
27+
const req = new PROXY.GetInfoRequest();
28+
const res = await this._grpc.request(Proxy.GetInfo, req, this._meta);
29+
return res.toObject();
30+
}
31+
2432
/**
2533
* call the Lit `CreateAccount` RPC and return the response
2634
*/

app/src/api/loop.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ class LoopApi extends BaseApi<LoopEvents> {
2424
this._grpc = grpc;
2525
}
2626

27+
/**
28+
* call the Loop `GetInfo` RPC and return the response
29+
*/
30+
async getInfo(): Promise<LOOP.GetInfoResponse.AsObject> {
31+
const req = new LOOP.GetInfoRequest();
32+
const res = await this._grpc.request(SwapClient.GetInfo, req, this._meta);
33+
return res.toObject();
34+
}
35+
2736
/**
2837
* call the Loop `ListSwaps` RPC and return the response
2938
*/

app/src/setupProxy.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ module.exports = function (app) {
1212
'/litrpc.Session',
1313
'/litrpc.Accounts',
1414
'/litrpc.Status',
15+
'/litrpc.Proxy',
1516
],
1617
{
1718
target: 'https://localhost:8443',

0 commit comments

Comments
 (0)