@orderly.network/ui-transfer 2.11.0 → 3.0.0-beta.1

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
@@ -205,11 +205,22 @@ declare const WithdrawFormWidget: FC<WithdrawFormWidgetProps>;
205
205
 
206
206
  declare const DepositAndWithdrawWithDialogId = "DepositAndWithdrawWithDialogId";
207
207
  declare const DepositAndWithdrawWithSheetId = "DepositAndWithdrawWithSheetId";
208
+ interface DepositTabExtension {
209
+ id: string;
210
+ title: string;
211
+ icon: React.ReactNode;
212
+ component: React.ComponentType<{
213
+ close?: () => void;
214
+ }>;
215
+ order?: number;
216
+ }
208
217
  type DepositAndWithdrawProps = {
209
- activeTab?: "deposit" | "withdraw";
218
+ activeTab?: string;
210
219
  close?: () => void;
220
+ extraTabs?: DepositTabExtension[];
211
221
  };
212
222
  declare const DepositAndWithdraw: FC<DepositAndWithdrawProps>;
223
+ declare const InjectableDepositAndWithdraw: react.ComponentType<DepositAndWithdrawProps>;
213
224
 
214
225
  type TransferFormScriptReturn = ReturnType<typeof useTransferFormScript>;
215
226
  type TransferFormScriptOptions = {
@@ -512,4 +523,4 @@ declare const DepositStatus: react__default.FC<DepositStatusProps>;
512
523
  type DepositStatusWidgetProps = Pick<DepositStatusProps, "className" | "onClick">;
513
524
  declare const DepositStatusWidget: react__default.FC<DepositStatusWidgetProps>;
514
525
 
515
- export { ActionButton, AvailableQuantity, BrokerWallet, ChainSelect, type ConvertFormProps, ConvertFormUI, ConvertFormWidget, type CurrentChain, DEPOSIT_ERROR_CODE_MAP, DepositAction, DepositAndWithdraw, type DepositAndWithdrawProps, DepositAndWithdrawWithDialogId, DepositAndWithdrawWithSheetId, DepositForm, type DepositFormScriptOptions, DepositFormWidget, type DepositFormWidgetProps, DepositStatus, DepositStatusWidget, ExchangeDivider, Fee, type InputStatus, QuantityInput, SwapCoin, TransferDialogId, TransferForm, TransferFormWidget, type TransferFormWidgetProps, TransferSheetId, TransferWidget, Web3Wallet, WithdrawForm, type WithdrawFormScriptOptions, WithdrawFormWidget, type WithdrawFormWidgetProps, WithdrawTo, YIELD_BEARING_ASSETS, type YieldBearingAsset, YieldBearingReminder, checkIsAccountId, feeDecimalsOffset, getDepositKnownErrorMessage, getTransferErrorMessage, getUSDCToken, getYieldBearingAsset, isYieldBearingAsset, sortTokensWithUSDCFirst, useConvertFormScript as useConvertForm, useDepositFormScript, useDepositStatusScript, useTransferFormScript, useWithdrawFormScript };
526
+ export { ActionButton, AvailableQuantity, BrokerWallet, ChainSelect, type ConvertFormProps, ConvertFormUI, ConvertFormWidget, type CurrentChain, DEPOSIT_ERROR_CODE_MAP, DepositAction, DepositAndWithdraw, type DepositAndWithdrawProps, DepositAndWithdrawWithDialogId, DepositAndWithdrawWithSheetId, DepositForm, type DepositFormScriptOptions, DepositFormWidget, type DepositFormWidgetProps, DepositStatus, DepositStatusWidget, type DepositTabExtension, ExchangeDivider, Fee, InjectableDepositAndWithdraw, type InputStatus, QuantityInput, SwapCoin, TransferDialogId, TransferForm, TransferFormWidget, type TransferFormWidgetProps, TransferSheetId, TransferWidget, Web3Wallet, WithdrawForm, type WithdrawFormScriptOptions, WithdrawFormWidget, type WithdrawFormWidgetProps, WithdrawTo, YIELD_BEARING_ASSETS, type YieldBearingAsset, YieldBearingReminder, checkIsAccountId, feeDecimalsOffset, getDepositKnownErrorMessage, getTransferErrorMessage, getUSDCToken, getYieldBearingAsset, isYieldBearingAsset, sortTokensWithUSDCFirst, useConvertFormScript as useConvertForm, useDepositFormScript, useDepositStatusScript, useTransferFormScript, useWithdrawFormScript };
package/dist/index.d.ts CHANGED
@@ -205,11 +205,22 @@ declare const WithdrawFormWidget: FC<WithdrawFormWidgetProps>;
205
205
 
206
206
  declare const DepositAndWithdrawWithDialogId = "DepositAndWithdrawWithDialogId";
207
207
  declare const DepositAndWithdrawWithSheetId = "DepositAndWithdrawWithSheetId";
208
+ interface DepositTabExtension {
209
+ id: string;
210
+ title: string;
211
+ icon: React.ReactNode;
212
+ component: React.ComponentType<{
213
+ close?: () => void;
214
+ }>;
215
+ order?: number;
216
+ }
208
217
  type DepositAndWithdrawProps = {
209
- activeTab?: "deposit" | "withdraw";
218
+ activeTab?: string;
210
219
  close?: () => void;
220
+ extraTabs?: DepositTabExtension[];
211
221
  };
212
222
  declare const DepositAndWithdraw: FC<DepositAndWithdrawProps>;
223
+ declare const InjectableDepositAndWithdraw: react.ComponentType<DepositAndWithdrawProps>;
213
224
 
214
225
  type TransferFormScriptReturn = ReturnType<typeof useTransferFormScript>;
215
226
  type TransferFormScriptOptions = {
@@ -512,4 +523,4 @@ declare const DepositStatus: react__default.FC<DepositStatusProps>;
512
523
  type DepositStatusWidgetProps = Pick<DepositStatusProps, "className" | "onClick">;
513
524
  declare const DepositStatusWidget: react__default.FC<DepositStatusWidgetProps>;
514
525
 
515
- export { ActionButton, AvailableQuantity, BrokerWallet, ChainSelect, type ConvertFormProps, ConvertFormUI, ConvertFormWidget, type CurrentChain, DEPOSIT_ERROR_CODE_MAP, DepositAction, DepositAndWithdraw, type DepositAndWithdrawProps, DepositAndWithdrawWithDialogId, DepositAndWithdrawWithSheetId, DepositForm, type DepositFormScriptOptions, DepositFormWidget, type DepositFormWidgetProps, DepositStatus, DepositStatusWidget, ExchangeDivider, Fee, type InputStatus, QuantityInput, SwapCoin, TransferDialogId, TransferForm, TransferFormWidget, type TransferFormWidgetProps, TransferSheetId, TransferWidget, Web3Wallet, WithdrawForm, type WithdrawFormScriptOptions, WithdrawFormWidget, type WithdrawFormWidgetProps, WithdrawTo, YIELD_BEARING_ASSETS, type YieldBearingAsset, YieldBearingReminder, checkIsAccountId, feeDecimalsOffset, getDepositKnownErrorMessage, getTransferErrorMessage, getUSDCToken, getYieldBearingAsset, isYieldBearingAsset, sortTokensWithUSDCFirst, useConvertFormScript as useConvertForm, useDepositFormScript, useDepositStatusScript, useTransferFormScript, useWithdrawFormScript };
526
+ export { ActionButton, AvailableQuantity, BrokerWallet, ChainSelect, type ConvertFormProps, ConvertFormUI, ConvertFormWidget, type CurrentChain, DEPOSIT_ERROR_CODE_MAP, DepositAction, DepositAndWithdraw, type DepositAndWithdrawProps, DepositAndWithdrawWithDialogId, DepositAndWithdrawWithSheetId, DepositForm, type DepositFormScriptOptions, DepositFormWidget, type DepositFormWidgetProps, DepositStatus, DepositStatusWidget, type DepositTabExtension, ExchangeDivider, Fee, InjectableDepositAndWithdraw, type InputStatus, QuantityInput, SwapCoin, TransferDialogId, TransferForm, TransferFormWidget, type TransferFormWidgetProps, TransferSheetId, TransferWidget, Web3Wallet, WithdrawForm, type WithdrawFormScriptOptions, WithdrawFormWidget, type WithdrawFormWidgetProps, WithdrawTo, YIELD_BEARING_ASSETS, type YieldBearingAsset, YieldBearingReminder, checkIsAccountId, feeDecimalsOffset, getDepositKnownErrorMessage, getTransferErrorMessage, getUSDCToken, getYieldBearingAsset, isYieldBearingAsset, sortTokensWithUSDCFirst, useConvertFormScript as useConvertForm, useDepositFormScript, useDepositStatusScript, useTransferFormScript, useWithdrawFormScript };
package/dist/index.js CHANGED
@@ -14,6 +14,7 @@ var core = require('@orderly.network/core');
14
14
  var uiChainSelector = require('@orderly.network/ui-chain-selector');
15
15
  var web3_js = require('@solana/web3.js');
16
16
  var ethers = require('ethers');
17
+ var pluginCore = require('@orderly.network/plugin-core');
17
18
  var defaultSolanaAdapter = require('@orderly.network/default-solana-adapter');
18
19
 
19
20
  // src/components/depositForm/depositForm.ui.tsx
@@ -2482,6 +2483,9 @@ var useSwapTokens = (chainId, enableSwapDeposit) => {
2482
2483
  logo_uri: item.logoURI
2483
2484
  }));
2484
2485
  }, [data]);
2486
+ if (!enableSwapDeposit) {
2487
+ return [];
2488
+ }
2485
2489
  return tokens;
2486
2490
  };
2487
2491
 
@@ -5988,10 +5992,14 @@ var WithdrawSlot = (props) => {
5988
5992
  var DepositAndWithdrawWithDialogId = "DepositAndWithdrawWithDialogId";
5989
5993
  var DepositAndWithdrawWithSheetId = "DepositAndWithdrawWithSheetId";
5990
5994
  var DepositAndWithdraw = (props) => {
5995
+ const { extraTabs = [] } = props;
5991
5996
  const [activeTab, setActiveTab] = react.useState(
5992
5997
  props.activeTab || "deposit"
5993
5998
  );
5994
5999
  const { t } = i18n.useTranslation();
6000
+ const sortedExtra = [...extraTabs].sort(
6001
+ (a, b) => (a.order ?? 100) - (b.order ?? 100)
6002
+ );
5995
6003
  return /* @__PURE__ */ jsxRuntime.jsxs(
5996
6004
  ui.Tabs,
5997
6005
  {
@@ -6021,18 +6029,39 @@ var DepositAndWithdraw = (props) => {
6021
6029
  value: "withdraw",
6022
6030
  children: /* @__PURE__ */ jsxRuntime.jsx(WithdrawSlot, { close: props.close })
6023
6031
  }
6024
- )
6032
+ ),
6033
+ sortedExtra.map((tab) => /* @__PURE__ */ jsxRuntime.jsx(
6034
+ ui.TabPanel,
6035
+ {
6036
+ title: tab.title,
6037
+ icon: react.isValidElement(tab.icon) ? tab.icon : void 0,
6038
+ value: tab.id,
6039
+ children: /* @__PURE__ */ jsxRuntime.jsx(tab.component, { close: props.close })
6040
+ },
6041
+ tab.id
6042
+ ))
6025
6043
  ]
6026
6044
  }
6027
6045
  );
6028
6046
  };
6029
- ui.registerSimpleDialog(DepositAndWithdrawWithDialogId, DepositAndWithdraw, {
6030
- size: "md",
6031
- classNames: {
6032
- content: "oui-border oui-border-line-6"
6047
+ var InjectableDepositAndWithdraw = pluginCore.injectable(
6048
+ DepositAndWithdraw,
6049
+ "Transfer.DepositAndWithdraw"
6050
+ );
6051
+ ui.registerSimpleDialog(
6052
+ DepositAndWithdrawWithDialogId,
6053
+ InjectableDepositAndWithdraw,
6054
+ {
6055
+ size: "md",
6056
+ classNames: {
6057
+ content: "oui-border oui-border-line-6"
6058
+ }
6033
6059
  }
6034
- });
6035
- ui.registerSimpleSheet(DepositAndWithdrawWithSheetId, DepositAndWithdraw);
6060
+ );
6061
+ ui.registerSimpleSheet(
6062
+ DepositAndWithdrawWithSheetId,
6063
+ InjectableDepositAndWithdraw
6064
+ );
6036
6065
  var AccountSelect = (props) => {
6037
6066
  const { subAccounts = [], value } = props;
6038
6067
  const [open, setOpen] = react.useState(false);
@@ -7887,6 +7916,7 @@ exports.DepositStatus = DepositStatus;
7887
7916
  exports.DepositStatusWidget = DepositStatusWidget;
7888
7917
  exports.ExchangeDivider = ExchangeDivider;
7889
7918
  exports.Fee = Fee;
7919
+ exports.InjectableDepositAndWithdraw = InjectableDepositAndWithdraw;
7890
7920
  exports.QuantityInput = QuantityInput;
7891
7921
  exports.SwapCoin = SwapCoin;
7892
7922
  exports.TransferDialogId = TransferDialogId;