14.05.2026 rip

This commit is contained in:
2026-05-14 23:39:47 +03:00
parent 0d114e12c2
commit 7c8e812d4b
6 changed files with 306 additions and 14 deletions

View File

@@ -1,5 +1,5 @@
import { useQuery, useQueries, useMutation } from '@tanstack/react-query'
import { getWalletBalance, getPrices, sendWallet, getWalletAddresses, getPortfolio, getTokensList, getRelayQuote, executeRelaySwap, signRawEvmTx, signSolTx, createWallet, revealMnemonic, CHAINS, type Chain, type SendWalletPayload, type RelayQuotePayload, type RelaySwapStep } from '../api/walletApi'
import { getWalletBalance, getPrices, sendWallet, getWalletAddresses, getPortfolio, getTokensList, getRelayQuote, executeRelaySwap, signRawEvmTx, signSolTx, getTrxSwapQuote, executeTrxSwap, createWallet, revealMnemonic, CHAINS, type Chain, type SendWalletPayload, type RelayQuotePayload, type RelaySwapStep, type TrxSwapQuotePayload } from '../api/walletApi'
export function useWalletBalance(chain: Chain) {
return useQuery({
@@ -97,3 +97,20 @@ export function useSignSwap() {
},
})
}
export function useTrxSwapQuote(payload: TrxSwapQuotePayload | null) {
return useQuery({
queryKey: ['trx', 'quote', payload?.from, payload?.to, payload?.amountHuman],
queryFn: () => getTrxSwapQuote(payload!),
enabled: !!payload,
staleTime: 10_000,
})
}
export function useFetchTrxQuote() {
return useMutation({ mutationFn: getTrxSwapQuote })
}
export function useExecuteTrxSwap() {
return useMutation({ mutationFn: (quoteId: string) => executeTrxSwap(quoteId) })
}