From e7462cc180fddbeaf183e473ff6d9712d7c5e697 Mon Sep 17 00:00:00 2001 From: Tommy Volk Date: Mon, 5 Aug 2024 20:10:27 -0500 Subject: [PATCH] chore: update fedimint gateway types --- apps/gateway-ui/src/App.tsx | 11 +++++--- packages/types/src/gateway.ts | 51 +++++++++++++++++------------------ 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/apps/gateway-ui/src/App.tsx b/apps/gateway-ui/src/App.tsx index c27ac385..73f566cf 100644 --- a/apps/gateway-ui/src/App.tsx +++ b/apps/gateway-ui/src/App.tsx @@ -25,17 +25,20 @@ export const App = React.memo(function Admin(): JSX.Element { const gateway = useMemo(() => new GatewayApi(), []); const [gatewayInfo, setGatewayInfo] = useState({ + version_hash: '', federations: [], + lightning_pub_key: '', + lightning_alias: '', fees: { base_msat: 0, proportional_millionths: 0, }, + route_hints: [], gateway_id: '', gateway_state: '', - lightning_alias: '', - lightning_pub_key: '', - route_hints: [], - version_hash: '', + network: undefined, + block_height: undefined, + synced_to_chain: false, }); const [authenticated, setAuthenticated] = useState(false); const [loading, setLoading] = useState(true); diff --git a/packages/types/src/gateway.ts b/packages/types/src/gateway.ts index ab893b3d..71dea580 100644 --- a/packages/types/src/gateway.ts +++ b/packages/types/src/gateway.ts @@ -1,56 +1,53 @@ import { Network } from './bitcoin'; import { GatewayClientConfig } from './federation'; -export interface Gateway { - api: string; - fees: Fees; - gateway_id: string; - gateway_redeem_key: string; +export interface LightningGateway { mint_channel_id: number; + gateway_redeem_key: string; node_pub_key: string; + lightning_alias: string; + api: string; route_hints: RouteHint[]; - valid_until: Validity; + fees: RoutingFees; + gateway_id: string; + supports_private_payments: boolean; } -export interface RouteHint { +export type RouteHint = RouteHintHop[]; + +export interface RouteHintHop { + src_node_id: string; + short_channel_id: string; base_msat: number; proportional_millionths: number; cltv_expiry_delta: number; - htlc_maximum_msat: number; - htlc_minimum_msat: number; - short_channel_id: string; - src_node_id: string; + htlc_minimum_msat?: number; + htlc_maximum_msat?: number; } -export interface Fees { +export interface RoutingFees { base_msat: number; proportional_millionths: number; } -interface Validity { - nanos_since_epoch: number; - secs_since_epoch: number; -} - export interface FederationInfo { federation_id: string; balance_msat: number; - channel_id: number; config: GatewayClientConfig; - routing_fees: { - base_msat: number; - proportional_millionths: number; - }; + channel_id?: number; + routing_fees?: RoutingFees; } export interface GatewayInfo { + version_hash: string; federations: FederationInfo[]; - fees: Fees; + lightning_pub_key: string; + lightning_alias: string; + fees: RoutingFees; + route_hints: RouteHint[]; gateway_id: string; gateway_state: string; - lightning_alias: string; - lightning_pub_key: string; network?: Network; - route_hints: RouteHint[]; - version_hash: string; + block_height?: number; + synced_to_chain: boolean; }