@kodiak-finance/orderly-ui-transfer 2.8.18 → 2.8.19
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 +167 -24
- package/dist/index.d.ts +167 -24
- package/dist/index.js +8932 -50
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8888 -7
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +13 -13
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import react__default, { FC, ReactNode } from 'react';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
4
|
import { ConnectedChain, Chain, SubAccount } from '@kodiak-finance/orderly-hooks';
|
|
5
|
+
import * as _kodiak_finance_orderly_types from '@kodiak-finance/orderly-types';
|
|
4
6
|
import { API, NetworkId, AssetHistoryStatusEnum } from '@kodiak-finance/orderly-types';
|
|
5
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
7
|
import { InputFormatter, InputProps } from '@kodiak-finance/orderly-ui';
|
|
7
8
|
|
|
8
9
|
type DST = {
|
|
@@ -76,15 +77,33 @@ type DepositFormScriptOptions = {
|
|
|
76
77
|
declare const useDepositFormScript: (options: DepositFormScriptOptions) => {
|
|
77
78
|
sourceToken: API.TokenInfo | undefined;
|
|
78
79
|
targetToken: API.TokenInfo | undefined;
|
|
79
|
-
sourceTokens:
|
|
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
|
+
}[];
|
|
80
97
|
targetTokens: API.TokenInfo[];
|
|
81
|
-
onSourceTokenChange:
|
|
98
|
+
onSourceTokenChange: (token: API.TokenInfo) => void;
|
|
82
99
|
onTargetTokenChange: react.Dispatch<react.SetStateAction<API.TokenInfo | undefined>>;
|
|
83
100
|
amount: number;
|
|
101
|
+
nativeSymbol: string | undefined;
|
|
84
102
|
isNativeToken: boolean;
|
|
85
103
|
quantity: string;
|
|
86
104
|
collateralContributionQuantity: number;
|
|
87
105
|
maxQuantity: string;
|
|
106
|
+
maxDepositAmount: string;
|
|
88
107
|
indexPrice: number;
|
|
89
108
|
onQuantityChange: react.Dispatch<react.SetStateAction<string>>;
|
|
90
109
|
hintMessage: string | undefined;
|
|
@@ -97,7 +116,7 @@ declare const useDepositFormScript: (options: DepositFormScriptOptions) => {
|
|
|
97
116
|
onDeposit: () => Promise<void>;
|
|
98
117
|
onApprove: () => Promise<void>;
|
|
99
118
|
onApproveAndDeposit: () => Promise<void>;
|
|
100
|
-
fetchBalance: (address: string, decimals?: number) => Promise<string>;
|
|
119
|
+
fetchBalance: (address: string, decimals?: number, token?: string) => Promise<string>;
|
|
101
120
|
dst: {
|
|
102
121
|
symbol: string;
|
|
103
122
|
address: string | undefined;
|
|
@@ -111,7 +130,6 @@ declare const useDepositFormScript: (options: DepositFormScriptOptions) => {
|
|
|
111
130
|
disabled: boolean;
|
|
112
131
|
networkId: NetworkId;
|
|
113
132
|
fee: {
|
|
114
|
-
nativeSymbol: string | undefined;
|
|
115
133
|
dstGasFee: string;
|
|
116
134
|
feeQty: string;
|
|
117
135
|
feeAmount: string;
|
|
@@ -147,16 +165,17 @@ declare const useDepositFormScript: (options: DepositFormScriptOptions) => {
|
|
|
147
165
|
symbol: string | undefined;
|
|
148
166
|
}[];
|
|
149
167
|
};
|
|
150
|
-
warningMessage: string |
|
|
168
|
+
warningMessage: string | react_jsx_runtime.JSX.Element;
|
|
151
169
|
targetQuantity: string;
|
|
152
170
|
targetQuantityLoading: boolean;
|
|
171
|
+
tokenBalances: Record<string, string>;
|
|
172
|
+
isLoggedIn: boolean;
|
|
153
173
|
};
|
|
154
174
|
type UseDepositFeeReturn = ReturnType<typeof useDepositFee>;
|
|
155
175
|
declare function useDepositFee(options: {
|
|
156
|
-
|
|
176
|
+
nativeSymbol?: string;
|
|
157
177
|
depositFee?: bigint;
|
|
158
178
|
}): {
|
|
159
|
-
nativeSymbol: string | undefined;
|
|
160
179
|
dstGasFee: string;
|
|
161
180
|
feeQty: string;
|
|
162
181
|
feeAmount: string;
|
|
@@ -173,11 +192,14 @@ type WithdrawFormScriptOptions = {
|
|
|
173
192
|
close?: () => void;
|
|
174
193
|
};
|
|
175
194
|
declare const useWithdrawFormScript: (options: WithdrawFormScriptOptions) => {
|
|
176
|
-
currentLTV: number;
|
|
177
|
-
nextLTV: number;
|
|
178
|
-
ltvWarningMessage: string;
|
|
179
195
|
withdrawTo: WithdrawTo;
|
|
180
196
|
setWithdrawTo: react.Dispatch<react.SetStateAction<WithdrawTo>>;
|
|
197
|
+
currentLTV: number;
|
|
198
|
+
nextLTV: number;
|
|
199
|
+
warningMessage: string;
|
|
200
|
+
isLoggedIn: boolean;
|
|
201
|
+
isTokenUnsupported: boolean;
|
|
202
|
+
onSwitchToSupportedNetwork: (this: unknown) => Promise<void>;
|
|
181
203
|
toAccountId: string;
|
|
182
204
|
setToAccountId: react.Dispatch<react.SetStateAction<string>>;
|
|
183
205
|
onTransfer: () => void;
|
|
@@ -189,8 +211,23 @@ declare const useWithdrawFormScript: (options: WithdrawFormScriptOptions) => {
|
|
|
189
211
|
quantity: string;
|
|
190
212
|
onQuantityChange: (qty: string) => void;
|
|
191
213
|
sourceToken: API.TokenInfo | undefined;
|
|
192
|
-
onSourceTokenChange:
|
|
193
|
-
sourceTokens: API.TokenInfo[]
|
|
214
|
+
onSourceTokenChange: (this: unknown, token: API.TokenInfo) => void;
|
|
215
|
+
sourceTokens: API.TokenInfo[] | {
|
|
216
|
+
symbol: string;
|
|
217
|
+
token_decimal: number;
|
|
218
|
+
precision: number;
|
|
219
|
+
token: string;
|
|
220
|
+
token_hash: string;
|
|
221
|
+
decimals: number;
|
|
222
|
+
minimum_withdraw_amount: number;
|
|
223
|
+
base_weight: number;
|
|
224
|
+
discount_factor: number;
|
|
225
|
+
haircut: number;
|
|
226
|
+
user_max_qty: number;
|
|
227
|
+
is_collateral: boolean;
|
|
228
|
+
on_chain_swap: boolean;
|
|
229
|
+
chain_details: API.ChainDetail[];
|
|
230
|
+
}[];
|
|
194
231
|
inputStatus: InputStatus;
|
|
195
232
|
hintMessage: string | undefined;
|
|
196
233
|
amount: number;
|
|
@@ -201,11 +238,28 @@ declare const useWithdrawFormScript: (options: WithdrawFormScriptOptions) => {
|
|
|
201
238
|
unsettledPnL: number;
|
|
202
239
|
wrongNetwork: boolean;
|
|
203
240
|
settingChain: boolean;
|
|
204
|
-
tokenChains:
|
|
241
|
+
tokenChains: {
|
|
242
|
+
isSupported: boolean;
|
|
243
|
+
name: string;
|
|
244
|
+
shortName: string;
|
|
245
|
+
public_rpc_url: string;
|
|
246
|
+
chain_id: number;
|
|
247
|
+
currency_symbol: string;
|
|
248
|
+
bridge_enable: boolean;
|
|
249
|
+
mainnet: boolean;
|
|
250
|
+
est_txn_mins: number | null;
|
|
251
|
+
explorer_base_url: string;
|
|
252
|
+
bridgeless?: boolean;
|
|
253
|
+
withdrawal_fee?: number;
|
|
254
|
+
minimum_withdraw_amount?: number;
|
|
255
|
+
vault_address: string;
|
|
256
|
+
currency_decimal?: number;
|
|
257
|
+
cross_chain_router: string;
|
|
258
|
+
depositor: string;
|
|
259
|
+
}[];
|
|
205
260
|
currentChain: CurrentChain | null;
|
|
206
261
|
onChainChange: (chain: API.NetworkInfos) => Promise<void>;
|
|
207
262
|
onWithdraw: () => Promise<void>;
|
|
208
|
-
chainVaultBalance: number | null;
|
|
209
263
|
fee: number;
|
|
210
264
|
crossChainWithdraw: boolean;
|
|
211
265
|
crossChainTrans: boolean;
|
|
@@ -216,8 +270,7 @@ declare const useWithdrawFormScript: (options: WithdrawFormScriptOptions) => {
|
|
|
216
270
|
onSettlePnl: () => Promise<any>;
|
|
217
271
|
brokerName: string;
|
|
218
272
|
qtyGreaterThanMaxAmount: boolean;
|
|
219
|
-
|
|
220
|
-
vaultBalanceList: API.VaultBalance[] | undefined;
|
|
273
|
+
vaultBalanceList: API.VaultBalance[];
|
|
221
274
|
};
|
|
222
275
|
|
|
223
276
|
type WithdrawFormProps = WithdrawFormScriptReturn;
|
|
@@ -256,7 +309,7 @@ declare const useSwapDepositFormScript: (options: UseSwapDepositFormScriptOption
|
|
|
256
309
|
actionType: DepositAction;
|
|
257
310
|
onDeposit: () => Promise<void>;
|
|
258
311
|
onApprove: () => Promise<void>;
|
|
259
|
-
fetchBalance: (address: string, decimals?: number) => Promise<string>;
|
|
312
|
+
fetchBalance: (address: string, decimals?: number, token?: string) => Promise<string>;
|
|
260
313
|
dst: {
|
|
261
314
|
symbol: string;
|
|
262
315
|
address: string | undefined;
|
|
@@ -353,10 +406,30 @@ declare const useConvertFormScript: (options: ConvertFormScriptOptions) => {
|
|
|
353
406
|
address: string | undefined;
|
|
354
407
|
quantity: string;
|
|
355
408
|
onQuantityChange: (qty: string) => void;
|
|
356
|
-
token: API.
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
409
|
+
token: (_kodiak_finance_orderly_types.API.Token & {
|
|
410
|
+
contract_address: string;
|
|
411
|
+
quoteChainId: string;
|
|
412
|
+
precision: number;
|
|
413
|
+
symbol: string;
|
|
414
|
+
}) | undefined;
|
|
415
|
+
sourceTokens: (_kodiak_finance_orderly_types.API.Token & {
|
|
416
|
+
contract_address: string;
|
|
417
|
+
quoteChainId: string;
|
|
418
|
+
precision: number;
|
|
419
|
+
symbol: string;
|
|
420
|
+
})[];
|
|
421
|
+
onSourceTokenChange: react.Dispatch<react.SetStateAction<(_kodiak_finance_orderly_types.API.Token & {
|
|
422
|
+
contract_address: string;
|
|
423
|
+
quoteChainId: string;
|
|
424
|
+
precision: number;
|
|
425
|
+
symbol: string;
|
|
426
|
+
}) | undefined>>;
|
|
427
|
+
targetToken: (_kodiak_finance_orderly_types.API.Token & {
|
|
428
|
+
contract_address: string;
|
|
429
|
+
quoteChainId: string;
|
|
430
|
+
precision: number;
|
|
431
|
+
symbol: string;
|
|
432
|
+
}) | undefined;
|
|
360
433
|
balanceRevalidating: boolean;
|
|
361
434
|
maxQuantity: number;
|
|
362
435
|
disabled: boolean;
|
|
@@ -374,6 +447,16 @@ declare const useConvertFormScript: (options: ConvertFormScriptOptions) => {
|
|
|
374
447
|
isQuoteLoading: boolean;
|
|
375
448
|
currentLTV: number;
|
|
376
449
|
nextLTV: number;
|
|
450
|
+
targetChainInfo: {
|
|
451
|
+
precision: number | undefined;
|
|
452
|
+
chain_id?: string | undefined;
|
|
453
|
+
contract_address?: string | undefined;
|
|
454
|
+
decimals?: number | undefined;
|
|
455
|
+
withdrawal_fee?: number | undefined;
|
|
456
|
+
chain_name?: string;
|
|
457
|
+
cross_chain_withdrawal_fee?: number | undefined;
|
|
458
|
+
display_name?: string | undefined;
|
|
459
|
+
};
|
|
377
460
|
};
|
|
378
461
|
|
|
379
462
|
type ConvertFormProps = ConvertFormScriptReturn;
|
|
@@ -385,6 +468,7 @@ declare const getTokenByTokenList: (tokens?: API.TokenInfo[]) => API.TokenInfo;
|
|
|
385
468
|
declare const feeDecimalsOffset: (origin?: number) => number;
|
|
386
469
|
declare function checkIsAccountId(accountId: string): boolean;
|
|
387
470
|
declare function getTransferErrorMessage(errorCode: number): string;
|
|
471
|
+
declare function getDepositKnownErrorMessage(message: string): string | undefined;
|
|
388
472
|
|
|
389
473
|
type ChainSelectProps = {
|
|
390
474
|
chains: API.NetworkInfos[];
|
|
@@ -392,6 +476,7 @@ type ChainSelectProps = {
|
|
|
392
476
|
onValueChange: (chain: API.NetworkInfos) => Promise<void>;
|
|
393
477
|
wrongNetwork: boolean;
|
|
394
478
|
loading?: boolean;
|
|
479
|
+
disabled?: boolean;
|
|
395
480
|
};
|
|
396
481
|
declare const ChainSelect: React.FC<ChainSelectProps>;
|
|
397
482
|
|
|
@@ -401,6 +486,7 @@ type QuantityInputProps = {
|
|
|
401
486
|
label?: string;
|
|
402
487
|
status?: InputStatus;
|
|
403
488
|
hintMessage?: string;
|
|
489
|
+
hintSuffix?: ReactNode;
|
|
404
490
|
onValueChange?: (value: string) => void;
|
|
405
491
|
onTokenChange?: (token: any) => void;
|
|
406
492
|
fetchBalance?: (token: string, decimals: number) => Promise<any>;
|
|
@@ -409,6 +495,9 @@ type QuantityInputProps = {
|
|
|
409
495
|
formatters?: InputFormatter[];
|
|
410
496
|
vaultBalanceList?: API.VaultBalance[];
|
|
411
497
|
displayType?: "balance" | "vaultBalance";
|
|
498
|
+
tokenBalances?: Record<string, string>;
|
|
499
|
+
tokenValueFormatter?: (value: string) => ReactNode;
|
|
500
|
+
tokenShowCaret?: boolean;
|
|
412
501
|
} & Omit<InputProps, "onClear" | "suffix" | "onValueChange">;
|
|
413
502
|
declare const QuantityInput: FC<QuantityInputProps>;
|
|
414
503
|
|
|
@@ -418,6 +507,7 @@ type AvailableQuantityProps = {
|
|
|
418
507
|
maxQuantity?: number | string;
|
|
419
508
|
onClick?: () => void;
|
|
420
509
|
loading?: boolean;
|
|
510
|
+
tooltipContent?: React.ReactNode;
|
|
421
511
|
};
|
|
422
512
|
declare const AvailableQuantity: FC<AvailableQuantityProps>;
|
|
423
513
|
|
|
@@ -451,7 +541,60 @@ type ActionButtonProps = {
|
|
|
451
541
|
};
|
|
452
542
|
declare const ActionButton: react__default.FC<ActionButtonProps>;
|
|
453
543
|
|
|
454
|
-
|
|
544
|
+
type FeeProps = Partial<UseDepositFeeReturn> & {
|
|
545
|
+
nativeSymbol?: string;
|
|
546
|
+
};
|
|
547
|
+
declare const Fee: FC<FeeProps>;
|
|
548
|
+
|
|
549
|
+
interface YieldBearingReminderProps {
|
|
550
|
+
/** Token symbol to check and display APY for */
|
|
551
|
+
symbol?: string;
|
|
552
|
+
/** Additional CSS class name */
|
|
553
|
+
className?: string;
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* YieldBearingReminder Component
|
|
557
|
+
* Router component that renders the appropriate reminder based on token type
|
|
558
|
+
* - YUSD: Dark blue theme with white text and coin icons
|
|
559
|
+
* - deUSD: Light pink/purple theme with dark text and deUSD logo icons
|
|
560
|
+
*/
|
|
561
|
+
declare const YieldBearingReminder: FC<YieldBearingReminderProps>;
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* Yield-bearing collateral assets configuration
|
|
565
|
+
* These assets earn APY rewards while being used as collateral for trading
|
|
566
|
+
*/
|
|
567
|
+
interface YieldBearingAsset {
|
|
568
|
+
/** Asset symbol (e.g., "YUSD", "deUSD") */
|
|
569
|
+
symbol: string;
|
|
570
|
+
/** Asset display name */
|
|
571
|
+
displayName: string;
|
|
572
|
+
/** API endpoint to fetch APY data */
|
|
573
|
+
apyApiUrl: string;
|
|
574
|
+
/** Path to extract APY value from API response (e.g., "data.efficient_apr") */
|
|
575
|
+
apyPath: string;
|
|
576
|
+
/** External link to the asset issuer's website */
|
|
577
|
+
externalUrl: string;
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* Configuration for all supported yield-bearing assets
|
|
581
|
+
* Chain support is determined by the backend API (/v1/public/token)
|
|
582
|
+
* via the chain_details array for each token
|
|
583
|
+
*/
|
|
584
|
+
declare const YIELD_BEARING_ASSETS: YieldBearingAsset[];
|
|
585
|
+
/**
|
|
586
|
+
* Check if a token is a yield-bearing asset
|
|
587
|
+
* Note: This only checks if the token symbol is configured as yield-bearing.
|
|
588
|
+
* Chain availability is determined by the backend API's chain_details.
|
|
589
|
+
*
|
|
590
|
+
* @param symbol - Token symbol to check
|
|
591
|
+
* @returns true if the token is configured as yield-bearing
|
|
592
|
+
*/
|
|
593
|
+
declare function isYieldBearingAsset(symbol?: string): boolean;
|
|
594
|
+
/**
|
|
595
|
+
* Get yield-bearing asset configuration by symbol
|
|
596
|
+
*/
|
|
597
|
+
declare function getYieldBearingAsset(symbol?: string): YieldBearingAsset | undefined;
|
|
455
598
|
|
|
456
599
|
type DepositStatusScriptReturn = ReturnType<typeof useDepositStatusScript>;
|
|
457
600
|
declare function useDepositStatusScript(): {
|
|
@@ -475,4 +618,4 @@ declare const DepositStatus: react__default.FC<DepositStatusProps>;
|
|
|
475
618
|
type DepositStatusWidgetProps = Pick<DepositStatusProps, "className" | "onClick">;
|
|
476
619
|
declare const DepositStatusWidget: react__default.FC<DepositStatusWidgetProps>;
|
|
477
620
|
|
|
478
|
-
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, getTokenByTokenList, getTransferErrorMessage, useActionType, useChainSelect, useConvertFormScript as useConvertForm, useDepositAction, useDepositFormScript, useDepositStatusScript, useInputStatus, useSwapDepositFormScript, useTransferFormScript, useWithdrawFormScript };
|
|
621
|
+
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
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import react__default, { FC, ReactNode } from 'react';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
4
|
import { ConnectedChain, Chain, SubAccount } from '@kodiak-finance/orderly-hooks';
|
|
5
|
+
import * as _kodiak_finance_orderly_types from '@kodiak-finance/orderly-types';
|
|
4
6
|
import { API, NetworkId, AssetHistoryStatusEnum } from '@kodiak-finance/orderly-types';
|
|
5
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
7
|
import { InputFormatter, InputProps } from '@kodiak-finance/orderly-ui';
|
|
7
8
|
|
|
8
9
|
type DST = {
|
|
@@ -76,15 +77,33 @@ type DepositFormScriptOptions = {
|
|
|
76
77
|
declare const useDepositFormScript: (options: DepositFormScriptOptions) => {
|
|
77
78
|
sourceToken: API.TokenInfo | undefined;
|
|
78
79
|
targetToken: API.TokenInfo | undefined;
|
|
79
|
-
sourceTokens:
|
|
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
|
+
}[];
|
|
80
97
|
targetTokens: API.TokenInfo[];
|
|
81
|
-
onSourceTokenChange:
|
|
98
|
+
onSourceTokenChange: (token: API.TokenInfo) => void;
|
|
82
99
|
onTargetTokenChange: react.Dispatch<react.SetStateAction<API.TokenInfo | undefined>>;
|
|
83
100
|
amount: number;
|
|
101
|
+
nativeSymbol: string | undefined;
|
|
84
102
|
isNativeToken: boolean;
|
|
85
103
|
quantity: string;
|
|
86
104
|
collateralContributionQuantity: number;
|
|
87
105
|
maxQuantity: string;
|
|
106
|
+
maxDepositAmount: string;
|
|
88
107
|
indexPrice: number;
|
|
89
108
|
onQuantityChange: react.Dispatch<react.SetStateAction<string>>;
|
|
90
109
|
hintMessage: string | undefined;
|
|
@@ -97,7 +116,7 @@ declare const useDepositFormScript: (options: DepositFormScriptOptions) => {
|
|
|
97
116
|
onDeposit: () => Promise<void>;
|
|
98
117
|
onApprove: () => Promise<void>;
|
|
99
118
|
onApproveAndDeposit: () => Promise<void>;
|
|
100
|
-
fetchBalance: (address: string, decimals?: number) => Promise<string>;
|
|
119
|
+
fetchBalance: (address: string, decimals?: number, token?: string) => Promise<string>;
|
|
101
120
|
dst: {
|
|
102
121
|
symbol: string;
|
|
103
122
|
address: string | undefined;
|
|
@@ -111,7 +130,6 @@ declare const useDepositFormScript: (options: DepositFormScriptOptions) => {
|
|
|
111
130
|
disabled: boolean;
|
|
112
131
|
networkId: NetworkId;
|
|
113
132
|
fee: {
|
|
114
|
-
nativeSymbol: string | undefined;
|
|
115
133
|
dstGasFee: string;
|
|
116
134
|
feeQty: string;
|
|
117
135
|
feeAmount: string;
|
|
@@ -147,16 +165,17 @@ declare const useDepositFormScript: (options: DepositFormScriptOptions) => {
|
|
|
147
165
|
symbol: string | undefined;
|
|
148
166
|
}[];
|
|
149
167
|
};
|
|
150
|
-
warningMessage: string |
|
|
168
|
+
warningMessage: string | react_jsx_runtime.JSX.Element;
|
|
151
169
|
targetQuantity: string;
|
|
152
170
|
targetQuantityLoading: boolean;
|
|
171
|
+
tokenBalances: Record<string, string>;
|
|
172
|
+
isLoggedIn: boolean;
|
|
153
173
|
};
|
|
154
174
|
type UseDepositFeeReturn = ReturnType<typeof useDepositFee>;
|
|
155
175
|
declare function useDepositFee(options: {
|
|
156
|
-
|
|
176
|
+
nativeSymbol?: string;
|
|
157
177
|
depositFee?: bigint;
|
|
158
178
|
}): {
|
|
159
|
-
nativeSymbol: string | undefined;
|
|
160
179
|
dstGasFee: string;
|
|
161
180
|
feeQty: string;
|
|
162
181
|
feeAmount: string;
|
|
@@ -173,11 +192,14 @@ type WithdrawFormScriptOptions = {
|
|
|
173
192
|
close?: () => void;
|
|
174
193
|
};
|
|
175
194
|
declare const useWithdrawFormScript: (options: WithdrawFormScriptOptions) => {
|
|
176
|
-
currentLTV: number;
|
|
177
|
-
nextLTV: number;
|
|
178
|
-
ltvWarningMessage: string;
|
|
179
195
|
withdrawTo: WithdrawTo;
|
|
180
196
|
setWithdrawTo: react.Dispatch<react.SetStateAction<WithdrawTo>>;
|
|
197
|
+
currentLTV: number;
|
|
198
|
+
nextLTV: number;
|
|
199
|
+
warningMessage: string;
|
|
200
|
+
isLoggedIn: boolean;
|
|
201
|
+
isTokenUnsupported: boolean;
|
|
202
|
+
onSwitchToSupportedNetwork: (this: unknown) => Promise<void>;
|
|
181
203
|
toAccountId: string;
|
|
182
204
|
setToAccountId: react.Dispatch<react.SetStateAction<string>>;
|
|
183
205
|
onTransfer: () => void;
|
|
@@ -189,8 +211,23 @@ declare const useWithdrawFormScript: (options: WithdrawFormScriptOptions) => {
|
|
|
189
211
|
quantity: string;
|
|
190
212
|
onQuantityChange: (qty: string) => void;
|
|
191
213
|
sourceToken: API.TokenInfo | undefined;
|
|
192
|
-
onSourceTokenChange:
|
|
193
|
-
sourceTokens: API.TokenInfo[]
|
|
214
|
+
onSourceTokenChange: (this: unknown, token: API.TokenInfo) => void;
|
|
215
|
+
sourceTokens: API.TokenInfo[] | {
|
|
216
|
+
symbol: string;
|
|
217
|
+
token_decimal: number;
|
|
218
|
+
precision: number;
|
|
219
|
+
token: string;
|
|
220
|
+
token_hash: string;
|
|
221
|
+
decimals: number;
|
|
222
|
+
minimum_withdraw_amount: number;
|
|
223
|
+
base_weight: number;
|
|
224
|
+
discount_factor: number;
|
|
225
|
+
haircut: number;
|
|
226
|
+
user_max_qty: number;
|
|
227
|
+
is_collateral: boolean;
|
|
228
|
+
on_chain_swap: boolean;
|
|
229
|
+
chain_details: API.ChainDetail[];
|
|
230
|
+
}[];
|
|
194
231
|
inputStatus: InputStatus;
|
|
195
232
|
hintMessage: string | undefined;
|
|
196
233
|
amount: number;
|
|
@@ -201,11 +238,28 @@ declare const useWithdrawFormScript: (options: WithdrawFormScriptOptions) => {
|
|
|
201
238
|
unsettledPnL: number;
|
|
202
239
|
wrongNetwork: boolean;
|
|
203
240
|
settingChain: boolean;
|
|
204
|
-
tokenChains:
|
|
241
|
+
tokenChains: {
|
|
242
|
+
isSupported: boolean;
|
|
243
|
+
name: string;
|
|
244
|
+
shortName: string;
|
|
245
|
+
public_rpc_url: string;
|
|
246
|
+
chain_id: number;
|
|
247
|
+
currency_symbol: string;
|
|
248
|
+
bridge_enable: boolean;
|
|
249
|
+
mainnet: boolean;
|
|
250
|
+
est_txn_mins: number | null;
|
|
251
|
+
explorer_base_url: string;
|
|
252
|
+
bridgeless?: boolean;
|
|
253
|
+
withdrawal_fee?: number;
|
|
254
|
+
minimum_withdraw_amount?: number;
|
|
255
|
+
vault_address: string;
|
|
256
|
+
currency_decimal?: number;
|
|
257
|
+
cross_chain_router: string;
|
|
258
|
+
depositor: string;
|
|
259
|
+
}[];
|
|
205
260
|
currentChain: CurrentChain | null;
|
|
206
261
|
onChainChange: (chain: API.NetworkInfos) => Promise<void>;
|
|
207
262
|
onWithdraw: () => Promise<void>;
|
|
208
|
-
chainVaultBalance: number | null;
|
|
209
263
|
fee: number;
|
|
210
264
|
crossChainWithdraw: boolean;
|
|
211
265
|
crossChainTrans: boolean;
|
|
@@ -216,8 +270,7 @@ declare const useWithdrawFormScript: (options: WithdrawFormScriptOptions) => {
|
|
|
216
270
|
onSettlePnl: () => Promise<any>;
|
|
217
271
|
brokerName: string;
|
|
218
272
|
qtyGreaterThanMaxAmount: boolean;
|
|
219
|
-
|
|
220
|
-
vaultBalanceList: API.VaultBalance[] | undefined;
|
|
273
|
+
vaultBalanceList: API.VaultBalance[];
|
|
221
274
|
};
|
|
222
275
|
|
|
223
276
|
type WithdrawFormProps = WithdrawFormScriptReturn;
|
|
@@ -256,7 +309,7 @@ declare const useSwapDepositFormScript: (options: UseSwapDepositFormScriptOption
|
|
|
256
309
|
actionType: DepositAction;
|
|
257
310
|
onDeposit: () => Promise<void>;
|
|
258
311
|
onApprove: () => Promise<void>;
|
|
259
|
-
fetchBalance: (address: string, decimals?: number) => Promise<string>;
|
|
312
|
+
fetchBalance: (address: string, decimals?: number, token?: string) => Promise<string>;
|
|
260
313
|
dst: {
|
|
261
314
|
symbol: string;
|
|
262
315
|
address: string | undefined;
|
|
@@ -353,10 +406,30 @@ declare const useConvertFormScript: (options: ConvertFormScriptOptions) => {
|
|
|
353
406
|
address: string | undefined;
|
|
354
407
|
quantity: string;
|
|
355
408
|
onQuantityChange: (qty: string) => void;
|
|
356
|
-
token: API.
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
409
|
+
token: (_kodiak_finance_orderly_types.API.Token & {
|
|
410
|
+
contract_address: string;
|
|
411
|
+
quoteChainId: string;
|
|
412
|
+
precision: number;
|
|
413
|
+
symbol: string;
|
|
414
|
+
}) | undefined;
|
|
415
|
+
sourceTokens: (_kodiak_finance_orderly_types.API.Token & {
|
|
416
|
+
contract_address: string;
|
|
417
|
+
quoteChainId: string;
|
|
418
|
+
precision: number;
|
|
419
|
+
symbol: string;
|
|
420
|
+
})[];
|
|
421
|
+
onSourceTokenChange: react.Dispatch<react.SetStateAction<(_kodiak_finance_orderly_types.API.Token & {
|
|
422
|
+
contract_address: string;
|
|
423
|
+
quoteChainId: string;
|
|
424
|
+
precision: number;
|
|
425
|
+
symbol: string;
|
|
426
|
+
}) | undefined>>;
|
|
427
|
+
targetToken: (_kodiak_finance_orderly_types.API.Token & {
|
|
428
|
+
contract_address: string;
|
|
429
|
+
quoteChainId: string;
|
|
430
|
+
precision: number;
|
|
431
|
+
symbol: string;
|
|
432
|
+
}) | undefined;
|
|
360
433
|
balanceRevalidating: boolean;
|
|
361
434
|
maxQuantity: number;
|
|
362
435
|
disabled: boolean;
|
|
@@ -374,6 +447,16 @@ declare const useConvertFormScript: (options: ConvertFormScriptOptions) => {
|
|
|
374
447
|
isQuoteLoading: boolean;
|
|
375
448
|
currentLTV: number;
|
|
376
449
|
nextLTV: number;
|
|
450
|
+
targetChainInfo: {
|
|
451
|
+
precision: number | undefined;
|
|
452
|
+
chain_id?: string | undefined;
|
|
453
|
+
contract_address?: string | undefined;
|
|
454
|
+
decimals?: number | undefined;
|
|
455
|
+
withdrawal_fee?: number | undefined;
|
|
456
|
+
chain_name?: string;
|
|
457
|
+
cross_chain_withdrawal_fee?: number | undefined;
|
|
458
|
+
display_name?: string | undefined;
|
|
459
|
+
};
|
|
377
460
|
};
|
|
378
461
|
|
|
379
462
|
type ConvertFormProps = ConvertFormScriptReturn;
|
|
@@ -385,6 +468,7 @@ declare const getTokenByTokenList: (tokens?: API.TokenInfo[]) => API.TokenInfo;
|
|
|
385
468
|
declare const feeDecimalsOffset: (origin?: number) => number;
|
|
386
469
|
declare function checkIsAccountId(accountId: string): boolean;
|
|
387
470
|
declare function getTransferErrorMessage(errorCode: number): string;
|
|
471
|
+
declare function getDepositKnownErrorMessage(message: string): string | undefined;
|
|
388
472
|
|
|
389
473
|
type ChainSelectProps = {
|
|
390
474
|
chains: API.NetworkInfos[];
|
|
@@ -392,6 +476,7 @@ type ChainSelectProps = {
|
|
|
392
476
|
onValueChange: (chain: API.NetworkInfos) => Promise<void>;
|
|
393
477
|
wrongNetwork: boolean;
|
|
394
478
|
loading?: boolean;
|
|
479
|
+
disabled?: boolean;
|
|
395
480
|
};
|
|
396
481
|
declare const ChainSelect: React.FC<ChainSelectProps>;
|
|
397
482
|
|
|
@@ -401,6 +486,7 @@ type QuantityInputProps = {
|
|
|
401
486
|
label?: string;
|
|
402
487
|
status?: InputStatus;
|
|
403
488
|
hintMessage?: string;
|
|
489
|
+
hintSuffix?: ReactNode;
|
|
404
490
|
onValueChange?: (value: string) => void;
|
|
405
491
|
onTokenChange?: (token: any) => void;
|
|
406
492
|
fetchBalance?: (token: string, decimals: number) => Promise<any>;
|
|
@@ -409,6 +495,9 @@ type QuantityInputProps = {
|
|
|
409
495
|
formatters?: InputFormatter[];
|
|
410
496
|
vaultBalanceList?: API.VaultBalance[];
|
|
411
497
|
displayType?: "balance" | "vaultBalance";
|
|
498
|
+
tokenBalances?: Record<string, string>;
|
|
499
|
+
tokenValueFormatter?: (value: string) => ReactNode;
|
|
500
|
+
tokenShowCaret?: boolean;
|
|
412
501
|
} & Omit<InputProps, "onClear" | "suffix" | "onValueChange">;
|
|
413
502
|
declare const QuantityInput: FC<QuantityInputProps>;
|
|
414
503
|
|
|
@@ -418,6 +507,7 @@ type AvailableQuantityProps = {
|
|
|
418
507
|
maxQuantity?: number | string;
|
|
419
508
|
onClick?: () => void;
|
|
420
509
|
loading?: boolean;
|
|
510
|
+
tooltipContent?: React.ReactNode;
|
|
421
511
|
};
|
|
422
512
|
declare const AvailableQuantity: FC<AvailableQuantityProps>;
|
|
423
513
|
|
|
@@ -451,7 +541,60 @@ type ActionButtonProps = {
|
|
|
451
541
|
};
|
|
452
542
|
declare const ActionButton: react__default.FC<ActionButtonProps>;
|
|
453
543
|
|
|
454
|
-
|
|
544
|
+
type FeeProps = Partial<UseDepositFeeReturn> & {
|
|
545
|
+
nativeSymbol?: string;
|
|
546
|
+
};
|
|
547
|
+
declare const Fee: FC<FeeProps>;
|
|
548
|
+
|
|
549
|
+
interface YieldBearingReminderProps {
|
|
550
|
+
/** Token symbol to check and display APY for */
|
|
551
|
+
symbol?: string;
|
|
552
|
+
/** Additional CSS class name */
|
|
553
|
+
className?: string;
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* YieldBearingReminder Component
|
|
557
|
+
* Router component that renders the appropriate reminder based on token type
|
|
558
|
+
* - YUSD: Dark blue theme with white text and coin icons
|
|
559
|
+
* - deUSD: Light pink/purple theme with dark text and deUSD logo icons
|
|
560
|
+
*/
|
|
561
|
+
declare const YieldBearingReminder: FC<YieldBearingReminderProps>;
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* Yield-bearing collateral assets configuration
|
|
565
|
+
* These assets earn APY rewards while being used as collateral for trading
|
|
566
|
+
*/
|
|
567
|
+
interface YieldBearingAsset {
|
|
568
|
+
/** Asset symbol (e.g., "YUSD", "deUSD") */
|
|
569
|
+
symbol: string;
|
|
570
|
+
/** Asset display name */
|
|
571
|
+
displayName: string;
|
|
572
|
+
/** API endpoint to fetch APY data */
|
|
573
|
+
apyApiUrl: string;
|
|
574
|
+
/** Path to extract APY value from API response (e.g., "data.efficient_apr") */
|
|
575
|
+
apyPath: string;
|
|
576
|
+
/** External link to the asset issuer's website */
|
|
577
|
+
externalUrl: string;
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* Configuration for all supported yield-bearing assets
|
|
581
|
+
* Chain support is determined by the backend API (/v1/public/token)
|
|
582
|
+
* via the chain_details array for each token
|
|
583
|
+
*/
|
|
584
|
+
declare const YIELD_BEARING_ASSETS: YieldBearingAsset[];
|
|
585
|
+
/**
|
|
586
|
+
* Check if a token is a yield-bearing asset
|
|
587
|
+
* Note: This only checks if the token symbol is configured as yield-bearing.
|
|
588
|
+
* Chain availability is determined by the backend API's chain_details.
|
|
589
|
+
*
|
|
590
|
+
* @param symbol - Token symbol to check
|
|
591
|
+
* @returns true if the token is configured as yield-bearing
|
|
592
|
+
*/
|
|
593
|
+
declare function isYieldBearingAsset(symbol?: string): boolean;
|
|
594
|
+
/**
|
|
595
|
+
* Get yield-bearing asset configuration by symbol
|
|
596
|
+
*/
|
|
597
|
+
declare function getYieldBearingAsset(symbol?: string): YieldBearingAsset | undefined;
|
|
455
598
|
|
|
456
599
|
type DepositStatusScriptReturn = ReturnType<typeof useDepositStatusScript>;
|
|
457
600
|
declare function useDepositStatusScript(): {
|
|
@@ -475,4 +618,4 @@ declare const DepositStatus: react__default.FC<DepositStatusProps>;
|
|
|
475
618
|
type DepositStatusWidgetProps = Pick<DepositStatusProps, "className" | "onClick">;
|
|
476
619
|
declare const DepositStatusWidget: react__default.FC<DepositStatusWidgetProps>;
|
|
477
620
|
|
|
478
|
-
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, getTokenByTokenList, getTransferErrorMessage, useActionType, useChainSelect, useConvertFormScript as useConvertForm, useDepositAction, useDepositFormScript, useDepositStatusScript, useInputStatus, useSwapDepositFormScript, useTransferFormScript, useWithdrawFormScript };
|
|
621
|
+
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 };
|