14.05.2026 rip
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user