Skip to content
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

chore: update fedimint gateway types #469

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
11 changes: 7 additions & 4 deletions apps/gateway-ui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,20 @@ export const App = React.memo(function Admin(): JSX.Element {
const gateway = useMemo(() => new GatewayApi(), []);

const [gatewayInfo, setGatewayInfo] = useState<GatewayInfo>({
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<boolean>(false);
const [loading, setLoading] = useState(true);
Expand Down
51 changes: 24 additions & 27 deletions packages/types/src/gateway.ts
Original file line number Diff line number Diff line change
@@ -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;
}
Loading