@liberfi.io/client 0.1.189 → 0.3.0

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 CHANGED
@@ -8,6 +8,7 @@ DEX API client for the Liberfi React SDK. This package wraps `@chainstream-io/sd
8
8
  - **Centralized DTO conversion** — All mapping functions live in `utils.ts`, separating data transformation from client orchestration.
9
9
  - **Interface conformance** — `Client implements API.IClient, API.ISubscribeClient` ensures compile-time contract enforcement.
10
10
  - **Composite subscriptions** — WebSocket methods compose multiple backend channels into a single `ISubscription` with a unified `unsubscribe()`.
11
+ - **Phase 3 bypass layer** — For endpoints the upstream `@chainstream-io/sdk` has not yet upgraded (`getTokenHolders`, `getTokenActivities`, `getWalletActivities`, `getWalletPortfoliosByTokens`, `getWalletPortfolioPnls`), `Client` uses an internal `phase3Http` fetch helper that calls the server directly and maps the raw DTOs back to domain types. Consumers keep the same `IClient` interface.
11
12
 
12
13
  ## Installation
13
14
 
package/dist/index.d.mts CHANGED
@@ -1,5 +1,6 @@
1
+ import * as _liberfi_io_types from '@liberfi.io/types';
1
2
  import { API, Chain, Token, TokenResolution, TokenCandle, TokenSecurity, TokenStats, TokenHolder, TokenMarketData, WalletPortfolios, WalletPnl, WalletPortfolioPnls, Portfolio, PortfolioPnl, Trade, Activity, TokenCreator as TokenCreator$1, TokenLiquidity } from '@liberfi.io/types';
2
- import { ChainSymbol, Resolution, RangeFilterCondition, TokenCreator, Token as Token$1, TokenStats as TokenStats$1, DexPool, TokenMarketData as TokenMarketData$1, TokenCandle as TokenCandle$1, SwapRouteInput, SendTxInput, PageResponseTokenHolder, TokenPage, SwapRouteResponse, BlockchainLatestBlock, SendTxResponse, WalletNetWorthPage, WalletPnlSummary, PnlDetailsResult, NetWorthByTokensResult, PageResponseTradeDetail, WsNewToken, WsTokenMetadata, WsCandle, WsTokenStat, WsTokenSupply, WsTokenHolder, WsTokenLiquidity, WsTokenBondingCurve, WsTokenMaxLiquidity, WsTokenTotalLiquidity, WsTradeActivity } from '@chainstream-io/sdk';
3
+ import { ChainSymbol, Resolution, RangeFilterCondition, TokenCreator, Token as Token$1, TokenStats as TokenStats$1, DexPool, TokenMarketData as TokenMarketData$1, TokenCandle as TokenCandle$1, SwapRouteInput, SendTxInput, TokenPage, SwapRouteResponse, BlockchainLatestBlock, SendTxResponse, WalletNetWorthPage, WalletPnlSummary, PnlDetailsResult, PageResponseTradeDetail, WsNewToken, WsTokenMetadata, WsCandle, WsTokenStat, WsTokenSupply, WsTokenHolder, WsTokenLiquidity, WsTokenBondingCurve, WsTokenMaxLiquidity, WsTokenTotalLiquidity, WsTradeActivity } from '@chainstream-io/sdk';
3
4
 
4
5
  declare global {
5
6
  interface Window {
@@ -8,7 +9,7 @@ declare global {
8
9
  };
9
10
  }
10
11
  }
11
- declare const _default: "0.1.189";
12
+ declare const _default: "0.3.0";
12
13
 
13
14
  /** Async or sync token provider for authentication. */
14
15
  interface ClientTokenProviderFn {
@@ -33,13 +34,14 @@ declare class Client implements API.IClient, API.ISubscribeClient {
33
34
  private readonly accessToken;
34
35
  private readonly options?;
35
36
  private readonly _client;
37
+ private readonly _phase3;
36
38
  constructor(accessToken: ClientTokenProvider, options?: ClientOptions | undefined);
37
39
  getToken(chain: Chain, address: string): Promise<Token>;
38
40
  getTokens(chain: Chain, addresses: Array<string>): Promise<Array<Token>>;
39
41
  getTokenCandles(chain: Chain, address: string, resolution: TokenResolution, options?: API.GetTokenCandlesOptions): Promise<Array<TokenCandle>>;
40
42
  getTokenSecurity(chain: Chain, address: string): Promise<TokenSecurity>;
41
43
  getTokenStats(chain: Chain, address: string): Promise<TokenStats>;
42
- getTokenHolders(chain: Chain, address: string, options?: API.CursorListOptions): Promise<API.CursorList<TokenHolder>>;
44
+ getTokenHolders(chain: Chain, address: string, options?: API.GetTokenHoldersOptions): Promise<API.CursorList<TokenHolder>>;
43
45
  getTokenMarketData(chain: Chain, address: string): Promise<TokenMarketData>;
44
46
  getNewTokens(chain: Chain, options?: API.GetTokenListOptions): Promise<Array<Token>>;
45
47
  getFinalStretchTokens(chain: Chain, options?: API.GetTokenListOptions): Promise<Array<Token>>;
@@ -56,10 +58,7 @@ declare class Client implements API.IClient, API.ISubscribeClient {
56
58
  limit?: number;
57
59
  }): Promise<WalletPortfolios>;
58
60
  getWalletPnl(chain: Chain, address: string, resolution?: string): Promise<WalletPnl>;
59
- getWalletPortfolioPnls(chain: Chain, address: string, options?: {
60
- cursor?: string;
61
- limit?: number;
62
- }): Promise<WalletPortfolioPnls>;
61
+ getWalletPortfolioPnls(chain: Chain, address: string, options?: API.GetWalletPortfolioPnlsOptions): Promise<WalletPortfolioPnls>;
63
62
  getWalletPortfoliosByTokens(chain: Chain, address: string, tokenAddresses: Array<string>): Promise<Array<Portfolio>>;
64
63
  getWalletPortfolioPnlsByTokens(chain: Chain, address: string, tokenAddresses: Array<string>): Promise<Array<PortfolioPnl>>;
65
64
  getWalletTrades(chain: Chain, address: string, options?: API.GetTradesOptions): Promise<API.CursorList<Trade>>;
@@ -67,6 +66,8 @@ declare class Client implements API.IClient, API.ISubscribeClient {
67
66
  getWalletActivities(chain: Chain, address: string, options?: API.GetActivitiesOptions): Promise<API.CursorList<Activity>>;
68
67
  getTokenActivities(chain: Chain, address: string, options?: API.GetActivitiesOptions): Promise<API.CursorList<Activity>>;
69
68
  getPresignedUploadUrl(): Promise<string>;
69
+ getWalletLimitOrders(_chain: Chain, _address: string, _options?: API.GetWalletLimitOrdersOptions): Promise<API.CursorList<_liberfi_io_types.LimitOrder>>;
70
+ getTokensByCreator(_chain: Chain, _creator: string, _options?: API.GetTokensByCreatorOptions): Promise<API.CursorList<Token>>;
70
71
  subscribeToken(chain: Chain, address: string, callback: (data: Array<API.TokenSubscribed>) => void): API.ISubscription;
71
72
  subscribeTokenCandles(chain: Chain, address: string, resolution: TokenResolution, callback: (candles: Array<TokenCandle>) => void): API.ISubscription;
72
73
  subscribeWalletPnl(chain: Chain, address: string, callback: (pnls: Array<API.WalletPnlSubscribed>) => void): API.ISubscription;
@@ -98,6 +99,167 @@ declare class Client implements API.IClient, API.ISubscribeClient {
98
99
  private _subscribeRankingTokens;
99
100
  }
100
101
 
102
+ /**
103
+ * Error thrown when a Client method is called against a server endpoint
104
+ * that has not yet shipped. This is distinct from a network / auth error:
105
+ * the SDK is structurally ready to call the endpoint but the backend
106
+ * side is not.
107
+ *
108
+ * Widgets can use `instanceof NotImplementedError` (or check `code`) to
109
+ * render a "coming soon" empty state instead of a generic error surface.
110
+ */
111
+ declare class NotImplementedError extends Error {
112
+ /** Stable discriminant, useful across package boundaries where `instanceof` may be brittle. */
113
+ readonly code: "NotImplemented";
114
+ constructor(method: string, detail?: string);
115
+ }
116
+ /** Type guard using the stable code so it survives bundling across realms. */
117
+ declare function isNotImplementedError(error: unknown): error is NotImplementedError;
118
+
119
+ /**
120
+ * Phase 3 HTTP helpers.
121
+ *
122
+ * The bundled `@chainstream-io/sdk` version pins an older schema that does not
123
+ * recognize the Phase 3 parameters (`sortBy`, `positionState`, `resolution`) or
124
+ * response fields (`gasFee`, `traderTags`, `tags`, `lastActiveAt`, `avgCostUsd`,
125
+ * `isActive`, `walletTokenTags`, `isClosed`, `firstBuyAt`, `lastSellAt`).
126
+ *
127
+ * Rather than wait for the SDK to be regenerated, this module issues direct
128
+ * `fetch` calls against the same REST endpoints the SDK would have hit, and
129
+ * types the raw DTOs as described in the 2026-05-01 Phase 3 spec. Mapping from
130
+ * DTO → domain type stays in `utils.ts`.
131
+ *
132
+ * Once the SDK adopts Phase 3, this module can be deleted and Client can call
133
+ * the SDK methods again without touching any consumer code.
134
+ */
135
+
136
+ interface CursorPageDTO<T> {
137
+ data: Array<T>;
138
+ hasNext: boolean;
139
+ hasPrev: boolean;
140
+ startCursor?: string | null;
141
+ endCursor?: string | null;
142
+ }
143
+ interface Phase3TokenHolderDTO {
144
+ walletAddress: string;
145
+ amount: string;
146
+ amountInUsd: string;
147
+ percentage: string;
148
+ tags?: Array<string>;
149
+ lastActiveAt?: number | null;
150
+ startHoldingAt?: number | null;
151
+ }
152
+ interface Phase3ActivityDTO {
153
+ transactionSignature: string;
154
+ chain: string;
155
+ blockHeight?: number;
156
+ blockTimestamp: number;
157
+ type: string;
158
+ tokenAddress: string;
159
+ tokenName?: string;
160
+ tokenSymbol: string;
161
+ tokenImageUrl?: string | null;
162
+ tokenAmount: string;
163
+ tokenAmountInUsd: string;
164
+ tokenPriceInUsd?: string;
165
+ tokenAmountInNative?: string;
166
+ tokenPriceInNative?: string;
167
+ sideTokenAddress: string;
168
+ sideTokenName?: string;
169
+ sideTokenSymbol: string;
170
+ sideTokenImageUrl?: string | null;
171
+ sideTokenAmount: string;
172
+ sideTokenAmountInUsd: string;
173
+ sideTokenPriceInUsd?: string;
174
+ accountOwnerAddress: string;
175
+ gasFee?: number | null;
176
+ traderTags?: Array<string>;
177
+ poolAddress?: string | null;
178
+ dexProgramAddress?: string | null;
179
+ dexProtocolFamily?: string | null;
180
+ dexImage?: string | null;
181
+ status?: string;
182
+ }
183
+ interface Phase3NetWorthTokenDTO {
184
+ chain: string;
185
+ tokenAddress: string;
186
+ name: string;
187
+ symbol: string;
188
+ decimals: number;
189
+ logoUri?: string | null;
190
+ amount: string;
191
+ priceInUsd: string;
192
+ priceInNative: string;
193
+ valueInUsd: string;
194
+ valueInNative: string;
195
+ isActive?: boolean;
196
+ avgCostUsd?: string | null;
197
+ lastActiveAt?: number | null;
198
+ walletTokenTags?: Array<string>;
199
+ }
200
+ interface Phase3NetWorthByTokensDTO {
201
+ walletAddress: string;
202
+ totalValueInUsd: string;
203
+ totalValueInNative: string;
204
+ currentTimestamp?: number;
205
+ data: Array<Phase3NetWorthTokenDTO>;
206
+ }
207
+ interface Phase3PnlSummaryDTO {
208
+ tokens?: number | string;
209
+ totalTrades?: number | string;
210
+ buys?: number | string;
211
+ sells?: number | string;
212
+ wins?: number | string;
213
+ losses?: number | string;
214
+ winRate?: string | null;
215
+ realizedProfitInUsd?: string | null;
216
+ unrealizedProfitInUsd?: string | null;
217
+ totalProfitInUsd?: string | null;
218
+ totalProfitRatio?: string | null;
219
+ currentValue?: string | null;
220
+ buyAmountInUsd?: string | null;
221
+ sellAmountInUsd?: string | null;
222
+ totalCostInUsd?: string;
223
+ avgProfitPerTradeInUsd?: string | null;
224
+ }
225
+ interface Phase3PnlItemDTO {
226
+ tokenAddress: string;
227
+ symbol?: string;
228
+ name?: string;
229
+ decimals?: number;
230
+ logoUri?: string | null;
231
+ walletAddress?: string;
232
+ chain?: string;
233
+ balance: string;
234
+ priceInUsd: string;
235
+ currentValue: string;
236
+ realizedProfitInUsd?: string;
237
+ realizedProfitRatio?: string;
238
+ unrealizedProfitInUsd?: string;
239
+ unrealizedProfitRatio?: string;
240
+ totalProfitInUsd?: string;
241
+ totalProfitRatio?: string;
242
+ buys?: number | string;
243
+ sells?: number | string;
244
+ totalTrades?: number | string;
245
+ wins?: number | string;
246
+ losses?: number | string;
247
+ buyAmount?: string;
248
+ sellAmount?: string;
249
+ buyAmountInUsd?: string;
250
+ sellAmountInUsd?: string;
251
+ avgBuyPriceInUsd?: string;
252
+ avgSellPriceInUsd?: string;
253
+ avgProfitPerTradeInUsd?: string;
254
+ totalCostInUsd?: string;
255
+ isClosed?: boolean;
256
+ firstBuyAt?: number | null;
257
+ lastSellAt?: number | null;
258
+ }
259
+ interface Phase3PnlDetailsDTO extends CursorPageDTO<Phase3PnlItemDTO> {
260
+ summary: Phase3PnlSummaryDTO;
261
+ }
262
+
101
263
  declare function toChainDTO(chain: Chain): ChainSymbol;
102
264
  declare function toResolutionDTO(resolution: TokenResolution): Resolution;
103
265
  declare function toSortDirectionDTO(direction: "asc" | "desc"): string;
@@ -126,18 +288,18 @@ declare const KYBERSWAP_NATIVE_SENTINEL = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeee
126
288
  declare function toMintForRoute(dex: "jupiter" | "kyberswap", address: string): string;
127
289
  declare function toSwapRouteInput(params: API.SwapParams): SwapRouteInput;
128
290
  declare function toSendTxInput(params: API.SendTxParams): SendTxInput;
129
- declare function fromTokenHolderPage(input: PageResponseTokenHolder): API.CursorList<TokenHolder>;
291
+ declare function fromTokenHolderPage(input: CursorPageDTO<Phase3TokenHolderDTO>): API.CursorList<TokenHolder>;
130
292
  declare function fromTokenPage(input: TokenPage): API.SearchTokenCursorList;
131
293
  declare function fromSwapRoute(input: SwapRouteResponse): API.SwapRoute;
132
294
  declare function fromLatestBlock(input: BlockchainLatestBlock): API.BlockchainLatestBlock;
133
295
  declare function fromSendTxResult(input: SendTxResponse): API.SendTxResult;
134
296
  declare function fromWalletPortfolios(chain: Chain, input: WalletNetWorthPage): WalletPortfolios;
135
297
  declare function fromWalletPnlSummary(chain: Chain, address: string, input: WalletPnlSummary): WalletPnl;
136
- declare function fromPnlDetailsPage(chain: Chain, address: string, input: PnlDetailsResult): WalletPortfolioPnls;
137
- declare function fromWalletNetWorthByTokens(chain: Chain, input: NetWorthByTokensResult): Portfolio[];
298
+ declare function fromPnlDetailsPage(chain: Chain, address: string, input: Phase3PnlDetailsDTO): WalletPortfolioPnls;
299
+ declare function fromWalletNetWorthByTokens(chain: Chain, input: Phase3NetWorthByTokensDTO): Portfolio[];
138
300
  declare function fromPnlDetailItems(chain: Chain, input: PnlDetailsResult): PortfolioPnl[];
139
301
  declare function fromTradePage(input: PageResponseTradeDetail): API.CursorList<Trade>;
140
- declare function fromActivityPage(input: PageResponseTradeDetail): API.CursorList<Activity>;
302
+ declare function fromActivityPage(input: CursorPageDTO<Phase3ActivityDTO>): API.CursorList<Activity>;
141
303
  declare function fromTokenSubscribed(chain: Chain, input: WsNewToken): API.TokenSubscribed;
142
304
  declare function fromTokenMetadataSubscribed(chain: Chain, input: WsTokenMetadata): API.TokenSubscribed;
143
305
  declare function fromWsCandle(input: WsCandle): TokenCandle;
@@ -154,4 +316,4 @@ declare function fromWsTokenMarketDataFromHolder(input: WsTokenHolder): Partial<
154
316
  declare function fromWsTradeActivity(chain: Chain, input: WsTradeActivity): Trade;
155
317
  declare function fromWsActivity(chain: Chain, input: WsTradeActivity): Activity;
156
318
 
157
- export { Client, type ClientOptions, type ClientTokenProvider, type ClientTokenProviderFn, KYBERSWAP_NATIVE_SENTINEL, fromActivityPage, fromChainDTO, fromLatestBlock, fromPnlDetailItems, fromPnlDetailsPage, fromSendTxResult, fromSwapRoute, fromTokenCandle, fromTokenCreatorDTO, fromTokenDTO, fromTokenHolderPage, fromTokenLiquidityDTO, fromTokenMarketDataDTO, fromTokenMetadataSubscribed, fromTokenPage, fromTokenSecurity, fromTokenStatsDTO, fromTokenSubscribed, fromTradePage, fromWalletNetWorthByTokens, fromWalletPnlSummary, fromWalletPortfolios, fromWsActivity, fromWsCandle, fromWsTokenBondingCurveToSubscribed, fromWsTokenDataSubscribed, fromWsTokenHolderToSubscribed, fromWsTokenLiquidityToSubscribed, fromWsTokenMarketDataFromHolder, fromWsTokenMarketDataFromStats, fromWsTokenMaxLiquidityToSubscribed, fromWsTokenStats, fromWsTokenSupplyToSubscribed, fromWsTokenTotalLiquidityToSubscribed, fromWsTradeActivity, toChainDTO, toFieldDTO, toMintForRoute, toRangeFiltersDTO, toResolutionDTO, toSearchFieldDTO, toSendTxInput, toSortDirectionDTO, toSwapRouteInput, _default as version };
319
+ export { Client, type ClientOptions, type ClientTokenProvider, type ClientTokenProviderFn, KYBERSWAP_NATIVE_SENTINEL, NotImplementedError, fromActivityPage, fromChainDTO, fromLatestBlock, fromPnlDetailItems, fromPnlDetailsPage, fromSendTxResult, fromSwapRoute, fromTokenCandle, fromTokenCreatorDTO, fromTokenDTO, fromTokenHolderPage, fromTokenLiquidityDTO, fromTokenMarketDataDTO, fromTokenMetadataSubscribed, fromTokenPage, fromTokenSecurity, fromTokenStatsDTO, fromTokenSubscribed, fromTradePage, fromWalletNetWorthByTokens, fromWalletPnlSummary, fromWalletPortfolios, fromWsActivity, fromWsCandle, fromWsTokenBondingCurveToSubscribed, fromWsTokenDataSubscribed, fromWsTokenHolderToSubscribed, fromWsTokenLiquidityToSubscribed, fromWsTokenMarketDataFromHolder, fromWsTokenMarketDataFromStats, fromWsTokenMaxLiquidityToSubscribed, fromWsTokenStats, fromWsTokenSupplyToSubscribed, fromWsTokenTotalLiquidityToSubscribed, fromWsTradeActivity, isNotImplementedError, toChainDTO, toFieldDTO, toMintForRoute, toRangeFiltersDTO, toResolutionDTO, toSearchFieldDTO, toSendTxInput, toSortDirectionDTO, toSwapRouteInput, _default as version };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
+ import * as _liberfi_io_types from '@liberfi.io/types';
1
2
  import { API, Chain, Token, TokenResolution, TokenCandle, TokenSecurity, TokenStats, TokenHolder, TokenMarketData, WalletPortfolios, WalletPnl, WalletPortfolioPnls, Portfolio, PortfolioPnl, Trade, Activity, TokenCreator as TokenCreator$1, TokenLiquidity } from '@liberfi.io/types';
2
- import { ChainSymbol, Resolution, RangeFilterCondition, TokenCreator, Token as Token$1, TokenStats as TokenStats$1, DexPool, TokenMarketData as TokenMarketData$1, TokenCandle as TokenCandle$1, SwapRouteInput, SendTxInput, PageResponseTokenHolder, TokenPage, SwapRouteResponse, BlockchainLatestBlock, SendTxResponse, WalletNetWorthPage, WalletPnlSummary, PnlDetailsResult, NetWorthByTokensResult, PageResponseTradeDetail, WsNewToken, WsTokenMetadata, WsCandle, WsTokenStat, WsTokenSupply, WsTokenHolder, WsTokenLiquidity, WsTokenBondingCurve, WsTokenMaxLiquidity, WsTokenTotalLiquidity, WsTradeActivity } from '@chainstream-io/sdk';
3
+ import { ChainSymbol, Resolution, RangeFilterCondition, TokenCreator, Token as Token$1, TokenStats as TokenStats$1, DexPool, TokenMarketData as TokenMarketData$1, TokenCandle as TokenCandle$1, SwapRouteInput, SendTxInput, TokenPage, SwapRouteResponse, BlockchainLatestBlock, SendTxResponse, WalletNetWorthPage, WalletPnlSummary, PnlDetailsResult, PageResponseTradeDetail, WsNewToken, WsTokenMetadata, WsCandle, WsTokenStat, WsTokenSupply, WsTokenHolder, WsTokenLiquidity, WsTokenBondingCurve, WsTokenMaxLiquidity, WsTokenTotalLiquidity, WsTradeActivity } from '@chainstream-io/sdk';
3
4
 
4
5
  declare global {
5
6
  interface Window {
@@ -8,7 +9,7 @@ declare global {
8
9
  };
9
10
  }
10
11
  }
11
- declare const _default: "0.1.189";
12
+ declare const _default: "0.3.0";
12
13
 
13
14
  /** Async or sync token provider for authentication. */
14
15
  interface ClientTokenProviderFn {
@@ -33,13 +34,14 @@ declare class Client implements API.IClient, API.ISubscribeClient {
33
34
  private readonly accessToken;
34
35
  private readonly options?;
35
36
  private readonly _client;
37
+ private readonly _phase3;
36
38
  constructor(accessToken: ClientTokenProvider, options?: ClientOptions | undefined);
37
39
  getToken(chain: Chain, address: string): Promise<Token>;
38
40
  getTokens(chain: Chain, addresses: Array<string>): Promise<Array<Token>>;
39
41
  getTokenCandles(chain: Chain, address: string, resolution: TokenResolution, options?: API.GetTokenCandlesOptions): Promise<Array<TokenCandle>>;
40
42
  getTokenSecurity(chain: Chain, address: string): Promise<TokenSecurity>;
41
43
  getTokenStats(chain: Chain, address: string): Promise<TokenStats>;
42
- getTokenHolders(chain: Chain, address: string, options?: API.CursorListOptions): Promise<API.CursorList<TokenHolder>>;
44
+ getTokenHolders(chain: Chain, address: string, options?: API.GetTokenHoldersOptions): Promise<API.CursorList<TokenHolder>>;
43
45
  getTokenMarketData(chain: Chain, address: string): Promise<TokenMarketData>;
44
46
  getNewTokens(chain: Chain, options?: API.GetTokenListOptions): Promise<Array<Token>>;
45
47
  getFinalStretchTokens(chain: Chain, options?: API.GetTokenListOptions): Promise<Array<Token>>;
@@ -56,10 +58,7 @@ declare class Client implements API.IClient, API.ISubscribeClient {
56
58
  limit?: number;
57
59
  }): Promise<WalletPortfolios>;
58
60
  getWalletPnl(chain: Chain, address: string, resolution?: string): Promise<WalletPnl>;
59
- getWalletPortfolioPnls(chain: Chain, address: string, options?: {
60
- cursor?: string;
61
- limit?: number;
62
- }): Promise<WalletPortfolioPnls>;
61
+ getWalletPortfolioPnls(chain: Chain, address: string, options?: API.GetWalletPortfolioPnlsOptions): Promise<WalletPortfolioPnls>;
63
62
  getWalletPortfoliosByTokens(chain: Chain, address: string, tokenAddresses: Array<string>): Promise<Array<Portfolio>>;
64
63
  getWalletPortfolioPnlsByTokens(chain: Chain, address: string, tokenAddresses: Array<string>): Promise<Array<PortfolioPnl>>;
65
64
  getWalletTrades(chain: Chain, address: string, options?: API.GetTradesOptions): Promise<API.CursorList<Trade>>;
@@ -67,6 +66,8 @@ declare class Client implements API.IClient, API.ISubscribeClient {
67
66
  getWalletActivities(chain: Chain, address: string, options?: API.GetActivitiesOptions): Promise<API.CursorList<Activity>>;
68
67
  getTokenActivities(chain: Chain, address: string, options?: API.GetActivitiesOptions): Promise<API.CursorList<Activity>>;
69
68
  getPresignedUploadUrl(): Promise<string>;
69
+ getWalletLimitOrders(_chain: Chain, _address: string, _options?: API.GetWalletLimitOrdersOptions): Promise<API.CursorList<_liberfi_io_types.LimitOrder>>;
70
+ getTokensByCreator(_chain: Chain, _creator: string, _options?: API.GetTokensByCreatorOptions): Promise<API.CursorList<Token>>;
70
71
  subscribeToken(chain: Chain, address: string, callback: (data: Array<API.TokenSubscribed>) => void): API.ISubscription;
71
72
  subscribeTokenCandles(chain: Chain, address: string, resolution: TokenResolution, callback: (candles: Array<TokenCandle>) => void): API.ISubscription;
72
73
  subscribeWalletPnl(chain: Chain, address: string, callback: (pnls: Array<API.WalletPnlSubscribed>) => void): API.ISubscription;
@@ -98,6 +99,167 @@ declare class Client implements API.IClient, API.ISubscribeClient {
98
99
  private _subscribeRankingTokens;
99
100
  }
100
101
 
102
+ /**
103
+ * Error thrown when a Client method is called against a server endpoint
104
+ * that has not yet shipped. This is distinct from a network / auth error:
105
+ * the SDK is structurally ready to call the endpoint but the backend
106
+ * side is not.
107
+ *
108
+ * Widgets can use `instanceof NotImplementedError` (or check `code`) to
109
+ * render a "coming soon" empty state instead of a generic error surface.
110
+ */
111
+ declare class NotImplementedError extends Error {
112
+ /** Stable discriminant, useful across package boundaries where `instanceof` may be brittle. */
113
+ readonly code: "NotImplemented";
114
+ constructor(method: string, detail?: string);
115
+ }
116
+ /** Type guard using the stable code so it survives bundling across realms. */
117
+ declare function isNotImplementedError(error: unknown): error is NotImplementedError;
118
+
119
+ /**
120
+ * Phase 3 HTTP helpers.
121
+ *
122
+ * The bundled `@chainstream-io/sdk` version pins an older schema that does not
123
+ * recognize the Phase 3 parameters (`sortBy`, `positionState`, `resolution`) or
124
+ * response fields (`gasFee`, `traderTags`, `tags`, `lastActiveAt`, `avgCostUsd`,
125
+ * `isActive`, `walletTokenTags`, `isClosed`, `firstBuyAt`, `lastSellAt`).
126
+ *
127
+ * Rather than wait for the SDK to be regenerated, this module issues direct
128
+ * `fetch` calls against the same REST endpoints the SDK would have hit, and
129
+ * types the raw DTOs as described in the 2026-05-01 Phase 3 spec. Mapping from
130
+ * DTO → domain type stays in `utils.ts`.
131
+ *
132
+ * Once the SDK adopts Phase 3, this module can be deleted and Client can call
133
+ * the SDK methods again without touching any consumer code.
134
+ */
135
+
136
+ interface CursorPageDTO<T> {
137
+ data: Array<T>;
138
+ hasNext: boolean;
139
+ hasPrev: boolean;
140
+ startCursor?: string | null;
141
+ endCursor?: string | null;
142
+ }
143
+ interface Phase3TokenHolderDTO {
144
+ walletAddress: string;
145
+ amount: string;
146
+ amountInUsd: string;
147
+ percentage: string;
148
+ tags?: Array<string>;
149
+ lastActiveAt?: number | null;
150
+ startHoldingAt?: number | null;
151
+ }
152
+ interface Phase3ActivityDTO {
153
+ transactionSignature: string;
154
+ chain: string;
155
+ blockHeight?: number;
156
+ blockTimestamp: number;
157
+ type: string;
158
+ tokenAddress: string;
159
+ tokenName?: string;
160
+ tokenSymbol: string;
161
+ tokenImageUrl?: string | null;
162
+ tokenAmount: string;
163
+ tokenAmountInUsd: string;
164
+ tokenPriceInUsd?: string;
165
+ tokenAmountInNative?: string;
166
+ tokenPriceInNative?: string;
167
+ sideTokenAddress: string;
168
+ sideTokenName?: string;
169
+ sideTokenSymbol: string;
170
+ sideTokenImageUrl?: string | null;
171
+ sideTokenAmount: string;
172
+ sideTokenAmountInUsd: string;
173
+ sideTokenPriceInUsd?: string;
174
+ accountOwnerAddress: string;
175
+ gasFee?: number | null;
176
+ traderTags?: Array<string>;
177
+ poolAddress?: string | null;
178
+ dexProgramAddress?: string | null;
179
+ dexProtocolFamily?: string | null;
180
+ dexImage?: string | null;
181
+ status?: string;
182
+ }
183
+ interface Phase3NetWorthTokenDTO {
184
+ chain: string;
185
+ tokenAddress: string;
186
+ name: string;
187
+ symbol: string;
188
+ decimals: number;
189
+ logoUri?: string | null;
190
+ amount: string;
191
+ priceInUsd: string;
192
+ priceInNative: string;
193
+ valueInUsd: string;
194
+ valueInNative: string;
195
+ isActive?: boolean;
196
+ avgCostUsd?: string | null;
197
+ lastActiveAt?: number | null;
198
+ walletTokenTags?: Array<string>;
199
+ }
200
+ interface Phase3NetWorthByTokensDTO {
201
+ walletAddress: string;
202
+ totalValueInUsd: string;
203
+ totalValueInNative: string;
204
+ currentTimestamp?: number;
205
+ data: Array<Phase3NetWorthTokenDTO>;
206
+ }
207
+ interface Phase3PnlSummaryDTO {
208
+ tokens?: number | string;
209
+ totalTrades?: number | string;
210
+ buys?: number | string;
211
+ sells?: number | string;
212
+ wins?: number | string;
213
+ losses?: number | string;
214
+ winRate?: string | null;
215
+ realizedProfitInUsd?: string | null;
216
+ unrealizedProfitInUsd?: string | null;
217
+ totalProfitInUsd?: string | null;
218
+ totalProfitRatio?: string | null;
219
+ currentValue?: string | null;
220
+ buyAmountInUsd?: string | null;
221
+ sellAmountInUsd?: string | null;
222
+ totalCostInUsd?: string;
223
+ avgProfitPerTradeInUsd?: string | null;
224
+ }
225
+ interface Phase3PnlItemDTO {
226
+ tokenAddress: string;
227
+ symbol?: string;
228
+ name?: string;
229
+ decimals?: number;
230
+ logoUri?: string | null;
231
+ walletAddress?: string;
232
+ chain?: string;
233
+ balance: string;
234
+ priceInUsd: string;
235
+ currentValue: string;
236
+ realizedProfitInUsd?: string;
237
+ realizedProfitRatio?: string;
238
+ unrealizedProfitInUsd?: string;
239
+ unrealizedProfitRatio?: string;
240
+ totalProfitInUsd?: string;
241
+ totalProfitRatio?: string;
242
+ buys?: number | string;
243
+ sells?: number | string;
244
+ totalTrades?: number | string;
245
+ wins?: number | string;
246
+ losses?: number | string;
247
+ buyAmount?: string;
248
+ sellAmount?: string;
249
+ buyAmountInUsd?: string;
250
+ sellAmountInUsd?: string;
251
+ avgBuyPriceInUsd?: string;
252
+ avgSellPriceInUsd?: string;
253
+ avgProfitPerTradeInUsd?: string;
254
+ totalCostInUsd?: string;
255
+ isClosed?: boolean;
256
+ firstBuyAt?: number | null;
257
+ lastSellAt?: number | null;
258
+ }
259
+ interface Phase3PnlDetailsDTO extends CursorPageDTO<Phase3PnlItemDTO> {
260
+ summary: Phase3PnlSummaryDTO;
261
+ }
262
+
101
263
  declare function toChainDTO(chain: Chain): ChainSymbol;
102
264
  declare function toResolutionDTO(resolution: TokenResolution): Resolution;
103
265
  declare function toSortDirectionDTO(direction: "asc" | "desc"): string;
@@ -126,18 +288,18 @@ declare const KYBERSWAP_NATIVE_SENTINEL = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeee
126
288
  declare function toMintForRoute(dex: "jupiter" | "kyberswap", address: string): string;
127
289
  declare function toSwapRouteInput(params: API.SwapParams): SwapRouteInput;
128
290
  declare function toSendTxInput(params: API.SendTxParams): SendTxInput;
129
- declare function fromTokenHolderPage(input: PageResponseTokenHolder): API.CursorList<TokenHolder>;
291
+ declare function fromTokenHolderPage(input: CursorPageDTO<Phase3TokenHolderDTO>): API.CursorList<TokenHolder>;
130
292
  declare function fromTokenPage(input: TokenPage): API.SearchTokenCursorList;
131
293
  declare function fromSwapRoute(input: SwapRouteResponse): API.SwapRoute;
132
294
  declare function fromLatestBlock(input: BlockchainLatestBlock): API.BlockchainLatestBlock;
133
295
  declare function fromSendTxResult(input: SendTxResponse): API.SendTxResult;
134
296
  declare function fromWalletPortfolios(chain: Chain, input: WalletNetWorthPage): WalletPortfolios;
135
297
  declare function fromWalletPnlSummary(chain: Chain, address: string, input: WalletPnlSummary): WalletPnl;
136
- declare function fromPnlDetailsPage(chain: Chain, address: string, input: PnlDetailsResult): WalletPortfolioPnls;
137
- declare function fromWalletNetWorthByTokens(chain: Chain, input: NetWorthByTokensResult): Portfolio[];
298
+ declare function fromPnlDetailsPage(chain: Chain, address: string, input: Phase3PnlDetailsDTO): WalletPortfolioPnls;
299
+ declare function fromWalletNetWorthByTokens(chain: Chain, input: Phase3NetWorthByTokensDTO): Portfolio[];
138
300
  declare function fromPnlDetailItems(chain: Chain, input: PnlDetailsResult): PortfolioPnl[];
139
301
  declare function fromTradePage(input: PageResponseTradeDetail): API.CursorList<Trade>;
140
- declare function fromActivityPage(input: PageResponseTradeDetail): API.CursorList<Activity>;
302
+ declare function fromActivityPage(input: CursorPageDTO<Phase3ActivityDTO>): API.CursorList<Activity>;
141
303
  declare function fromTokenSubscribed(chain: Chain, input: WsNewToken): API.TokenSubscribed;
142
304
  declare function fromTokenMetadataSubscribed(chain: Chain, input: WsTokenMetadata): API.TokenSubscribed;
143
305
  declare function fromWsCandle(input: WsCandle): TokenCandle;
@@ -154,4 +316,4 @@ declare function fromWsTokenMarketDataFromHolder(input: WsTokenHolder): Partial<
154
316
  declare function fromWsTradeActivity(chain: Chain, input: WsTradeActivity): Trade;
155
317
  declare function fromWsActivity(chain: Chain, input: WsTradeActivity): Activity;
156
318
 
157
- export { Client, type ClientOptions, type ClientTokenProvider, type ClientTokenProviderFn, KYBERSWAP_NATIVE_SENTINEL, fromActivityPage, fromChainDTO, fromLatestBlock, fromPnlDetailItems, fromPnlDetailsPage, fromSendTxResult, fromSwapRoute, fromTokenCandle, fromTokenCreatorDTO, fromTokenDTO, fromTokenHolderPage, fromTokenLiquidityDTO, fromTokenMarketDataDTO, fromTokenMetadataSubscribed, fromTokenPage, fromTokenSecurity, fromTokenStatsDTO, fromTokenSubscribed, fromTradePage, fromWalletNetWorthByTokens, fromWalletPnlSummary, fromWalletPortfolios, fromWsActivity, fromWsCandle, fromWsTokenBondingCurveToSubscribed, fromWsTokenDataSubscribed, fromWsTokenHolderToSubscribed, fromWsTokenLiquidityToSubscribed, fromWsTokenMarketDataFromHolder, fromWsTokenMarketDataFromStats, fromWsTokenMaxLiquidityToSubscribed, fromWsTokenStats, fromWsTokenSupplyToSubscribed, fromWsTokenTotalLiquidityToSubscribed, fromWsTradeActivity, toChainDTO, toFieldDTO, toMintForRoute, toRangeFiltersDTO, toResolutionDTO, toSearchFieldDTO, toSendTxInput, toSortDirectionDTO, toSwapRouteInput, _default as version };
319
+ export { Client, type ClientOptions, type ClientTokenProvider, type ClientTokenProviderFn, KYBERSWAP_NATIVE_SENTINEL, NotImplementedError, fromActivityPage, fromChainDTO, fromLatestBlock, fromPnlDetailItems, fromPnlDetailsPage, fromSendTxResult, fromSwapRoute, fromTokenCandle, fromTokenCreatorDTO, fromTokenDTO, fromTokenHolderPage, fromTokenLiquidityDTO, fromTokenMarketDataDTO, fromTokenMetadataSubscribed, fromTokenPage, fromTokenSecurity, fromTokenStatsDTO, fromTokenSubscribed, fromTradePage, fromWalletNetWorthByTokens, fromWalletPnlSummary, fromWalletPortfolios, fromWsActivity, fromWsCandle, fromWsTokenBondingCurveToSubscribed, fromWsTokenDataSubscribed, fromWsTokenHolderToSubscribed, fromWsTokenLiquidityToSubscribed, fromWsTokenMarketDataFromHolder, fromWsTokenMarketDataFromStats, fromWsTokenMaxLiquidityToSubscribed, fromWsTokenStats, fromWsTokenSupplyToSubscribed, fromWsTokenTotalLiquidityToSubscribed, fromWsTradeActivity, isNotImplementedError, toChainDTO, toFieldDTO, toMintForRoute, toRangeFiltersDTO, toResolutionDTO, toSearchFieldDTO, toSendTxInput, toSortDirectionDTO, toSwapRouteInput, _default as version };