@orderly.network/ui-transfer 2.8.1 → 2.8.2

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
@@ -77,11 +77,28 @@ type DepositFormScriptOptions = {
77
77
  declare const useDepositFormScript: (options: DepositFormScriptOptions) => {
78
78
  sourceToken: API.TokenInfo | undefined;
79
79
  targetToken: API.TokenInfo | undefined;
80
- sourceTokens: API.TokenInfo[];
80
+ sourceTokens: {
81
+ balance: number;
82
+ isNativeToken: boolean;
83
+ address?: string;
84
+ base_weight: number;
85
+ decimals?: number;
86
+ token_decimal?: number;
87
+ discount_factor?: number | null;
88
+ display_name?: string;
89
+ haircut: number;
90
+ is_collateral: boolean;
91
+ symbol?: string;
92
+ user_max_qty: number;
93
+ precision?: number;
94
+ minimum_withdraw_amount: number;
95
+ swap_enable?: boolean;
96
+ }[];
81
97
  targetTokens: API.TokenInfo[];
82
- onSourceTokenChange: react.Dispatch<react.SetStateAction<API.TokenInfo | undefined>>;
98
+ onSourceTokenChange: (token: API.TokenInfo) => void;
83
99
  onTargetTokenChange: react.Dispatch<react.SetStateAction<API.TokenInfo | undefined>>;
84
100
  amount: number;
101
+ nativeSymbol: string | undefined;
85
102
  isNativeToken: boolean;
86
103
  quantity: string;
87
104
  collateralContributionQuantity: number;
@@ -98,7 +115,7 @@ declare const useDepositFormScript: (options: DepositFormScriptOptions) => {
98
115
  onDeposit: () => Promise<void>;
99
116
  onApprove: () => Promise<void>;
100
117
  onApproveAndDeposit: () => Promise<void>;
101
- fetchBalance: (address: string, decimals?: number) => Promise<string>;
118
+ fetchBalance: (address: string, decimals?: number, token?: string) => Promise<string>;
102
119
  dst: {
103
120
  symbol: string;
104
121
  address: string | undefined;
@@ -112,7 +129,6 @@ declare const useDepositFormScript: (options: DepositFormScriptOptions) => {
112
129
  disabled: boolean;
113
130
  networkId: NetworkId;
114
131
  fee: {
115
- nativeSymbol: string | undefined;
116
132
  dstGasFee: string;
117
133
  feeQty: string;
118
134
  feeAmount: string;
@@ -151,13 +167,13 @@ declare const useDepositFormScript: (options: DepositFormScriptOptions) => {
151
167
  warningMessage: string;
152
168
  targetQuantity: string;
153
169
  targetQuantityLoading: boolean;
170
+ tokenBalances: Record<string, string>;
154
171
  };
155
172
  type UseDepositFeeReturn = ReturnType<typeof useDepositFee>;
156
173
  declare function useDepositFee(options: {
157
- nativeToken?: API.TokenInfo;
174
+ nativeSymbol?: string;
158
175
  depositFee?: bigint;
159
176
  }): {
160
- nativeSymbol: string | undefined;
161
177
  dstGasFee: string;
162
178
  feeQty: string;
163
179
  feeAmount: string;
@@ -190,7 +206,7 @@ declare const useWithdrawFormScript: (options: WithdrawFormScriptOptions) => {
190
206
  quantity: string;
191
207
  onQuantityChange: (qty: string) => void;
192
208
  sourceToken: API.TokenInfo | undefined;
193
- onSourceTokenChange: react.Dispatch<react.SetStateAction<API.TokenInfo | undefined>>;
209
+ onSourceTokenChange: (token: API.TokenInfo) => void;
194
210
  sourceTokens: API.TokenInfo[];
195
211
  inputStatus: InputStatus;
196
212
  hintMessage: string | undefined;
@@ -257,7 +273,7 @@ declare const useSwapDepositFormScript: (options: UseSwapDepositFormScriptOption
257
273
  actionType: DepositAction;
258
274
  onDeposit: () => Promise<void>;
259
275
  onApprove: () => Promise<void>;
260
- fetchBalance: (address: string, decimals?: number) => Promise<string>;
276
+ fetchBalance: (address: string, decimals?: number, token?: string) => Promise<string>;
261
277
  dst: {
262
278
  symbol: string;
263
279
  address: string | undefined;
@@ -437,6 +453,7 @@ type QuantityInputProps = {
437
453
  formatters?: InputFormatter[];
438
454
  vaultBalanceList?: API.VaultBalance[];
439
455
  displayType?: "balance" | "vaultBalance";
456
+ tokenBalances?: Record<string, string>;
440
457
  } & Omit<InputProps, "onClear" | "suffix" | "onValueChange">;
441
458
  declare const QuantityInput: FC<QuantityInputProps>;
442
459
 
@@ -479,7 +496,60 @@ type ActionButtonProps = {
479
496
  };
480
497
  declare const ActionButton: react__default.FC<ActionButtonProps>;
481
498
 
482
- declare const Fee: FC<Partial<UseDepositFeeReturn>>;
499
+ type FeeProps = Partial<UseDepositFeeReturn> & {
500
+ nativeSymbol?: string;
501
+ };
502
+ declare const Fee: FC<FeeProps>;
503
+
504
+ interface YieldBearingReminderProps {
505
+ /** Token symbol to check and display APY for */
506
+ symbol?: string;
507
+ /** Additional CSS class name */
508
+ className?: string;
509
+ }
510
+ /**
511
+ * YieldBearingReminder Component
512
+ * Router component that renders the appropriate reminder based on token type
513
+ * - YUSD: Dark blue theme with white text and coin icons
514
+ * - deUSD: Light pink/purple theme with dark text and deUSD logo icons
515
+ */
516
+ declare const YieldBearingReminder: FC<YieldBearingReminderProps>;
517
+
518
+ /**
519
+ * Yield-bearing collateral assets configuration
520
+ * These assets earn APY rewards while being used as collateral for trading
521
+ */
522
+ interface YieldBearingAsset {
523
+ /** Asset symbol (e.g., "YUSD", "deUSD") */
524
+ symbol: string;
525
+ /** Asset display name */
526
+ displayName: string;
527
+ /** API endpoint to fetch APY data */
528
+ apyApiUrl: string;
529
+ /** Path to extract APY value from API response (e.g., "data.efficient_apr") */
530
+ apyPath: string;
531
+ /** External link to the asset issuer's website */
532
+ externalUrl: string;
533
+ }
534
+ /**
535
+ * Configuration for all supported yield-bearing assets
536
+ * Chain support is determined by the backend API (/v1/public/token)
537
+ * via the chain_details array for each token
538
+ */
539
+ declare const YIELD_BEARING_ASSETS: YieldBearingAsset[];
540
+ /**
541
+ * Check if a token is a yield-bearing asset
542
+ * Note: This only checks if the token symbol is configured as yield-bearing.
543
+ * Chain availability is determined by the backend API's chain_details.
544
+ *
545
+ * @param symbol - Token symbol to check
546
+ * @returns true if the token is configured as yield-bearing
547
+ */
548
+ declare function isYieldBearingAsset(symbol?: string): boolean;
549
+ /**
550
+ * Get yield-bearing asset configuration by symbol
551
+ */
552
+ declare function getYieldBearingAsset(symbol?: string): YieldBearingAsset | undefined;
483
553
 
484
554
  type DepositStatusScriptReturn = ReturnType<typeof useDepositStatusScript>;
485
555
  declare function useDepositStatusScript(): {
@@ -503,4 +573,4 @@ declare const DepositStatus: react__default.FC<DepositStatusProps>;
503
573
  type DepositStatusWidgetProps = Pick<DepositStatusProps, "className" | "onClick">;
504
574
  declare const DepositStatusWidget: react__default.FC<DepositStatusWidgetProps>;
505
575
 
506
- export { ActionButton, AvailableQuantity, BrokerWallet, ChainSelect, type ConvertFormProps, ConvertFormUI, ConvertFormWidget, type CurrentChain, type DST, DepositAction, DepositAndWithdraw, type DepositAndWithdrawProps, DepositAndWithdrawWithDialogId, DepositAndWithdrawWithSheetId, DepositForm, type DepositFormScriptOptions, DepositFormWidget, type DepositFormWidgetProps, DepositStatus, DepositStatusWidget, ExchangeDivider, Fee, type InputStatus, QuantityInput, SwapCoin, SwapDepositForm, SwapDepositFormWidget, TransferDialogId, TransferForm, TransferFormWidget, type TransferFormWidgetProps, TransferSheetId, TransferWidget, Web3Wallet, WithdrawForm, type WithdrawFormScriptOptions, WithdrawFormWidget, type WithdrawFormWidgetProps, WithdrawTo, checkIsAccountId, feeDecimalsOffset, getDepositKnownErrorMessage, getTokenByTokenList, getTransferErrorMessage, useActionType, useChainSelect, useConvertFormScript as useConvertForm, useDepositAction, useDepositFormScript, useDepositStatusScript, useInputStatus, useSwapDepositFormScript, useTransferFormScript, useWithdrawFormScript };
576
+ export { ActionButton, AvailableQuantity, BrokerWallet, ChainSelect, type ConvertFormProps, ConvertFormUI, ConvertFormWidget, type CurrentChain, type DST, DepositAction, DepositAndWithdraw, type DepositAndWithdrawProps, DepositAndWithdrawWithDialogId, DepositAndWithdrawWithSheetId, DepositForm, type DepositFormScriptOptions, DepositFormWidget, type DepositFormWidgetProps, DepositStatus, DepositStatusWidget, ExchangeDivider, Fee, type InputStatus, QuantityInput, SwapCoin, SwapDepositForm, SwapDepositFormWidget, TransferDialogId, TransferForm, TransferFormWidget, type TransferFormWidgetProps, TransferSheetId, TransferWidget, Web3Wallet, WithdrawForm, type WithdrawFormScriptOptions, WithdrawFormWidget, type WithdrawFormWidgetProps, WithdrawTo, YIELD_BEARING_ASSETS, type YieldBearingAsset, YieldBearingReminder, checkIsAccountId, feeDecimalsOffset, getDepositKnownErrorMessage, getTokenByTokenList, getTransferErrorMessage, getYieldBearingAsset, isYieldBearingAsset, useActionType, useChainSelect, useConvertFormScript as useConvertForm, useDepositAction, useDepositFormScript, useDepositStatusScript, useInputStatus, useSwapDepositFormScript, useTransferFormScript, useWithdrawFormScript };
package/dist/index.d.ts CHANGED
@@ -77,11 +77,28 @@ type DepositFormScriptOptions = {
77
77
  declare const useDepositFormScript: (options: DepositFormScriptOptions) => {
78
78
  sourceToken: API.TokenInfo | undefined;
79
79
  targetToken: API.TokenInfo | undefined;
80
- sourceTokens: API.TokenInfo[];
80
+ sourceTokens: {
81
+ balance: number;
82
+ isNativeToken: boolean;
83
+ address?: string;
84
+ base_weight: number;
85
+ decimals?: number;
86
+ token_decimal?: number;
87
+ discount_factor?: number | null;
88
+ display_name?: string;
89
+ haircut: number;
90
+ is_collateral: boolean;
91
+ symbol?: string;
92
+ user_max_qty: number;
93
+ precision?: number;
94
+ minimum_withdraw_amount: number;
95
+ swap_enable?: boolean;
96
+ }[];
81
97
  targetTokens: API.TokenInfo[];
82
- onSourceTokenChange: react.Dispatch<react.SetStateAction<API.TokenInfo | undefined>>;
98
+ onSourceTokenChange: (token: API.TokenInfo) => void;
83
99
  onTargetTokenChange: react.Dispatch<react.SetStateAction<API.TokenInfo | undefined>>;
84
100
  amount: number;
101
+ nativeSymbol: string | undefined;
85
102
  isNativeToken: boolean;
86
103
  quantity: string;
87
104
  collateralContributionQuantity: number;
@@ -98,7 +115,7 @@ declare const useDepositFormScript: (options: DepositFormScriptOptions) => {
98
115
  onDeposit: () => Promise<void>;
99
116
  onApprove: () => Promise<void>;
100
117
  onApproveAndDeposit: () => Promise<void>;
101
- fetchBalance: (address: string, decimals?: number) => Promise<string>;
118
+ fetchBalance: (address: string, decimals?: number, token?: string) => Promise<string>;
102
119
  dst: {
103
120
  symbol: string;
104
121
  address: string | undefined;
@@ -112,7 +129,6 @@ declare const useDepositFormScript: (options: DepositFormScriptOptions) => {
112
129
  disabled: boolean;
113
130
  networkId: NetworkId;
114
131
  fee: {
115
- nativeSymbol: string | undefined;
116
132
  dstGasFee: string;
117
133
  feeQty: string;
118
134
  feeAmount: string;
@@ -151,13 +167,13 @@ declare const useDepositFormScript: (options: DepositFormScriptOptions) => {
151
167
  warningMessage: string;
152
168
  targetQuantity: string;
153
169
  targetQuantityLoading: boolean;
170
+ tokenBalances: Record<string, string>;
154
171
  };
155
172
  type UseDepositFeeReturn = ReturnType<typeof useDepositFee>;
156
173
  declare function useDepositFee(options: {
157
- nativeToken?: API.TokenInfo;
174
+ nativeSymbol?: string;
158
175
  depositFee?: bigint;
159
176
  }): {
160
- nativeSymbol: string | undefined;
161
177
  dstGasFee: string;
162
178
  feeQty: string;
163
179
  feeAmount: string;
@@ -190,7 +206,7 @@ declare const useWithdrawFormScript: (options: WithdrawFormScriptOptions) => {
190
206
  quantity: string;
191
207
  onQuantityChange: (qty: string) => void;
192
208
  sourceToken: API.TokenInfo | undefined;
193
- onSourceTokenChange: react.Dispatch<react.SetStateAction<API.TokenInfo | undefined>>;
209
+ onSourceTokenChange: (token: API.TokenInfo) => void;
194
210
  sourceTokens: API.TokenInfo[];
195
211
  inputStatus: InputStatus;
196
212
  hintMessage: string | undefined;
@@ -257,7 +273,7 @@ declare const useSwapDepositFormScript: (options: UseSwapDepositFormScriptOption
257
273
  actionType: DepositAction;
258
274
  onDeposit: () => Promise<void>;
259
275
  onApprove: () => Promise<void>;
260
- fetchBalance: (address: string, decimals?: number) => Promise<string>;
276
+ fetchBalance: (address: string, decimals?: number, token?: string) => Promise<string>;
261
277
  dst: {
262
278
  symbol: string;
263
279
  address: string | undefined;
@@ -437,6 +453,7 @@ type QuantityInputProps = {
437
453
  formatters?: InputFormatter[];
438
454
  vaultBalanceList?: API.VaultBalance[];
439
455
  displayType?: "balance" | "vaultBalance";
456
+ tokenBalances?: Record<string, string>;
440
457
  } & Omit<InputProps, "onClear" | "suffix" | "onValueChange">;
441
458
  declare const QuantityInput: FC<QuantityInputProps>;
442
459
 
@@ -479,7 +496,60 @@ type ActionButtonProps = {
479
496
  };
480
497
  declare const ActionButton: react__default.FC<ActionButtonProps>;
481
498
 
482
- declare const Fee: FC<Partial<UseDepositFeeReturn>>;
499
+ type FeeProps = Partial<UseDepositFeeReturn> & {
500
+ nativeSymbol?: string;
501
+ };
502
+ declare const Fee: FC<FeeProps>;
503
+
504
+ interface YieldBearingReminderProps {
505
+ /** Token symbol to check and display APY for */
506
+ symbol?: string;
507
+ /** Additional CSS class name */
508
+ className?: string;
509
+ }
510
+ /**
511
+ * YieldBearingReminder Component
512
+ * Router component that renders the appropriate reminder based on token type
513
+ * - YUSD: Dark blue theme with white text and coin icons
514
+ * - deUSD: Light pink/purple theme with dark text and deUSD logo icons
515
+ */
516
+ declare const YieldBearingReminder: FC<YieldBearingReminderProps>;
517
+
518
+ /**
519
+ * Yield-bearing collateral assets configuration
520
+ * These assets earn APY rewards while being used as collateral for trading
521
+ */
522
+ interface YieldBearingAsset {
523
+ /** Asset symbol (e.g., "YUSD", "deUSD") */
524
+ symbol: string;
525
+ /** Asset display name */
526
+ displayName: string;
527
+ /** API endpoint to fetch APY data */
528
+ apyApiUrl: string;
529
+ /** Path to extract APY value from API response (e.g., "data.efficient_apr") */
530
+ apyPath: string;
531
+ /** External link to the asset issuer's website */
532
+ externalUrl: string;
533
+ }
534
+ /**
535
+ * Configuration for all supported yield-bearing assets
536
+ * Chain support is determined by the backend API (/v1/public/token)
537
+ * via the chain_details array for each token
538
+ */
539
+ declare const YIELD_BEARING_ASSETS: YieldBearingAsset[];
540
+ /**
541
+ * Check if a token is a yield-bearing asset
542
+ * Note: This only checks if the token symbol is configured as yield-bearing.
543
+ * Chain availability is determined by the backend API's chain_details.
544
+ *
545
+ * @param symbol - Token symbol to check
546
+ * @returns true if the token is configured as yield-bearing
547
+ */
548
+ declare function isYieldBearingAsset(symbol?: string): boolean;
549
+ /**
550
+ * Get yield-bearing asset configuration by symbol
551
+ */
552
+ declare function getYieldBearingAsset(symbol?: string): YieldBearingAsset | undefined;
483
553
 
484
554
  type DepositStatusScriptReturn = ReturnType<typeof useDepositStatusScript>;
485
555
  declare function useDepositStatusScript(): {
@@ -503,4 +573,4 @@ declare const DepositStatus: react__default.FC<DepositStatusProps>;
503
573
  type DepositStatusWidgetProps = Pick<DepositStatusProps, "className" | "onClick">;
504
574
  declare const DepositStatusWidget: react__default.FC<DepositStatusWidgetProps>;
505
575
 
506
- export { ActionButton, AvailableQuantity, BrokerWallet, ChainSelect, type ConvertFormProps, ConvertFormUI, ConvertFormWidget, type CurrentChain, type DST, DepositAction, DepositAndWithdraw, type DepositAndWithdrawProps, DepositAndWithdrawWithDialogId, DepositAndWithdrawWithSheetId, DepositForm, type DepositFormScriptOptions, DepositFormWidget, type DepositFormWidgetProps, DepositStatus, DepositStatusWidget, ExchangeDivider, Fee, type InputStatus, QuantityInput, SwapCoin, SwapDepositForm, SwapDepositFormWidget, TransferDialogId, TransferForm, TransferFormWidget, type TransferFormWidgetProps, TransferSheetId, TransferWidget, Web3Wallet, WithdrawForm, type WithdrawFormScriptOptions, WithdrawFormWidget, type WithdrawFormWidgetProps, WithdrawTo, checkIsAccountId, feeDecimalsOffset, getDepositKnownErrorMessage, getTokenByTokenList, getTransferErrorMessage, useActionType, useChainSelect, useConvertFormScript as useConvertForm, useDepositAction, useDepositFormScript, useDepositStatusScript, useInputStatus, useSwapDepositFormScript, useTransferFormScript, useWithdrawFormScript };
576
+ export { ActionButton, AvailableQuantity, BrokerWallet, ChainSelect, type ConvertFormProps, ConvertFormUI, ConvertFormWidget, type CurrentChain, type DST, DepositAction, DepositAndWithdraw, type DepositAndWithdrawProps, DepositAndWithdrawWithDialogId, DepositAndWithdrawWithSheetId, DepositForm, type DepositFormScriptOptions, DepositFormWidget, type DepositFormWidgetProps, DepositStatus, DepositStatusWidget, ExchangeDivider, Fee, type InputStatus, QuantityInput, SwapCoin, SwapDepositForm, SwapDepositFormWidget, TransferDialogId, TransferForm, TransferFormWidget, type TransferFormWidgetProps, TransferSheetId, TransferWidget, Web3Wallet, WithdrawForm, type WithdrawFormScriptOptions, WithdrawFormWidget, type WithdrawFormWidgetProps, WithdrawTo, YIELD_BEARING_ASSETS, type YieldBearingAsset, YieldBearingReminder, checkIsAccountId, feeDecimalsOffset, getDepositKnownErrorMessage, getTokenByTokenList, getTransferErrorMessage, getYieldBearingAsset, isYieldBearingAsset, useActionType, useChainSelect, useConvertFormScript as useConvertForm, useDepositAction, useDepositFormScript, useDepositStatusScript, useInputStatus, useSwapDepositFormScript, useTransferFormScript, useWithdrawFormScript };