@trustware/sdk-staging 1.0.17-staging.17 → 1.1.3-staging.20

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
@@ -14,6 +14,8 @@ The refactored widget keeps the same behavior, but the configuration surface is
14
14
 
15
15
  ## Installation
16
16
 
17
+ Supports React `18.2+` and `19`.
18
+
17
19
  ```bash
18
20
  npm install @trustware/sdk
19
21
  # or
@@ -309,5 +311,6 @@ If retries are exhausted, the SDK throws `RateLimitError`.
309
311
 
310
312
  - [Integration Guide](docs/intergrationGuide.md)
311
313
  - [Core Guide](docs/coreGuide.md)
314
+ - [Backend RPC Offload PDR](docs/backend-rpc-offload-pdr.md)
312
315
  - [Widget Architecture Boundaries](docs/widget-architecture-boundaries.md)
313
316
  - [Widget Refactor Baseline](docs/widget-refactor-baseline.md)
@@ -29,7 +29,7 @@ __export(constants_exports, {
29
29
  });
30
30
  module.exports = __toCommonJS(constants_exports);
31
31
  var SDK_NAME = "@trustware/sdk";
32
- var SDK_VERSION = "1.0.17-staging.17";
32
+ var SDK_VERSION = "1.1.3-staging.20";
33
33
  var API_ROOT = "https://bv-staging-api.trustware.io";
34
34
  var API_PREFIX = "/api";
35
35
  var ASSETS_BASE_URL = "https://app.trustware.io";
@@ -1,6 +1,6 @@
1
1
  // src/constants.ts
2
2
  var SDK_NAME = "@trustware/sdk";
3
- var SDK_VERSION = "1.0.17-staging.17";
3
+ var SDK_VERSION = "1.1.3-staging.20";
4
4
  var API_ROOT = "https://bv-staging-api.trustware.io";
5
5
  var API_PREFIX = "/api";
6
6
  var ASSETS_BASE_URL = "https://app.trustware.io";
@@ -1,4 +1,4 @@
1
- import { p as ChainDef, o as ChainType, B as BalanceRow, n as WalletAddressBalanceWrapper, W as WalletInterFaceAPI, x as WalletIdentity, A as walletManager, y as WalletAddressResolution } from './manager-CgpuAzqn.cjs';
1
+ import { v as ChainDef, t as ChainType, B as BalanceRow, s as BalanceStreamOptions, n as WalletAddressBalanceWrapper, W as WalletInterFaceAPI, F as WalletIdentity, J as walletManager, G as WalletAddressResolution } from './manager-BPgytsNL.cjs';
2
2
  import { T as Token } from './types-BrVfNxND.cjs';
3
3
 
4
4
  declare enum TrustwareErrorCode {
@@ -199,6 +199,27 @@ type TrustwareEvent = {
199
199
  } | {
200
200
  type: "wallet_connected";
201
201
  address: string;
202
+ } | {
203
+ type: "token_page_loaded";
204
+ chainRef: string;
205
+ query?: string;
206
+ count: number;
207
+ hasNextPage: boolean;
208
+ cursor?: string;
209
+ } | {
210
+ type: "token_page_error";
211
+ chainRef: string;
212
+ query?: string;
213
+ cursor?: string;
214
+ message: string;
215
+ } | {
216
+ type: "balance_stream_chunk";
217
+ address: string;
218
+ chunkSize: number;
219
+ } | {
220
+ type: "balance_stream_fallback";
221
+ address: string;
222
+ message: string;
202
223
  };
203
224
 
204
225
  /** WalletConnect configuration options (all optional - SDK has built-in defaults) */
@@ -259,6 +280,7 @@ type TrustwareConfigOptions = {
259
280
  messages?: Partial<TrustwareWidgetMessages>;
260
281
  retry?: RetryConfig;
261
282
  walletConnect?: WalletConnectConfig;
283
+ features?: FeatureFlags;
262
284
  onError?: (error: TrustwareError) => void;
263
285
  onSuccess?: (transaction: Transaction) => void;
264
286
  onEvent?: (event: TrustwareEvent) => void;
@@ -285,10 +307,19 @@ type ResolvedTrustwareConfig = {
285
307
  messages: TrustwareWidgetMessages;
286
308
  retry: ResolvedRetryConfig;
287
309
  walletConnect?: ResolvedWalletConnectConfig;
310
+ features: ResolvedFeatureFlags;
288
311
  onError?: (error: TrustwareError) => void;
289
312
  onSuccess?: (transaction: Transaction) => void;
290
313
  onEvent?: (event: TrustwareEvent) => void;
291
314
  };
315
+ type FeatureFlags = {
316
+ tokensPagination?: boolean;
317
+ balanceStreaming?: boolean;
318
+ };
319
+ type ResolvedFeatureFlags = {
320
+ tokensPagination: boolean;
321
+ balanceStreaming: boolean;
322
+ };
292
323
  declare const DEFAULT_SLIPPAGE = 1;
293
324
  declare const DEFAULT_AUTO_DETECT_PROVIDER = false;
294
325
  type RateLimitInfo = {
@@ -327,6 +358,7 @@ type ResolvedRetryConfig = {
327
358
  onRateLimitApproaching?: (info: RateLimitInfo, threshold: number) => void;
328
359
  };
329
360
  declare const DEFAULT_RETRY_CONFIG: ResolvedRetryConfig;
361
+ declare const DEFAULT_FEATURE_FLAGS: ResolvedFeatureFlags;
330
362
 
331
363
  type AddressValidationResult = {
332
364
  isValid: boolean;
@@ -348,7 +380,8 @@ declare function validateRouteAddresses(params: {
348
380
 
349
381
  /** Map chain reference -> backend chain_key and return enriched balances */
350
382
  declare function getBalances(chainRef: string | number, address: string): Promise<BalanceRow[]>;
351
- declare function getBalancesByAddress(address: string): Promise<WalletAddressBalanceWrapper[]>;
383
+ declare function getBalancesByAddress(address: string, opts?: BalanceStreamOptions): Promise<WalletAddressBalanceWrapper[]>;
384
+ declare function getBalancesByAddressStream(address: string, opts?: BalanceStreamOptions): AsyncGenerator<WalletAddressBalanceWrapper[], void, void>;
352
385
 
353
386
  declare function sendRouteTransaction(b: BuildRouteResult, fallbackChainId?: number | string): Promise<string>;
354
387
  declare function runTopUp(params: {
@@ -392,12 +425,14 @@ interface UseTokensResult {
392
425
  searchQuery: string;
393
426
  /** Set the search query to filter tokens */
394
427
  setSearchQuery: (query: string) => void;
428
+ /** Whether more tokens can be loaded for the active query */
429
+ hasNextPage: boolean;
430
+ /** Load the next token page when pagination is enabled */
431
+ loadMore: () => Promise<void>;
432
+ /** Whether an additional page request is in flight */
433
+ isLoadingMore: boolean;
395
434
  }
396
- /**
397
- * Hook to load available tokens for a selected chain from the registry.
398
- * Supports filtering tokens by name or symbol.
399
- */
400
- declare function useTokens(chainId: number | null | undefined): UseTokensResult;
435
+ declare function useTokens(chainId: string | number | null | undefined): UseTokensResult;
401
436
 
402
437
  declare const Trustware: {
403
438
  /** Initialize config */
@@ -423,6 +458,7 @@ declare const Trustware: {
423
458
  pollStatus: typeof pollStatus;
424
459
  getBalances: typeof getBalances;
425
460
  getBalancesByAddress: typeof getBalancesByAddress;
461
+ getBalancesByAddressStream: typeof getBalancesByAddressStream;
426
462
  useChains: typeof useChains;
427
463
  useTokens: typeof useTokens;
428
464
  validateAddressForChain: typeof validateAddressForChain;
@@ -432,4 +468,4 @@ declare const Trustware: {
432
468
  };
433
469
  type TrustwareCore = typeof Trustware;
434
470
 
435
- export { type BuildRouteResult as B, DEFAULT_SLIPPAGE as D, type RateLimitInfo as R, type TrustwareConfigOptions as T, type WalletConnectConfig as W, Trustware as a, TrustwareError as b, type Transaction as c, type TrustwareEvent as d, type TrustwareCore as e, validateSeiAddress as f, validateSolanaAddress as g, validateBtcAddress as h, validateAddressForChain as i, validateRouteAddresses as j, type ResolvedWalletConnectConfig as k, type ResolvedTrustwareConfig as l, DEFAULT_AUTO_DETECT_PROVIDER as m, type RetryConfig as n, type ResolvedRetryConfig as o, DEFAULT_RETRY_CONFIG as p, type RouteParams as q, type RouteIntent as r, type RouteEstimate as s, type RoutePlan as t, type TrustwareWidgetTheme as u, validateEvmAddress as v, type TrustwareWidgetMessages as w, DEFAULT_THEME as x, DEFAULT_MESSAGES as y };
471
+ export { DEFAULT_MESSAGES as A, type BuildRouteResult as B, DEFAULT_SLIPPAGE as D, type FeatureFlags as F, type RateLimitInfo as R, type TrustwareConfigOptions as T, type WalletConnectConfig as W, Trustware as a, TrustwareError as b, type Transaction as c, type TrustwareEvent as d, type TrustwareCore as e, validateSeiAddress as f, validateSolanaAddress as g, validateBtcAddress as h, validateAddressForChain as i, validateRouteAddresses as j, type ResolvedWalletConnectConfig as k, type ResolvedTrustwareConfig as l, type ResolvedFeatureFlags as m, DEFAULT_AUTO_DETECT_PROVIDER as n, type RetryConfig as o, type ResolvedRetryConfig as p, DEFAULT_RETRY_CONFIG as q, DEFAULT_FEATURE_FLAGS as r, type RouteParams as s, type RouteIntent as t, type RouteEstimate as u, validateEvmAddress as v, type RoutePlan as w, type TrustwareWidgetTheme as x, type TrustwareWidgetMessages as y, DEFAULT_THEME as z };
@@ -1,4 +1,4 @@
1
- import { p as ChainDef, o as ChainType, B as BalanceRow, n as WalletAddressBalanceWrapper, W as WalletInterFaceAPI, x as WalletIdentity, A as walletManager, y as WalletAddressResolution } from './manager-CgpuAzqn.js';
1
+ import { v as ChainDef, t as ChainType, B as BalanceRow, s as BalanceStreamOptions, n as WalletAddressBalanceWrapper, W as WalletInterFaceAPI, F as WalletIdentity, J as walletManager, G as WalletAddressResolution } from './manager-BPgytsNL.js';
2
2
  import { T as Token } from './types-BrVfNxND.js';
3
3
 
4
4
  declare enum TrustwareErrorCode {
@@ -199,6 +199,27 @@ type TrustwareEvent = {
199
199
  } | {
200
200
  type: "wallet_connected";
201
201
  address: string;
202
+ } | {
203
+ type: "token_page_loaded";
204
+ chainRef: string;
205
+ query?: string;
206
+ count: number;
207
+ hasNextPage: boolean;
208
+ cursor?: string;
209
+ } | {
210
+ type: "token_page_error";
211
+ chainRef: string;
212
+ query?: string;
213
+ cursor?: string;
214
+ message: string;
215
+ } | {
216
+ type: "balance_stream_chunk";
217
+ address: string;
218
+ chunkSize: number;
219
+ } | {
220
+ type: "balance_stream_fallback";
221
+ address: string;
222
+ message: string;
202
223
  };
203
224
 
204
225
  /** WalletConnect configuration options (all optional - SDK has built-in defaults) */
@@ -259,6 +280,7 @@ type TrustwareConfigOptions = {
259
280
  messages?: Partial<TrustwareWidgetMessages>;
260
281
  retry?: RetryConfig;
261
282
  walletConnect?: WalletConnectConfig;
283
+ features?: FeatureFlags;
262
284
  onError?: (error: TrustwareError) => void;
263
285
  onSuccess?: (transaction: Transaction) => void;
264
286
  onEvent?: (event: TrustwareEvent) => void;
@@ -285,10 +307,19 @@ type ResolvedTrustwareConfig = {
285
307
  messages: TrustwareWidgetMessages;
286
308
  retry: ResolvedRetryConfig;
287
309
  walletConnect?: ResolvedWalletConnectConfig;
310
+ features: ResolvedFeatureFlags;
288
311
  onError?: (error: TrustwareError) => void;
289
312
  onSuccess?: (transaction: Transaction) => void;
290
313
  onEvent?: (event: TrustwareEvent) => void;
291
314
  };
315
+ type FeatureFlags = {
316
+ tokensPagination?: boolean;
317
+ balanceStreaming?: boolean;
318
+ };
319
+ type ResolvedFeatureFlags = {
320
+ tokensPagination: boolean;
321
+ balanceStreaming: boolean;
322
+ };
292
323
  declare const DEFAULT_SLIPPAGE = 1;
293
324
  declare const DEFAULT_AUTO_DETECT_PROVIDER = false;
294
325
  type RateLimitInfo = {
@@ -327,6 +358,7 @@ type ResolvedRetryConfig = {
327
358
  onRateLimitApproaching?: (info: RateLimitInfo, threshold: number) => void;
328
359
  };
329
360
  declare const DEFAULT_RETRY_CONFIG: ResolvedRetryConfig;
361
+ declare const DEFAULT_FEATURE_FLAGS: ResolvedFeatureFlags;
330
362
 
331
363
  type AddressValidationResult = {
332
364
  isValid: boolean;
@@ -348,7 +380,8 @@ declare function validateRouteAddresses(params: {
348
380
 
349
381
  /** Map chain reference -> backend chain_key and return enriched balances */
350
382
  declare function getBalances(chainRef: string | number, address: string): Promise<BalanceRow[]>;
351
- declare function getBalancesByAddress(address: string): Promise<WalletAddressBalanceWrapper[]>;
383
+ declare function getBalancesByAddress(address: string, opts?: BalanceStreamOptions): Promise<WalletAddressBalanceWrapper[]>;
384
+ declare function getBalancesByAddressStream(address: string, opts?: BalanceStreamOptions): AsyncGenerator<WalletAddressBalanceWrapper[], void, void>;
352
385
 
353
386
  declare function sendRouteTransaction(b: BuildRouteResult, fallbackChainId?: number | string): Promise<string>;
354
387
  declare function runTopUp(params: {
@@ -392,12 +425,14 @@ interface UseTokensResult {
392
425
  searchQuery: string;
393
426
  /** Set the search query to filter tokens */
394
427
  setSearchQuery: (query: string) => void;
428
+ /** Whether more tokens can be loaded for the active query */
429
+ hasNextPage: boolean;
430
+ /** Load the next token page when pagination is enabled */
431
+ loadMore: () => Promise<void>;
432
+ /** Whether an additional page request is in flight */
433
+ isLoadingMore: boolean;
395
434
  }
396
- /**
397
- * Hook to load available tokens for a selected chain from the registry.
398
- * Supports filtering tokens by name or symbol.
399
- */
400
- declare function useTokens(chainId: number | null | undefined): UseTokensResult;
435
+ declare function useTokens(chainId: string | number | null | undefined): UseTokensResult;
401
436
 
402
437
  declare const Trustware: {
403
438
  /** Initialize config */
@@ -423,6 +458,7 @@ declare const Trustware: {
423
458
  pollStatus: typeof pollStatus;
424
459
  getBalances: typeof getBalances;
425
460
  getBalancesByAddress: typeof getBalancesByAddress;
461
+ getBalancesByAddressStream: typeof getBalancesByAddressStream;
426
462
  useChains: typeof useChains;
427
463
  useTokens: typeof useTokens;
428
464
  validateAddressForChain: typeof validateAddressForChain;
@@ -432,4 +468,4 @@ declare const Trustware: {
432
468
  };
433
469
  type TrustwareCore = typeof Trustware;
434
470
 
435
- export { type BuildRouteResult as B, DEFAULT_SLIPPAGE as D, type RateLimitInfo as R, type TrustwareConfigOptions as T, type WalletConnectConfig as W, Trustware as a, TrustwareError as b, type Transaction as c, type TrustwareEvent as d, type TrustwareCore as e, validateSeiAddress as f, validateSolanaAddress as g, validateBtcAddress as h, validateAddressForChain as i, validateRouteAddresses as j, type ResolvedWalletConnectConfig as k, type ResolvedTrustwareConfig as l, DEFAULT_AUTO_DETECT_PROVIDER as m, type RetryConfig as n, type ResolvedRetryConfig as o, DEFAULT_RETRY_CONFIG as p, type RouteParams as q, type RouteIntent as r, type RouteEstimate as s, type RoutePlan as t, type TrustwareWidgetTheme as u, validateEvmAddress as v, type TrustwareWidgetMessages as w, DEFAULT_THEME as x, DEFAULT_MESSAGES as y };
471
+ export { DEFAULT_MESSAGES as A, type BuildRouteResult as B, DEFAULT_SLIPPAGE as D, type FeatureFlags as F, type RateLimitInfo as R, type TrustwareConfigOptions as T, type WalletConnectConfig as W, Trustware as a, TrustwareError as b, type Transaction as c, type TrustwareEvent as d, type TrustwareCore as e, validateSeiAddress as f, validateSolanaAddress as g, validateBtcAddress as h, validateAddressForChain as i, validateRouteAddresses as j, type ResolvedWalletConnectConfig as k, type ResolvedTrustwareConfig as l, type ResolvedFeatureFlags as m, DEFAULT_AUTO_DETECT_PROVIDER as n, type RetryConfig as o, type ResolvedRetryConfig as p, DEFAULT_RETRY_CONFIG as q, DEFAULT_FEATURE_FLAGS as r, type RouteParams as s, type RouteIntent as t, type RouteEstimate as u, validateEvmAddress as v, type RoutePlan as w, type TrustwareWidgetTheme as x, type TrustwareWidgetMessages as y, DEFAULT_THEME as z };