Skip to content

Commit

Permalink
Merge pull request #87 from okjodom/type-updates
Browse files Browse the repository at this point in the history
Type Updates
  • Loading branch information
justinmoon authored Jul 18, 2023
2 parents 2619034 + d3530f1 commit 43debed
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 37 deletions.
2 changes: 1 addition & 1 deletion apps/gateway-ui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const App = React.memo(function Admin(): JSX.Element {
{gatewayInfo.federations.map((federation: Federation) => {
return (
<FederationCard
key={federation.registration.gateway_pub_key}
key={federation.federation_id}
federation={federation}
/>
);
Expand Down
8 changes: 2 additions & 6 deletions apps/gateway-ui/src/components/FederationCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ enum OpenTab {
}

export const FederationCard = (props: FederationCardProps): JSX.Element => {
const {
federation_id,
balance_msat,
registration: { gateway_pub_key },
} = props.federation;
const { federation_id, balance_msat } = props.federation;

const [showDetails, setShowDetails] = useState<boolean>(false);
const [tab, setOpenTab] = useState<{ open: OpenTab; mru: OpenTab }>({
Expand Down Expand Up @@ -74,7 +70,7 @@ export const FederationCard = (props: FederationCardProps): JSX.Element => {
</Circle>
<Box pl='2'>
<Text fontSize={{ base: '13px', md: '15px', lg: '16px' }}>
{`${gateway_pub_key?.substring(0, 24)}...`}
{`${federation_id.substring(0, 24)}...`}
</Text>
</Box>
</HStack>
Expand Down
23 changes: 2 additions & 21 deletions apps/gateway-ui/src/types.tsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,16 @@
export interface Fees {
interface Fees {
base_msat: number;
proportional_millionths: number;
}
export interface Registration {
gateway_pub_key: string;
api: string;
fees: Fees;
mint_channel_id: number;
node_pub_key: string;
route_hints: object[]; // FIXME : https://github.com/fedimint/ui/issues/80
valid_until: {
nanos_since_epoch: number;
secs_since_epoch: number;
};
}

export interface Federation {
federation_id: string;
registration: Registration;
balance_msat: number;
lightning_alias: string;
version_hash: string;
lightning_pub_key: string;
}

export interface GatewayInfo {
federations: Federation[];
fees: {
base_msat: number;
proportional_millionths: number;
};
fees: Fees;
lightning_alias: string;
lightning_pub_key: string;
version_hash: string;
Expand Down
1 change: 0 additions & 1 deletion apps/guardian-ui/src/GuardianApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { ConfigGenParams, ConsensusState, PeerHashMap } from './setup/types';
import {
ConfigResponse,
ConsensusStatus,
Gateway,
ServerStatus,
StatusResponse,
Versions,
Expand Down
2 changes: 1 addition & 1 deletion apps/guardian-ui/src/components/ConnectedNodes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const ConnectedNodes: FC<ConnectedNodesProps> = ({ gateways }) => {
<>
{gateways.map((gateway: Gateway) => (
<LightningNode
key={gateway.gateway_pub_key}
key={gateway.gateway_id}
nodeName={'Gateway'}
nodeId={gateway.node_pub_key}
incomingFees={gateway.fees}
Expand Down
27 changes: 20 additions & 7 deletions apps/guardian-ui/src/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,25 +75,38 @@ export interface ClientConfig {
modules: Record<number, FedimintModule>;
meta: MetaConfig;
}

export interface ConfigResponse {
client_config: ClientConfig;
}

// These types are shared with the gateway-ui
interface Validity {
nanos_since_epoch: number;
secs_since_epoch: number;
}

export interface Fees {
base_msat: number;
proportional_millionths: number;
}

export interface Gateway {
gateway_pub_key: string;
api: string;
fees: Fees;
gateway_id: string;
gateway_redeem_key: string;
mint_channel_id: number;
node_pub_key: string;
route_hints: object[]; // FIXME: https://github.com/fedimint/ui/issues/80
valid_until: {
nanos_since_epoch: number;
secs_since_epoch: number;
};
route_hints: RouteHint[];
valid_until: Validity;
}

interface RouteHint {
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;
}

0 comments on commit 43debed

Please sign in to comment.