@liberfi.io/ui-portfolio 0.1.34 → 0.1.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +144 -0
- package/dist/index.d.mts +60 -2
- package/dist/index.d.ts +60 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -8
package/README.md
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# @liberfi.io/ui-portfolio
|
|
2
|
+
|
|
3
|
+
Portfolio components for Liberfi React SDK. Provides portfolio page layout, holdings, curve charts, distribution, and an account / login button with a wallet overview popover showing balances, token holdings, and deposit/withdraw actions. Consumed by apps that need portfolio views and header account UI.
|
|
4
|
+
|
|
5
|
+
## Design Philosophy
|
|
6
|
+
|
|
7
|
+
- **Script / widget / ui layering** — Logic lives in script hooks (no JSX); widgets wire hooks to UI and accept callbacks; UI components are presentational and receive formatted data and handlers.
|
|
8
|
+
- **PortfolioProvider required** — Wallet summary (balance, PnL) is provided by `PortfolioProvider`; components that display balance must run inside it.
|
|
9
|
+
- **Inversion of control** — Side effects (e.g. opening settings, deposit, withdraw) are passed in via props; the package does not hardcode navigation or modals.
|
|
10
|
+
- **Single source of truth** — Types and formatting come from `@liberfi.io/types` and `@liberfi.io/utils`; auth state from `@liberfi.io/wallet-connector`.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pnpm add @liberfi.io/ui-portfolio
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Peer dependencies
|
|
19
|
+
|
|
20
|
+
The consumer must provide:
|
|
21
|
+
|
|
22
|
+
| Package | Version |
|
|
23
|
+
| ------------------------------ | --------- |
|
|
24
|
+
| `react` | >= 18 |
|
|
25
|
+
| `react-dom` | >= 18 |
|
|
26
|
+
| `@tanstack/react-query` | ^5.90.2 |
|
|
27
|
+
| `@liberfi.io/wallet-connector` | workspace |
|
|
28
|
+
|
|
29
|
+
For account UI the app must also wrap the tree with `AuthProvider` (from `@liberfi.io/wallet-connector`), `PortfolioProvider`, and `PortfolioClientProvider` (from this package).
|
|
30
|
+
|
|
31
|
+
## API Reference
|
|
32
|
+
|
|
33
|
+
### Components (Account)
|
|
34
|
+
|
|
35
|
+
#### `AccountInfoWidget`
|
|
36
|
+
|
|
37
|
+
Login button and account popover. Renders sign-in when unauthenticated, loading when authenticating/deauthenticating, and a popover with USD balance, chain tabs, token chips, token balance rows, and deposit/withdraw actions when authenticated.
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
function AccountInfoWidget(props: AccountInfoWidgetProps): JSX.Element;
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
| Prop | Type | Description |
|
|
44
|
+
| ------------------- | ------------ | ------------------------------------------------------------------------ |
|
|
45
|
+
| `onAccountSettings` | `() => void` | Optional. Called when user taps the settings gear icon. Omit to hide it. |
|
|
46
|
+
| `onDeposit` | `() => void` | Optional. Called when user presses Deposit. Omit to hide the button. |
|
|
47
|
+
| `onWithdraw` | `() => void` | Optional. Called when user presses Withdraw. Omit to hide the button. |
|
|
48
|
+
|
|
49
|
+
**Requirements:** Must be used inside `AuthProvider`, `PortfolioProvider`, and `PortfolioClientProvider`.
|
|
50
|
+
|
|
51
|
+
#### `AccountInfoUI`
|
|
52
|
+
|
|
53
|
+
Presentational account UI. Receives status, formatted balances, holdings, and callbacks. Use when you need to drive state yourself.
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
function AccountInfoUI(props: AccountInfoUIProps): JSX.Element;
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
| Prop | Type | Description |
|
|
60
|
+
| ------------------------ | ------------------------------ | --------------------------------------------------------------------------- |
|
|
61
|
+
| `status` | `AuthStatus` | `unauthenticated` / `authenticating` / `authenticated` / `deauthenticating` |
|
|
62
|
+
| `signIn` | `() => void \| Promise<void>` | Sign-in handler |
|
|
63
|
+
| `signOut` | `() => void \| Promise<void>` | Sign-out handler |
|
|
64
|
+
| `balanceUsdFormatted` | `string` | e.g. `"$1,234.56"` |
|
|
65
|
+
| `balanceNativeFormatted` | `string` | e.g. `"1.23"` |
|
|
66
|
+
| `nativeToken` | `PredefinedToken \| undefined` | Current chain native token |
|
|
67
|
+
| `chainLabel` | `string` | Chain display name (e.g. `"Solana"`) |
|
|
68
|
+
| `holdings` | `SpotHolding[]` | User's spot token holdings |
|
|
69
|
+
| `isHoldingsLoading` | `boolean` | Whether holdings are still loading |
|
|
70
|
+
| `onAccountSettings` | `() => void` | Optional. Settings gear handler. |
|
|
71
|
+
| `onDeposit` | `() => void` | Optional. Deposit button handler. |
|
|
72
|
+
| `onWithdraw` | `() => void` | Optional. Withdraw button handler. |
|
|
73
|
+
|
|
74
|
+
### Hooks (Account)
|
|
75
|
+
|
|
76
|
+
#### `useAccountInfo`
|
|
77
|
+
|
|
78
|
+
Returns auth status, signIn/signOut, formatted balances, holdings, and chain label for the account popover. Must be used within `AuthProvider`, `PortfolioProvider`, and `PortfolioClientProvider`.
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
function useAccountInfo(): UseAccountInfoResult;
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
| Return field | Type | Description |
|
|
85
|
+
| ------------------------ | ------------------------------ | ------------------------------------------- |
|
|
86
|
+
| `status` | `AuthStatus` | Current auth status |
|
|
87
|
+
| `signIn` | `() => void \| Promise<void>` | Sign-in function |
|
|
88
|
+
| `signOut` | `() => void \| Promise<void>` | Sign-out function |
|
|
89
|
+
| `balanceUsdFormatted` | `string` | Formatted USD balance |
|
|
90
|
+
| `balanceNativeFormatted` | `string` | Formatted native token amount |
|
|
91
|
+
| `nativeToken` | `PredefinedToken \| undefined` | Current chain native token |
|
|
92
|
+
| `isSummaryReady` | `boolean` | Whether wallet summary is available |
|
|
93
|
+
| `chainLabel` | `string` | Chain display name (e.g. `"Solana"`) |
|
|
94
|
+
| `holdings` | `SpotHolding[]` | User's spot holdings (sorted by value desc) |
|
|
95
|
+
| `isHoldingsLoading` | `boolean` | Whether holdings query is loading |
|
|
96
|
+
|
|
97
|
+
### Other exports
|
|
98
|
+
|
|
99
|
+
The package also exports portfolio page components (`PortfolioPageWidget`, `usePortfolioPage`, etc.), holdings, hooks (`useWalletSummary`, `useOverviewQuery`, etc.), providers, contexts, and types. See `src/index.ts` and `src/components/index.tsx` for the full list.
|
|
100
|
+
|
|
101
|
+
## Usage Examples
|
|
102
|
+
|
|
103
|
+
### Account button in a header
|
|
104
|
+
|
|
105
|
+
```tsx
|
|
106
|
+
import {
|
|
107
|
+
PortfolioProvider,
|
|
108
|
+
PortfolioClientProvider,
|
|
109
|
+
AccountInfoWidget,
|
|
110
|
+
} from "@liberfi.io/ui-portfolio";
|
|
111
|
+
import { AuthProvider } from "@liberfi.io/wallet-connector";
|
|
112
|
+
|
|
113
|
+
function App() {
|
|
114
|
+
return (
|
|
115
|
+
<AuthProvider {...authProps}>
|
|
116
|
+
<PortfolioClientProvider client={portfolioClient}>
|
|
117
|
+
<PortfolioProvider chain={chain} address={address}>
|
|
118
|
+
<Header>
|
|
119
|
+
<AccountInfoWidget
|
|
120
|
+
onAccountSettings={() => openSettings()}
|
|
121
|
+
onDeposit={() => openDeposit()}
|
|
122
|
+
onWithdraw={() => openWithdraw()}
|
|
123
|
+
/>
|
|
124
|
+
</Header>
|
|
125
|
+
</PortfolioProvider>
|
|
126
|
+
</PortfolioClientProvider>
|
|
127
|
+
</AuthProvider>
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Without action buttons
|
|
133
|
+
|
|
134
|
+
Omit callbacks to hide the corresponding UI elements:
|
|
135
|
+
|
|
136
|
+
```tsx
|
|
137
|
+
<AccountInfoWidget />
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Future Improvements
|
|
141
|
+
|
|
142
|
+
- Optional portfolio context so the account widget can render outside `PortfolioProvider` with placeholder balances.
|
|
143
|
+
- ARIA and keyboard improvements for the popover trigger.
|
|
144
|
+
- Perps tab integration when perps positions data is available.
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import { ReactNode, PropsWithChildren } from 'react';
|
|
4
|
+
import { PredefinedToken } from '@liberfi.io/utils';
|
|
5
|
+
import { AuthStatus } from '@liberfi.io/wallet-connector';
|
|
4
6
|
import { A as AssetTab, C as CurveType, a as CurvePeriod, P as PortfolioQuery, b as PortfolioOverview, c as CurveData, D as DistributionData, S as SpotHoldingsData, d as SpotHistoryData, e as PerpsPositionsData, f as PerpsHistoryData, g as PredictionBetsData, h as PredictionSettledData, i as SpotHolding, j as PerpsPosition, k as PredictionBet, I as IPortfolioClient, W as WalletSummary, l as AsyncStatus, m as SpotHistoryQuery, n as PerpsHistoryQuery, o as PredictionSettledQuery, p as CurveQuery } from './index-Bq_qim6b.mjs';
|
|
5
7
|
export { q as CURVE_PERIOD_VALUE, x as ChartDataPointDTO, F as CurvePoint, H as DistributionItem, G as GetPortfolioChartReply, y as GetSpotHoldingsReply, B as GetTradeHistoryReply, r as PerpsPositionSide, J as PerpsTradeRecord, w as PortfolioOverviewDTO, t as PredictionBetStatus, u as PredictionResult, K as PredictionSettledRecord, v as PredictionSource, E as SpotHistoryRecord, s as SpotHistoryType, T as TokenHoldingDTO, z as TradeRecordDTO } from './index-Bq_qim6b.mjs';
|
|
6
8
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
@@ -14,7 +16,63 @@ declare global {
|
|
|
14
16
|
};
|
|
15
17
|
}
|
|
16
18
|
}
|
|
17
|
-
declare const _default: "0.1.
|
|
19
|
+
declare const _default: "0.1.36";
|
|
20
|
+
|
|
21
|
+
/** Action button rendered in the popover action bar. */
|
|
22
|
+
interface AccountAction {
|
|
23
|
+
key: string;
|
|
24
|
+
icon: ReactNode;
|
|
25
|
+
label: string;
|
|
26
|
+
onPress: () => void;
|
|
27
|
+
}
|
|
28
|
+
interface AccountInfoUIProps {
|
|
29
|
+
status: AuthStatus;
|
|
30
|
+
signIn: () => void | Promise<void>;
|
|
31
|
+
signOut: () => void | Promise<void>;
|
|
32
|
+
balanceUsdFormatted: string;
|
|
33
|
+
balanceNativeFormatted: string;
|
|
34
|
+
nativeToken: PredefinedToken | undefined;
|
|
35
|
+
chainNamespace: string;
|
|
36
|
+
walletAddress: string;
|
|
37
|
+
/** Custom action buttons displayed before the fixed Sign Out button. */
|
|
38
|
+
actions?: AccountAction[];
|
|
39
|
+
}
|
|
40
|
+
declare function AccountInfoUI({ status, signIn, signOut, balanceUsdFormatted, balanceNativeFormatted, nativeToken, chainNamespace, walletAddress, actions, }: AccountInfoUIProps): react_jsx_runtime.JSX.Element;
|
|
41
|
+
|
|
42
|
+
interface AccountInfoWidgetProps {
|
|
43
|
+
/** Custom action buttons displayed before the fixed Sign Out button. */
|
|
44
|
+
actions?: AccountAction[];
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Account / login button with wallet overview popover.
|
|
48
|
+
* Renders sign-in button when unauthenticated, loading state when
|
|
49
|
+
* authenticating/deauthenticating, and a popover with balance and
|
|
50
|
+
* sign-out when authenticated.
|
|
51
|
+
*
|
|
52
|
+
* Must be used within AuthProvider and PortfolioProvider.
|
|
53
|
+
*/
|
|
54
|
+
declare function AccountInfoWidget({ actions }: AccountInfoWidgetProps): react_jsx_runtime.JSX.Element;
|
|
55
|
+
|
|
56
|
+
interface UseAccountInfoResult {
|
|
57
|
+
status: AuthStatus;
|
|
58
|
+
signIn: () => void | Promise<void>;
|
|
59
|
+
signOut: () => void | Promise<void>;
|
|
60
|
+
/** Formatted USD balance for display (e.g. "$1,234.56"). */
|
|
61
|
+
balanceUsdFormatted: string;
|
|
62
|
+
/** Formatted native token amount for display (e.g. "1.23"). */
|
|
63
|
+
balanceNativeFormatted: string;
|
|
64
|
+
/** Current chain native token (address, symbol, decimals). Undefined when chain/summary not available. */
|
|
65
|
+
nativeToken: PredefinedToken | undefined;
|
|
66
|
+
/** Chain namespace label (e.g. "EVM", "SOL"). */
|
|
67
|
+
chainNamespace: string;
|
|
68
|
+
/** Connected wallet address, empty string when not connected. */
|
|
69
|
+
walletAddress: string;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Account info state and formatted display data for the account popover.
|
|
73
|
+
* Must be used within AuthProvider and PortfolioProvider.
|
|
74
|
+
*/
|
|
75
|
+
declare function useAccountInfo(): UseAccountInfoResult;
|
|
18
76
|
|
|
19
77
|
interface WalletOption {
|
|
20
78
|
id: string;
|
|
@@ -395,4 +453,4 @@ declare function computeDistribution(holdings: SpotHolding[]): DistributionData;
|
|
|
395
453
|
*/
|
|
396
454
|
declare function formatTime(epochMs: number): string;
|
|
397
455
|
|
|
398
|
-
export { AddressRowUI, type AddressRowUIProps, AssetTab, AssetTabsUI, type AssetTabsUIProps, AsyncStatus, BalanceRowUI, type BalanceRowUIProps, BatchActionButton, type BatchActionButtonProps, ConfirmDialog, type ConfirmDialogProps, CurveCardUI, type CurveCardUIProps, CurveData, CurvePeriod, CurveQuery, CurveType, DistributionCardUI, type DistributionCardUIProps, DistributionData, HoldingsEmpty, type HoldingsEmptyProps, type HoldingsRenderProps, HoldingsSearch, type HoldingsSearchProps, HoldingsSectionWidget, type HoldingsSectionWidgetProps, HoldingsSubTabs, type HoldingsSubTabsProps, IPortfolioClient, PerpsHistoryData, PerpsHistoryQuery, PerpsPanelUI, type PerpsPanelUIProps, PerpsPosition, PerpsPositionsData, type PerpsSubTab, PortfolioClientContext, PortfolioClientProvider, type PortfolioClientProviderProps, PortfolioContext, type PortfolioContextValue, PortfolioOverview, PortfolioPageSkeleton, PortfolioPageWidget, type PortfolioPageWidgetProps, PortfolioProvider, type PortfolioProviderProps, PortfolioQuery, PredictionBet, PredictionBetsData, PredictionPanelUI, type PredictionPanelUIProps, PredictionSettledData, PredictionSettledQuery, type PredictionSubTab, type RefetchWalletSummaryFn, SpotHistoryData, SpotHistoryQuery, SpotHolding, SpotHoldingsData, SpotPanelUI, type SpotPanelUIProps, type SpotSubTab, type TokenPortfolio, type UseHoldingsSectionOptions, type UseHoldingsSectionResult, type UsePortfolioPageOptions, type UsePortfolioPageResult, type UseWalletPortfoliosParams, ViewingBannerUI, type ViewingBannerUIProps, type WalletOption, WalletSummary, computeDistribution, curveDataQueryKey, distributionQueryKey, formatPercent, formatSignedUsd, formatTime, formatTokenBalance, formatUsd, getExplorerUrl, overviewQueryKey, parseDecimal, perpsHistoryQueryKey, perpsPositionsQueryKey, predictionBetsQueryKey, predictionSettledQueryKey, splitUsd, spotHistoryQueryKey, spotHoldingsQueryKey, truncateAddress, useCurveDataQuery, useDistributionQuery, useHoldingsSection, useOverviewQuery, usePerpsHistoryQuery, usePerpsPositionsQuery, usePortfolioClient, usePortfolioContext, usePortfolioPage, usePredictionBetsQuery, usePredictionSettledQuery, useRefetchWalletSummary, useSpotHistoryQuery, useSpotHoldingsQuery, useWalletPortfolios, useWalletSummary, _default as version };
|
|
456
|
+
export { type AccountAction, AccountInfoUI, type AccountInfoUIProps, AccountInfoWidget, type AccountInfoWidgetProps, AddressRowUI, type AddressRowUIProps, AssetTab, AssetTabsUI, type AssetTabsUIProps, AsyncStatus, BalanceRowUI, type BalanceRowUIProps, BatchActionButton, type BatchActionButtonProps, ConfirmDialog, type ConfirmDialogProps, CurveCardUI, type CurveCardUIProps, CurveData, CurvePeriod, CurveQuery, CurveType, DistributionCardUI, type DistributionCardUIProps, DistributionData, HoldingsEmpty, type HoldingsEmptyProps, type HoldingsRenderProps, HoldingsSearch, type HoldingsSearchProps, HoldingsSectionWidget, type HoldingsSectionWidgetProps, HoldingsSubTabs, type HoldingsSubTabsProps, IPortfolioClient, PerpsHistoryData, PerpsHistoryQuery, PerpsPanelUI, type PerpsPanelUIProps, PerpsPosition, PerpsPositionsData, type PerpsSubTab, PortfolioClientContext, PortfolioClientProvider, type PortfolioClientProviderProps, PortfolioContext, type PortfolioContextValue, PortfolioOverview, PortfolioPageSkeleton, PortfolioPageWidget, type PortfolioPageWidgetProps, PortfolioProvider, type PortfolioProviderProps, PortfolioQuery, PredictionBet, PredictionBetsData, PredictionPanelUI, type PredictionPanelUIProps, PredictionSettledData, PredictionSettledQuery, type PredictionSubTab, type RefetchWalletSummaryFn, SpotHistoryData, SpotHistoryQuery, SpotHolding, SpotHoldingsData, SpotPanelUI, type SpotPanelUIProps, type SpotSubTab, type TokenPortfolio, type UseAccountInfoResult, type UseHoldingsSectionOptions, type UseHoldingsSectionResult, type UsePortfolioPageOptions, type UsePortfolioPageResult, type UseWalletPortfoliosParams, ViewingBannerUI, type ViewingBannerUIProps, type WalletOption, WalletSummary, computeDistribution, curveDataQueryKey, distributionQueryKey, formatPercent, formatSignedUsd, formatTime, formatTokenBalance, formatUsd, getExplorerUrl, overviewQueryKey, parseDecimal, perpsHistoryQueryKey, perpsPositionsQueryKey, predictionBetsQueryKey, predictionSettledQueryKey, splitUsd, spotHistoryQueryKey, spotHoldingsQueryKey, truncateAddress, useAccountInfo, useCurveDataQuery, useDistributionQuery, useHoldingsSection, useOverviewQuery, usePerpsHistoryQuery, usePerpsPositionsQuery, usePortfolioClient, usePortfolioContext, usePortfolioPage, usePredictionBetsQuery, usePredictionSettledQuery, useRefetchWalletSummary, useSpotHistoryQuery, useSpotHoldingsQuery, useWalletPortfolios, useWalletSummary, _default as version };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import { ReactNode, PropsWithChildren } from 'react';
|
|
4
|
+
import { PredefinedToken } from '@liberfi.io/utils';
|
|
5
|
+
import { AuthStatus } from '@liberfi.io/wallet-connector';
|
|
4
6
|
import { A as AssetTab, C as CurveType, a as CurvePeriod, P as PortfolioQuery, b as PortfolioOverview, c as CurveData, D as DistributionData, S as SpotHoldingsData, d as SpotHistoryData, e as PerpsPositionsData, f as PerpsHistoryData, g as PredictionBetsData, h as PredictionSettledData, i as SpotHolding, j as PerpsPosition, k as PredictionBet, I as IPortfolioClient, W as WalletSummary, l as AsyncStatus, m as SpotHistoryQuery, n as PerpsHistoryQuery, o as PredictionSettledQuery, p as CurveQuery } from './index-Bq_qim6b.js';
|
|
5
7
|
export { q as CURVE_PERIOD_VALUE, x as ChartDataPointDTO, F as CurvePoint, H as DistributionItem, G as GetPortfolioChartReply, y as GetSpotHoldingsReply, B as GetTradeHistoryReply, r as PerpsPositionSide, J as PerpsTradeRecord, w as PortfolioOverviewDTO, t as PredictionBetStatus, u as PredictionResult, K as PredictionSettledRecord, v as PredictionSource, E as SpotHistoryRecord, s as SpotHistoryType, T as TokenHoldingDTO, z as TradeRecordDTO } from './index-Bq_qim6b.js';
|
|
6
8
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
@@ -14,7 +16,63 @@ declare global {
|
|
|
14
16
|
};
|
|
15
17
|
}
|
|
16
18
|
}
|
|
17
|
-
declare const _default: "0.1.
|
|
19
|
+
declare const _default: "0.1.36";
|
|
20
|
+
|
|
21
|
+
/** Action button rendered in the popover action bar. */
|
|
22
|
+
interface AccountAction {
|
|
23
|
+
key: string;
|
|
24
|
+
icon: ReactNode;
|
|
25
|
+
label: string;
|
|
26
|
+
onPress: () => void;
|
|
27
|
+
}
|
|
28
|
+
interface AccountInfoUIProps {
|
|
29
|
+
status: AuthStatus;
|
|
30
|
+
signIn: () => void | Promise<void>;
|
|
31
|
+
signOut: () => void | Promise<void>;
|
|
32
|
+
balanceUsdFormatted: string;
|
|
33
|
+
balanceNativeFormatted: string;
|
|
34
|
+
nativeToken: PredefinedToken | undefined;
|
|
35
|
+
chainNamespace: string;
|
|
36
|
+
walletAddress: string;
|
|
37
|
+
/** Custom action buttons displayed before the fixed Sign Out button. */
|
|
38
|
+
actions?: AccountAction[];
|
|
39
|
+
}
|
|
40
|
+
declare function AccountInfoUI({ status, signIn, signOut, balanceUsdFormatted, balanceNativeFormatted, nativeToken, chainNamespace, walletAddress, actions, }: AccountInfoUIProps): react_jsx_runtime.JSX.Element;
|
|
41
|
+
|
|
42
|
+
interface AccountInfoWidgetProps {
|
|
43
|
+
/** Custom action buttons displayed before the fixed Sign Out button. */
|
|
44
|
+
actions?: AccountAction[];
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Account / login button with wallet overview popover.
|
|
48
|
+
* Renders sign-in button when unauthenticated, loading state when
|
|
49
|
+
* authenticating/deauthenticating, and a popover with balance and
|
|
50
|
+
* sign-out when authenticated.
|
|
51
|
+
*
|
|
52
|
+
* Must be used within AuthProvider and PortfolioProvider.
|
|
53
|
+
*/
|
|
54
|
+
declare function AccountInfoWidget({ actions }: AccountInfoWidgetProps): react_jsx_runtime.JSX.Element;
|
|
55
|
+
|
|
56
|
+
interface UseAccountInfoResult {
|
|
57
|
+
status: AuthStatus;
|
|
58
|
+
signIn: () => void | Promise<void>;
|
|
59
|
+
signOut: () => void | Promise<void>;
|
|
60
|
+
/** Formatted USD balance for display (e.g. "$1,234.56"). */
|
|
61
|
+
balanceUsdFormatted: string;
|
|
62
|
+
/** Formatted native token amount for display (e.g. "1.23"). */
|
|
63
|
+
balanceNativeFormatted: string;
|
|
64
|
+
/** Current chain native token (address, symbol, decimals). Undefined when chain/summary not available. */
|
|
65
|
+
nativeToken: PredefinedToken | undefined;
|
|
66
|
+
/** Chain namespace label (e.g. "EVM", "SOL"). */
|
|
67
|
+
chainNamespace: string;
|
|
68
|
+
/** Connected wallet address, empty string when not connected. */
|
|
69
|
+
walletAddress: string;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Account info state and formatted display data for the account popover.
|
|
73
|
+
* Must be used within AuthProvider and PortfolioProvider.
|
|
74
|
+
*/
|
|
75
|
+
declare function useAccountInfo(): UseAccountInfoResult;
|
|
18
76
|
|
|
19
77
|
interface WalletOption {
|
|
20
78
|
id: string;
|
|
@@ -395,4 +453,4 @@ declare function computeDistribution(holdings: SpotHolding[]): DistributionData;
|
|
|
395
453
|
*/
|
|
396
454
|
declare function formatTime(epochMs: number): string;
|
|
397
455
|
|
|
398
|
-
export { AddressRowUI, type AddressRowUIProps, AssetTab, AssetTabsUI, type AssetTabsUIProps, AsyncStatus, BalanceRowUI, type BalanceRowUIProps, BatchActionButton, type BatchActionButtonProps, ConfirmDialog, type ConfirmDialogProps, CurveCardUI, type CurveCardUIProps, CurveData, CurvePeriod, CurveQuery, CurveType, DistributionCardUI, type DistributionCardUIProps, DistributionData, HoldingsEmpty, type HoldingsEmptyProps, type HoldingsRenderProps, HoldingsSearch, type HoldingsSearchProps, HoldingsSectionWidget, type HoldingsSectionWidgetProps, HoldingsSubTabs, type HoldingsSubTabsProps, IPortfolioClient, PerpsHistoryData, PerpsHistoryQuery, PerpsPanelUI, type PerpsPanelUIProps, PerpsPosition, PerpsPositionsData, type PerpsSubTab, PortfolioClientContext, PortfolioClientProvider, type PortfolioClientProviderProps, PortfolioContext, type PortfolioContextValue, PortfolioOverview, PortfolioPageSkeleton, PortfolioPageWidget, type PortfolioPageWidgetProps, PortfolioProvider, type PortfolioProviderProps, PortfolioQuery, PredictionBet, PredictionBetsData, PredictionPanelUI, type PredictionPanelUIProps, PredictionSettledData, PredictionSettledQuery, type PredictionSubTab, type RefetchWalletSummaryFn, SpotHistoryData, SpotHistoryQuery, SpotHolding, SpotHoldingsData, SpotPanelUI, type SpotPanelUIProps, type SpotSubTab, type TokenPortfolio, type UseHoldingsSectionOptions, type UseHoldingsSectionResult, type UsePortfolioPageOptions, type UsePortfolioPageResult, type UseWalletPortfoliosParams, ViewingBannerUI, type ViewingBannerUIProps, type WalletOption, WalletSummary, computeDistribution, curveDataQueryKey, distributionQueryKey, formatPercent, formatSignedUsd, formatTime, formatTokenBalance, formatUsd, getExplorerUrl, overviewQueryKey, parseDecimal, perpsHistoryQueryKey, perpsPositionsQueryKey, predictionBetsQueryKey, predictionSettledQueryKey, splitUsd, spotHistoryQueryKey, spotHoldingsQueryKey, truncateAddress, useCurveDataQuery, useDistributionQuery, useHoldingsSection, useOverviewQuery, usePerpsHistoryQuery, usePerpsPositionsQuery, usePortfolioClient, usePortfolioContext, usePortfolioPage, usePredictionBetsQuery, usePredictionSettledQuery, useRefetchWalletSummary, useSpotHistoryQuery, useSpotHoldingsQuery, useWalletPortfolios, useWalletSummary, _default as version };
|
|
456
|
+
export { type AccountAction, AccountInfoUI, type AccountInfoUIProps, AccountInfoWidget, type AccountInfoWidgetProps, AddressRowUI, type AddressRowUIProps, AssetTab, AssetTabsUI, type AssetTabsUIProps, AsyncStatus, BalanceRowUI, type BalanceRowUIProps, BatchActionButton, type BatchActionButtonProps, ConfirmDialog, type ConfirmDialogProps, CurveCardUI, type CurveCardUIProps, CurveData, CurvePeriod, CurveQuery, CurveType, DistributionCardUI, type DistributionCardUIProps, DistributionData, HoldingsEmpty, type HoldingsEmptyProps, type HoldingsRenderProps, HoldingsSearch, type HoldingsSearchProps, HoldingsSectionWidget, type HoldingsSectionWidgetProps, HoldingsSubTabs, type HoldingsSubTabsProps, IPortfolioClient, PerpsHistoryData, PerpsHistoryQuery, PerpsPanelUI, type PerpsPanelUIProps, PerpsPosition, PerpsPositionsData, type PerpsSubTab, PortfolioClientContext, PortfolioClientProvider, type PortfolioClientProviderProps, PortfolioContext, type PortfolioContextValue, PortfolioOverview, PortfolioPageSkeleton, PortfolioPageWidget, type PortfolioPageWidgetProps, PortfolioProvider, type PortfolioProviderProps, PortfolioQuery, PredictionBet, PredictionBetsData, PredictionPanelUI, type PredictionPanelUIProps, PredictionSettledData, PredictionSettledQuery, type PredictionSubTab, type RefetchWalletSummaryFn, SpotHistoryData, SpotHistoryQuery, SpotHolding, SpotHoldingsData, SpotPanelUI, type SpotPanelUIProps, type SpotSubTab, type TokenPortfolio, type UseAccountInfoResult, type UseHoldingsSectionOptions, type UseHoldingsSectionResult, type UsePortfolioPageOptions, type UsePortfolioPageResult, type UseWalletPortfoliosParams, ViewingBannerUI, type ViewingBannerUIProps, type WalletOption, WalletSummary, computeDistribution, curveDataQueryKey, distributionQueryKey, formatPercent, formatSignedUsd, formatTime, formatTokenBalance, formatUsd, getExplorerUrl, overviewQueryKey, parseDecimal, perpsHistoryQueryKey, perpsPositionsQueryKey, predictionBetsQueryKey, predictionSettledQueryKey, splitUsd, spotHistoryQueryKey, spotHoldingsQueryKey, truncateAddress, useAccountInfo, useCurveDataQuery, useDistributionQuery, useHoldingsSection, useOverviewQuery, usePerpsHistoryQuery, usePerpsPositionsQuery, usePortfolioClient, usePortfolioContext, usePortfolioPage, usePredictionBetsQuery, usePredictionSettledQuery, useRefetchWalletSummary, useSpotHistoryQuery, useSpotHoldingsQuery, useWalletPortfolios, useWalletSummary, _default as version };
|