14.05.2026 rip

This commit is contained in:
2026-05-14 21:23:27 +03:00
parent 1e5f792854
commit c2a1ca3ee5
4 changed files with 50 additions and 5 deletions

View File

@@ -41,6 +41,32 @@ export interface WalletAddress {
derivationPath: string
}
export interface PortfolioToken {
symbol: string
amountFormatted: string
usd: number
}
export interface PortfolioNative {
amount: string
amountFormatted: string
usd: number
}
export interface PortfolioChain {
address: string
stale: boolean
native: PortfolioNative
tokens: PortfolioToken[]
totalUsd: number
}
export interface PortfolioData {
totalUsd: number
asOfMs: number
chains: Record<Chain, PortfolioChain>
}
export const CHAINS: Chain[] = ['ETH', 'BSC', 'BTC', 'TRX', 'SOL']
async function walletGet<T>(path: string, allowRetry: boolean = true): Promise<T> {
@@ -120,3 +146,8 @@ export async function getPrices(symbols: string[]): Promise<Record<string, Price
export async function sendWallet(chain: Chain, payload: SendWalletPayload): Promise<SendWalletResponse> {
return walletPost<SendWalletResponse>(`/api/wallets/${chain}/send`, payload)
}
export async function getPortfolio(): Promise<PortfolioData> {
const res = await walletGet<{ success: boolean; data: PortfolioData }>('/api/wallets/portfolio')
return res.data
}