From bebaeacf85d24ce7d0de9ad3367364551e66f125 Mon Sep 17 00:00:00 2001 From: Rachel Fish Date: Mon, 24 Mar 2025 00:38:47 -0600 Subject: [PATCH] api: Add litd and loop GetInfo commands for version detection --- app/src/api/lit.ts | 8 ++++++++ app/src/api/loop.ts | 9 +++++++++ app/src/setupProxy.js | 1 + 3 files changed, 18 insertions(+) diff --git a/app/src/api/lit.ts b/app/src/api/lit.ts index 174e5a9a8..83d8e9c57 100644 --- a/app/src/api/lit.ts +++ b/app/src/api/lit.ts @@ -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'; @@ -21,6 +23,12 @@ class LitApi extends BaseApi { this._grpc = grpc; } + async getInfo(): Promise { + 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 */ diff --git a/app/src/api/loop.ts b/app/src/api/loop.ts index aab458633..b17675c5c 100644 --- a/app/src/api/loop.ts +++ b/app/src/api/loop.ts @@ -24,6 +24,15 @@ class LoopApi extends BaseApi { this._grpc = grpc; } + /** + * call the Loop `GetInfo` RPC and return the response + */ + async getInfo(): Promise { + 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 */ diff --git a/app/src/setupProxy.js b/app/src/setupProxy.js index eb8ed21b7..e96cc9fe0 100644 --- a/app/src/setupProxy.js +++ b/app/src/setupProxy.js @@ -12,6 +12,7 @@ module.exports = function (app) { '/litrpc.Session', '/litrpc.Accounts', '/litrpc.Status', + '/litrpc.Proxy', ], { target: 'https://localhost:8443',