Skip to content

Commit

Permalink
refactor: bitcoin swaps with rhf
Browse files Browse the repository at this point in the history
  • Loading branch information
fbwoolf committed Dec 26, 2024
1 parent 49405c5 commit c62d121
Show file tree
Hide file tree
Showing 57 changed files with 1,510 additions and 1,095 deletions.
2 changes: 1 addition & 1 deletion src/app/common/hooks/use-calculate-sip10-fiat-value.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { useConfigSbtc } from '@app/query/common/remote-config/remote-config.que

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

function castBitcoinMarketDataToSbtcMarketData(bitcoinMarketData: MarketData) {
export function castBitcoinMarketDataToSbtcMarketData(bitcoinMarketData: MarketData) {
return createMarketData(
createMarketPair('sBTC', 'USD'),
createMoney(bitcoinMarketData.price.amount.toNumber(), 'USD')
Expand Down
8 changes: 2 additions & 6 deletions src/app/components/nonce-setter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,13 @@ import { useFormikContext } from 'formik';

import { useNextNonce } from '@leather.io/query';

import {
StacksSendFormValues,
StacksTransactionFormValues,
type SwapFormValues,
} from '@shared/models/form.model';
import { StacksSendFormValues, StacksTransactionFormValues } from '@shared/models/form.model';

import { useCurrentStacksAccountAddress } from '@app/store/accounts/blockchain/stacks/stacks-account.hooks';

export function NonceSetter() {
const { setFieldValue, touched, values } = useFormikContext<
StacksSendFormValues | StacksTransactionFormValues | SwapFormValues
StacksSendFormValues | StacksTransactionFormValues
>();
const stxAddress = useCurrentStacksAccountAddress();
const { data: nextNonce } = useNextNonce(stxAddress);
Expand Down
2 changes: 1 addition & 1 deletion src/app/features/activity-list/activity-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export function ActivityList() {
{hasPendingTransactions && (
<PendingTransactionList
bitcoinTxs={isBitcoinEnabled ? bitcoinPendingTxs : []}
sBtcDeposits={pendingSbtcDeposits}
sbtcDeposits={pendingSbtcDeposits}
stacksTxs={stacksPendingTransactions}
/>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ import { PendingTransactionListLayout } from './pending-transaction-list.layout'

interface PendingTransactionListProps {
bitcoinTxs: BitcoinTx[];
sBtcDeposits: SbtcDepositInfo[];
sbtcDeposits: SbtcDepositInfo[];
stacksTxs: MempoolTransaction[];
}
export function PendingTransactionList({
bitcoinTxs,
sBtcDeposits,
sbtcDeposits,
stacksTxs,
}: PendingTransactionListProps) {
return (
<PendingTransactionListLayout>
{bitcoinTxs.map(tx => (
<BitcoinTransactionItem key={tx.txid} transaction={tx} />
))}
{sBtcDeposits.map(deposit => (
{sbtcDeposits.map(deposit => (
<SbtcDepositTransactionItem key={deposit.bitcoinTxid} deposit={deposit} />
))}
{stacksTxs.map(tx => (
Expand Down
284 changes: 0 additions & 284 deletions src/app/pages/swap/bitflow-swap-container.tsx

This file was deleted.

Loading

0 comments on commit c62d121

Please sign in to comment.