Skip to content

Commit

Permalink
Fix type definition
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhamkmr04 committed Jan 16, 2025
1 parent 00d6dbb commit f5c6070
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
2 changes: 2 additions & 0 deletions stores/SwapStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ export default class SwapStore {
let stateColor;
switch (status) {
case 'transaction.claimed':
case 'invoice.settled':
stateColor = 'green';
break;
case 'invoice.failedToPay':
case 'swap.expired':
case 'invoice.expired':
case 'transaction.lockupFailed':
stateColor = themeColor('error');
break;
Expand Down
24 changes: 14 additions & 10 deletions views/SwapDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,18 @@ interface SwapDetailsProps {
{
swapData: any;
keys: any;
endpoint: any;
invoice: any;
feeRate: any;
endpoint: string;
invoice: string;
fee: string;
}
>;
NodeInfoStore?: NodeInfoStore;
SwapStore?: SwapStore;
}

interface SwapDetailsState {
updates: any;
error: any;
updates: string | null;
error: string | { message?: string } | null;
loading: boolean;
}

Expand Down Expand Up @@ -235,7 +235,7 @@ export default class SwapDetails extends React.Component<
pollingInterval: number,
isSubmarineSwap: boolean
) => {
const { keys, endpoint, swapData, feeRate } = this.props.route.params;
const { keys, endpoint, swapData, fee } = this.props.route.params;

if (!createdResponse || !createdResponse.id) {
console.error('Invalid response:', createdResponse);
Expand Down Expand Up @@ -302,7 +302,7 @@ export default class SwapDetails extends React.Component<
swapData.destinationAddress,
swapData.preimage,
data.transaction.hex,
feeRate
fee
);
} else if (
data.status === 'invoice.expired' ||
Expand Down Expand Up @@ -489,7 +489,7 @@ export default class SwapDetails extends React.Component<
destinationAddress: string,
preimage: any,
transactionHex: string,
feeRate: any
fee: string
) => {
try {
const dObject = keys.__D;
Expand All @@ -516,7 +516,7 @@ export default class SwapDetails extends React.Component<
transactionHex,
lockupAddress,
destinationAddress,
feeRate,
feeRate: Number(fee),
isTestnet: this.props.NodeInfoStore!.nodeInfo.isTestNet
});

Expand Down Expand Up @@ -589,7 +589,11 @@ export default class SwapDetails extends React.Component<
{this.state.loading && <LoadingIndicator />}
{error && (
<ErrorMessage
message={error?.message || String(error)}
message={
typeof error === 'object' && 'message' in error
? error?.message
: String(error)
}
/>
)}
{updates && (
Expand Down
2 changes: 1 addition & 1 deletion views/Swaps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ export default class SwapPane extends React.PureComponent<
keys,
endpoint: HOST,
invoice: destinationAddress,
feeRate: fee
fee
});
});
} catch (error: any) {
Expand Down

0 comments on commit f5c6070

Please sign in to comment.