Skip to content

Commit

Permalink
fix: swap duplicate toast, closes #5068
Browse files Browse the repository at this point in the history
  • Loading branch information
fbwoolf committed Mar 20, 2024
1 parent 1f1216c commit 5f08a9c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/app/common/hooks/use-submit-stx-transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import { useToast } from '@app/features/toasts/use-toast';
import { useCurrentStacksNetworkState } from '@app/store/networks/networks.hooks';
import { useSubmittedTransactionsActions } from '@app/store/submitted-transactions/submitted-transactions.hooks';

import { delay } from '../utils';

const timeForApiToUpdate = 250;

interface UseSubmitTransactionArgs {
Expand Down Expand Up @@ -52,7 +54,9 @@ export function useSubmitTransactionCallback({ loadingKey }: UseSubmitTransactio
rawTx: bytesToHex(transaction.serialize()),
txId: safelyFormatHexTxid(response.txid),
});
await delay(500);
toast.success('Transaction submitted!');
await delay(500);

void analytics.track('broadcast_transaction', { symbol: 'stx' });
onSuccess(safelyFormatHexTxid(response.txid));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ export function RetrieveTaprootToNativeSegwit() {
const { generateRetrieveTaprootFundsTx, fee } = useGenerateRetrieveTaprootFundsTx();
const { broadcastTx, isBroadcasting } = useBitcoinBroadcastTransaction();

async function handleBroadcastRetieveBitcoinTx() {
async function handleBroadcastRetrieveBitcoinTx() {
const tx = await generateRetrieveTaprootFundsTx({ recipient, fee });
await broadcastTx({
tx,
async onSuccess() {
await delay(1200);
toast.success('Transaction broadcasted succesfully');
toast.success('Transaction submitted!');
await delay(700);
navigate(RouteUrls.Activity);
void analytics.track('broadcast_retrieve_taproot_to_native_segwit');
Expand All @@ -52,7 +52,7 @@ export function RetrieveTaprootToNativeSegwit() {
return (
<RetrieveTaprootToNativeSegwitLayout
isBroadcasting={isBroadcasting}
onApproveTransaction={handleBroadcastRetieveBitcoinTx}
onApproveTransaction={handleBroadcastRetrieveBitcoinTx}
onClose={() => navigate(RouteUrls.Home)}
>
<InfoCard mt="space.05">
Expand Down

0 comments on commit 5f08a9c

Please sign in to comment.