@orderly.network/portfolio 2.7.1-alpha.0 → 2.7.2-alpha.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/dist/index.d.mts CHANGED
@@ -4,11 +4,12 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as _orderly_network_types from '@orderly.network/types';
5
5
  import { API, AssetHistorySideEnum } from '@orderly.network/types';
6
6
  import * as _orderly_network_hooks from '@orderly.network/hooks';
7
- import { TWType } from '@orderly.network/hooks';
7
+ import { TWType, useAccount } from '@orderly.network/hooks';
8
8
  import * as _orderly_network_ui from '@orderly.network/ui';
9
- import { Column } from '@orderly.network/ui';
9
+ import { Column, TanstackColumn } from '@orderly.network/ui';
10
10
  import { PositionsProps } from '@orderly.network/ui-positions';
11
11
  import { SharePnLConfig } from '@orderly.network/ui-share';
12
+ import { Decimal } from '@orderly.network/utils';
12
13
 
13
14
  type PortfolioLayoutProps = ScaffoldProps & {
14
15
  hideSideBar?: boolean;
@@ -332,18 +333,24 @@ type FeeTierPageProps = FeeTierWidgetProps;
332
333
  declare const FeeTierPage: React$1.FC<FeeTierPageProps>;
333
334
 
334
335
  type UseFeeTierScriptOptions = {
335
- dataAdapter?: (columns: Column[], dataSource: any[]) => {
336
- columns: Column[];
336
+ dataAdapter?: (columns: Column<any>[], dataSource: any[], context?: {
337
+ tier?: number;
338
+ }) => {
339
+ columns: Column<any>[];
337
340
  dataSource: any[];
338
341
  };
339
342
  headerDataAdapter?: (original: any[]) => any[];
340
343
  onRow?: (record: any, index: number) => {
341
- normal: any;
342
- active: any;
344
+ normal?: any;
345
+ active?: any;
346
+ };
347
+ onCell?: (column: TanstackColumn<any>, record: any, index: number) => {
348
+ normal?: any;
349
+ active?: any;
343
350
  };
344
351
  };
345
352
  interface FeeDataType {
346
- tier: number;
353
+ tier: number | null;
347
354
  volume_min?: number | null;
348
355
  volume_max?: number | null;
349
356
  volume_node?: React$1.ReactNode;
@@ -352,14 +359,18 @@ interface FeeDataType {
352
359
  taker_fee: string;
353
360
  }
354
361
  declare const useFeeTierScript: (options?: UseFeeTierScriptOptions) => {
355
- columns: Column[] | Column<FeeDataType>[];
362
+ columns: Column<any>[] | Column<FeeDataType>[];
356
363
  dataSource: any[] | FeeDataType[];
357
364
  onRow: ((record: any, index: number) => {
358
- normal: any;
359
- active: any;
365
+ normal?: any;
366
+ active?: any;
367
+ }) | undefined;
368
+ onCell: ((column: TanstackColumn<any>, record: any, index: number) => {
369
+ normal?: any;
370
+ active?: any;
360
371
  }) | undefined;
361
372
  headerDataAdapter: ((original: any[]) => any[]) | undefined;
362
- tier?: number | undefined;
373
+ tier?: number | null | undefined;
363
374
  vol?: number | undefined;
364
375
  };
365
376
 
@@ -419,11 +430,65 @@ declare namespace index$2 {
419
430
  export { index$2_SettingPage as SettingPage, index$2_SettingWidget as SettingWidget };
420
431
  }
421
432
 
433
+ declare const useAssetsScript: () => {
434
+ columns: _orderly_network_ui.Column[];
435
+ dataSource: {
436
+ children: {
437
+ indexPrice: number;
438
+ assetValue: number;
439
+ collateralRatio: Decimal;
440
+ collateralContribution: number;
441
+ token: string;
442
+ holding: number;
443
+ frozen: number;
444
+ pending_short: number;
445
+ updated_time: number;
446
+ account_id: string;
447
+ }[];
448
+ account_id: string;
449
+ id?: string;
450
+ description?: string;
451
+ }[];
452
+ visible: boolean;
453
+ onToggleVisibility: () => void;
454
+ selectedAccount: string;
455
+ selectedAsset: string;
456
+ onFilter: (filter: {
457
+ name: string;
458
+ value: string;
459
+ }) => void;
460
+ totalValue: number;
461
+ hasSubAccount: boolean;
462
+ onDeposit: () => void;
463
+ onWithdraw: () => void;
464
+ holding: _orderly_network_types.API.Holding[];
465
+ assetsOptions: {
466
+ label: string;
467
+ value: string;
468
+ }[];
469
+ };
470
+ type useAssetsScriptReturn = ReturnType<typeof useAssetsScript> & ReturnType<typeof useAccount>;
471
+
472
+ type AssetsWidgetProps = useAssetsScriptReturn;
473
+ declare const AssetsDataTableWidget: React$1.FC;
474
+ declare const AssetsWidget: React$1.FC;
475
+
422
476
  declare const AssetsPage: React$1.FC;
423
477
 
478
+ declare const AssetsDataTable: React$1.FC<Pick<AssetsWidgetProps, "columns" | "dataSource" | "isMainAccount" | "onFilter" | "selectedAccount" | "selectedAsset" | "assetsOptions" | "state">>;
479
+ declare const AssetsTable: React$1.FC<AssetsWidgetProps>;
480
+
481
+ declare const AssetsTableMobile: React$1.FC<useAssetsScriptReturn>;
482
+
483
+ declare const index$1_AssetsDataTable: typeof AssetsDataTable;
484
+ declare const index$1_AssetsDataTableWidget: typeof AssetsDataTableWidget;
424
485
  declare const index$1_AssetsPage: typeof AssetsPage;
486
+ declare const index$1_AssetsTable: typeof AssetsTable;
487
+ declare const index$1_AssetsTableMobile: typeof AssetsTableMobile;
488
+ declare const index$1_AssetsWidget: typeof AssetsWidget;
489
+ type index$1_AssetsWidgetProps = AssetsWidgetProps;
425
490
  declare namespace index$1 {
426
- export { index$1_AssetsPage as AssetsPage };
491
+ export { index$1_AssetsDataTable as AssetsDataTable, index$1_AssetsDataTableWidget as AssetsDataTableWidget, index$1_AssetsPage as AssetsPage, index$1_AssetsTable as AssetsTable, index$1_AssetsTableMobile as AssetsTableMobile, index$1_AssetsWidget as AssetsWidget, type index$1_AssetsWidgetProps as AssetsWidgetProps };
427
492
  }
428
493
 
429
494
  declare const HistoryWidget: React$1.FC;
package/dist/index.d.ts CHANGED
@@ -4,11 +4,12 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as _orderly_network_types from '@orderly.network/types';
5
5
  import { API, AssetHistorySideEnum } from '@orderly.network/types';
6
6
  import * as _orderly_network_hooks from '@orderly.network/hooks';
7
- import { TWType } from '@orderly.network/hooks';
7
+ import { TWType, useAccount } from '@orderly.network/hooks';
8
8
  import * as _orderly_network_ui from '@orderly.network/ui';
9
- import { Column } from '@orderly.network/ui';
9
+ import { Column, TanstackColumn } from '@orderly.network/ui';
10
10
  import { PositionsProps } from '@orderly.network/ui-positions';
11
11
  import { SharePnLConfig } from '@orderly.network/ui-share';
12
+ import { Decimal } from '@orderly.network/utils';
12
13
 
13
14
  type PortfolioLayoutProps = ScaffoldProps & {
14
15
  hideSideBar?: boolean;
@@ -332,18 +333,24 @@ type FeeTierPageProps = FeeTierWidgetProps;
332
333
  declare const FeeTierPage: React$1.FC<FeeTierPageProps>;
333
334
 
334
335
  type UseFeeTierScriptOptions = {
335
- dataAdapter?: (columns: Column[], dataSource: any[]) => {
336
- columns: Column[];
336
+ dataAdapter?: (columns: Column<any>[], dataSource: any[], context?: {
337
+ tier?: number;
338
+ }) => {
339
+ columns: Column<any>[];
337
340
  dataSource: any[];
338
341
  };
339
342
  headerDataAdapter?: (original: any[]) => any[];
340
343
  onRow?: (record: any, index: number) => {
341
- normal: any;
342
- active: any;
344
+ normal?: any;
345
+ active?: any;
346
+ };
347
+ onCell?: (column: TanstackColumn<any>, record: any, index: number) => {
348
+ normal?: any;
349
+ active?: any;
343
350
  };
344
351
  };
345
352
  interface FeeDataType {
346
- tier: number;
353
+ tier: number | null;
347
354
  volume_min?: number | null;
348
355
  volume_max?: number | null;
349
356
  volume_node?: React$1.ReactNode;
@@ -352,14 +359,18 @@ interface FeeDataType {
352
359
  taker_fee: string;
353
360
  }
354
361
  declare const useFeeTierScript: (options?: UseFeeTierScriptOptions) => {
355
- columns: Column[] | Column<FeeDataType>[];
362
+ columns: Column<any>[] | Column<FeeDataType>[];
356
363
  dataSource: any[] | FeeDataType[];
357
364
  onRow: ((record: any, index: number) => {
358
- normal: any;
359
- active: any;
365
+ normal?: any;
366
+ active?: any;
367
+ }) | undefined;
368
+ onCell: ((column: TanstackColumn<any>, record: any, index: number) => {
369
+ normal?: any;
370
+ active?: any;
360
371
  }) | undefined;
361
372
  headerDataAdapter: ((original: any[]) => any[]) | undefined;
362
- tier?: number | undefined;
373
+ tier?: number | null | undefined;
363
374
  vol?: number | undefined;
364
375
  };
365
376
 
@@ -419,11 +430,65 @@ declare namespace index$2 {
419
430
  export { index$2_SettingPage as SettingPage, index$2_SettingWidget as SettingWidget };
420
431
  }
421
432
 
433
+ declare const useAssetsScript: () => {
434
+ columns: _orderly_network_ui.Column[];
435
+ dataSource: {
436
+ children: {
437
+ indexPrice: number;
438
+ assetValue: number;
439
+ collateralRatio: Decimal;
440
+ collateralContribution: number;
441
+ token: string;
442
+ holding: number;
443
+ frozen: number;
444
+ pending_short: number;
445
+ updated_time: number;
446
+ account_id: string;
447
+ }[];
448
+ account_id: string;
449
+ id?: string;
450
+ description?: string;
451
+ }[];
452
+ visible: boolean;
453
+ onToggleVisibility: () => void;
454
+ selectedAccount: string;
455
+ selectedAsset: string;
456
+ onFilter: (filter: {
457
+ name: string;
458
+ value: string;
459
+ }) => void;
460
+ totalValue: number;
461
+ hasSubAccount: boolean;
462
+ onDeposit: () => void;
463
+ onWithdraw: () => void;
464
+ holding: _orderly_network_types.API.Holding[];
465
+ assetsOptions: {
466
+ label: string;
467
+ value: string;
468
+ }[];
469
+ };
470
+ type useAssetsScriptReturn = ReturnType<typeof useAssetsScript> & ReturnType<typeof useAccount>;
471
+
472
+ type AssetsWidgetProps = useAssetsScriptReturn;
473
+ declare const AssetsDataTableWidget: React$1.FC;
474
+ declare const AssetsWidget: React$1.FC;
475
+
422
476
  declare const AssetsPage: React$1.FC;
423
477
 
478
+ declare const AssetsDataTable: React$1.FC<Pick<AssetsWidgetProps, "columns" | "dataSource" | "isMainAccount" | "onFilter" | "selectedAccount" | "selectedAsset" | "assetsOptions" | "state">>;
479
+ declare const AssetsTable: React$1.FC<AssetsWidgetProps>;
480
+
481
+ declare const AssetsTableMobile: React$1.FC<useAssetsScriptReturn>;
482
+
483
+ declare const index$1_AssetsDataTable: typeof AssetsDataTable;
484
+ declare const index$1_AssetsDataTableWidget: typeof AssetsDataTableWidget;
424
485
  declare const index$1_AssetsPage: typeof AssetsPage;
486
+ declare const index$1_AssetsTable: typeof AssetsTable;
487
+ declare const index$1_AssetsTableMobile: typeof AssetsTableMobile;
488
+ declare const index$1_AssetsWidget: typeof AssetsWidget;
489
+ type index$1_AssetsWidgetProps = AssetsWidgetProps;
425
490
  declare namespace index$1 {
426
- export { index$1_AssetsPage as AssetsPage };
491
+ export { index$1_AssetsDataTable as AssetsDataTable, index$1_AssetsDataTableWidget as AssetsDataTableWidget, index$1_AssetsPage as AssetsPage, index$1_AssetsTable as AssetsTable, index$1_AssetsTableMobile as AssetsTableMobile, index$1_AssetsWidget as AssetsWidget, type index$1_AssetsWidgetProps as AssetsWidgetProps };
427
492
  }
428
493
 
429
494
  declare const HistoryWidget: React$1.FC;