Skip to content

Commit

Permalink
Terence/eng 4882 sending 1 btc missing insufficient fund error message (
Browse files Browse the repository at this point in the history
#491)

* [ENG-4838] Handle Spam Tokens for Runes Swap

* fix

* fix

* revert

---------

Co-authored-by: Christos Maris <[email protected]>
  • Loading branch information
terencehh and christos-xverse authored Aug 14, 2024
1 parent a33af92 commit e57cd7c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
15 changes: 9 additions & 6 deletions src/app/components/confirmBtcTransaction/sendSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const Container = styled.div((props) => ({

const RowContainer = styled.div<{ noPadding?: boolean; noMargin?: boolean }>((props) => ({
padding: props.noPadding ? 0 : `0 ${props.theme.space.m}`,
marginBottom: props.noMargin ? 0 : props.theme.space.m,
}));

const BundleHeader = styled.div((props) => ({
Expand Down Expand Up @@ -65,12 +66,14 @@ function SendSection({
{getTruncatedAddress(address, 6)}
</StyledP>
</BundleHeader>
<Amount amount={bundle.netBtcAmount} />
<AmountWithInscriptionSatribute
inscriptions={inscriptionsFromPayment}
satributes={satributesFromPayment}
onShowInscription={onShowInscription}
/>
<RowContainer noPadding>
<Amount amount={bundle.netBtcAmount} />
<AmountWithInscriptionSatribute
inscriptions={inscriptionsFromPayment}
satributes={satributesFromPayment}
onShowInscription={onShowInscription}
/>
</RowContainer>
{bundle.runeTransfers.map((runeTransfer, i) => (
<RuneAmount
// eslint-disable-next-line react/no-array-index-key
Expand Down
10 changes: 6 additions & 4 deletions src/app/screens/sendBtc/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ function SendBtcScreen() {
setTransaction(transactionDetails.transaction);
if (transactionDetails.summary) {
setSummary(transactionDetails.summary);
if (sendMax) {
setAmountSats(transactionDetails.summary.outputs[0].amount.toString());
}
if (hasRunesSupport) {
setRuneSummary(
await parseSummaryForRunes(
Expand All @@ -100,13 +103,12 @@ function SendBtcScreen() {
),
);
}
}
if (sendMax && transactionDetails.summary) {
setAmountSats(transactionDetails.summary.outputs[0].amount.toString());
} else {
setTransaction(undefined);
setSummary(undefined);
}
} catch (e) {
if (isCancelled.current) return;

if (!(e instanceof Error) || !e.message.includes('Insufficient funds')) {
// don't log the error if it's just an insufficient funds error
console.error(e);
Expand Down

0 comments on commit e57cd7c

Please sign in to comment.