14.05.2026 rip
This commit is contained in:
@@ -193,6 +193,50 @@ export async function getRelayQuote(payload: RelayQuotePayload): Promise<RelayQu
|
||||
return walletPost<RelayQuoteResponse>('/api/relay/quote', payload)
|
||||
}
|
||||
|
||||
export interface RelaySwapStep {
|
||||
id: string
|
||||
action: string
|
||||
description: string
|
||||
kind: string
|
||||
items: Array<{
|
||||
status: string
|
||||
data: {
|
||||
from: string
|
||||
to: string
|
||||
data: string
|
||||
value: string
|
||||
chainId: number
|
||||
gas: string
|
||||
maxFeePerGas: string
|
||||
maxPriorityFeePerGas: string
|
||||
}
|
||||
check: {
|
||||
endpoint: string
|
||||
method: string
|
||||
}
|
||||
}>
|
||||
requestId: string
|
||||
}
|
||||
|
||||
export interface RelaySwapResponse {
|
||||
steps: RelaySwapStep[]
|
||||
fees: RelayQuoteResponse['fees']
|
||||
details: {
|
||||
operation: string
|
||||
sender: string
|
||||
recipient: string
|
||||
currencyIn: { amount: string; amountFormatted: string; amountUsd: string; currency: unknown }
|
||||
currencyOut: { amount: string; amountFormatted: string; amountUsd: string; currency: unknown }
|
||||
totalImpact: { usd: string; percent: string }
|
||||
rate: string
|
||||
timeEstimate: number
|
||||
}
|
||||
}
|
||||
|
||||
export async function executeRelaySwap(payload: RelayQuotePayload): Promise<RelaySwapResponse> {
|
||||
return walletPost<RelaySwapResponse>('/api/relay/execute/swap', payload)
|
||||
}
|
||||
|
||||
export async function createWallet(): Promise<void> {
|
||||
await walletPost<unknown>('/api/wallets/create', {})
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export { useAllWalletBalances, usePrices, useSendWallet, useWalletAddresses, useWalletBalance, usePortfolio, useTokensList, useRelayQuote, useCreateWallet, useRevealMnemonic } from './model/useWalletData'
|
||||
export type { Chain, FormattedAmount, WalletBalanceData, PriceEntry, SendWalletPayload, SendWalletResponse, WalletAddress, PortfolioData, PortfolioChain, PortfolioNative, PortfolioToken, TokenInfo, RelayQuotePayload, RelayQuoteResponse } from './api/walletApi'
|
||||
export { useAllWalletBalances, usePrices, useSendWallet, useWalletAddresses, useWalletBalance, usePortfolio, useTokensList, useRelayQuote, useExecuteRelaySwap, useCreateWallet, useRevealMnemonic } from './model/useWalletData'
|
||||
export type { Chain, FormattedAmount, WalletBalanceData, PriceEntry, SendWalletPayload, SendWalletResponse, WalletAddress, PortfolioData, PortfolioChain, PortfolioNative, PortfolioToken, TokenInfo, RelayQuotePayload, RelayQuoteResponse, RelaySwapResponse, RelaySwapStep } from './api/walletApi'
|
||||
export { CHAINS } from './api/walletApi'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useQuery, useQueries, useMutation } from '@tanstack/react-query'
|
||||
import { getWalletBalance, getPrices, sendWallet, getWalletAddresses, getPortfolio, getTokensList, getRelayQuote, createWallet, revealMnemonic, CHAINS, type Chain, type SendWalletPayload, type RelayQuotePayload } from '../api/walletApi'
|
||||
import { getWalletBalance, getPrices, sendWallet, getWalletAddresses, getPortfolio, getTokensList, getRelayQuote, executeRelaySwap, createWallet, revealMnemonic, CHAINS, type Chain, type SendWalletPayload, type RelayQuotePayload } from '../api/walletApi'
|
||||
|
||||
export function useWalletBalance(chain: Chain) {
|
||||
return useQuery({
|
||||
@@ -82,3 +82,9 @@ export function useRelayQuote(payload: RelayQuotePayload | null) {
|
||||
staleTime: 10_000,
|
||||
})
|
||||
}
|
||||
|
||||
export function useExecuteRelaySwap() {
|
||||
return useMutation({
|
||||
mutationFn: (payload: RelayQuotePayload) => executeRelaySwap(payload),
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user