Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.

Commit

Permalink
fix(scriptexplorer): show error message trown in fethUTXOs
Browse files Browse the repository at this point in the history
For a new wallet no UTXO's can be found. This results in an uninformative error message. The
message
is now changed to having 0 balance.
ISSUES: #172
  • Loading branch information
Wim van der Ham authored and bucko13 committed Jun 12, 2023
1 parent 1923dad commit 158fb61
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/components/ScriptExplorer/ScriptEntry.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,11 @@ class ScriptEntry extends React.Component {
} = this.props;
const multisig = this.generateMultisig();
const fetchUTXOsResult = await this.fetchUTXOs(multisig);
if (fetchUTXOsResult) {
if (
fetchUTXOsResult &&
fetchUTXOsResult.utxos &&
fetchUTXOsResult.utxos.length
) {
const { utxos, balanceSats } = fetchUTXOsResult;
let fetchUTXOsError = "";
if (balanceSats.isLessThanOrEqualTo(0)) {
Expand All @@ -228,7 +232,7 @@ class ScriptEntry extends React.Component {
} else {
this.setState({
fetchedUTXOs: false,
fetchUTXOsError: "This address has a zero balance.",
fetchUTXOsError: fetchUTXOsResult.fetchUTXOsError,
});
}
};
Expand All @@ -241,10 +245,7 @@ class ScriptEntry extends React.Component {
client
);

if (addressData && addressData.utxos && addressData.utxos.length)
return addressData;

return false;
return addressData;
};

//
Expand Down

0 comments on commit 158fb61

Please sign in to comment.