Skip to content

api: Add litd and loop GetInfo commands for version detection #1013

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions app/src/api/lit.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import * as ACCOUNT from 'types/generated/lit-accounts_pb';
import * as SESSION from 'types/generated/lit-sessions_pb';
import * as STATUS from 'types/generated/lit-status_pb';
import * as PROXY from 'types/generated/proxy_pb';
import { Accounts } from 'types/generated/lit-accounts_pb_service';
import { Sessions } from 'types/generated/lit-sessions_pb_service';
import { Status } from 'types/generated/lit-status_pb_service';
import { Proxy } from 'types/generated/proxy_pb_service';
import { b64 } from 'util/strings';
import { MAX_DATE } from 'util/constants';
import BaseApi from './base';
Expand All @@ -21,6 +23,12 @@ class LitApi extends BaseApi<LitEvents> {
this._grpc = grpc;
}

async getInfo(): Promise<PROXY.GetInfoResponse.AsObject> {
const req = new PROXY.GetInfoRequest();
const res = await this._grpc.request(Proxy.GetInfo, req, this._meta);
return res.toObject();
}

/**
* call the Lit `CreateAccount` RPC and return the response
*/
Expand Down
9 changes: 9 additions & 0 deletions app/src/api/loop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ class LoopApi extends BaseApi<LoopEvents> {
this._grpc = grpc;
}

/**
* call the Loop `GetInfo` RPC and return the response
*/
async getInfo(): Promise<LOOP.GetInfoResponse.AsObject> {
const req = new LOOP.GetInfoRequest();
const res = await this._grpc.request(SwapClient.GetInfo, req, this._meta);
return res.toObject();
}

/**
* call the Loop `ListSwaps` RPC and return the response
*/
Expand Down
1 change: 1 addition & 0 deletions app/src/setupProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module.exports = function (app) {
'/litrpc.Session',
'/litrpc.Accounts',
'/litrpc.Status',
'/litrpc.Proxy',
],
{
target: 'https://localhost:8443',
Expand Down
Loading