@lifi/widget 1.17.0 → 1.17.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.
Files changed (77) hide show
  1. package/AppDrawer.d.ts +3 -3
  2. package/cjs/AppDrawer.d.ts +3 -3
  3. package/cjs/components/ChainSelect/ChainSelect.d.ts +0 -1
  4. package/cjs/components/Header/useHeaderActionStore.js +1 -4
  5. package/cjs/components/Step/CircularProgress.d.ts +0 -1
  6. package/cjs/components/SwapButton/ButtonTooltip.d.ts +0 -1
  7. package/cjs/components/SwapInput/SwapInputAdornment.d.ts +0 -1
  8. package/cjs/components/TokenList/TokenList.js +4 -1
  9. package/cjs/config/sentry.js +3 -26
  10. package/cjs/config/version.d.ts +1 -1
  11. package/cjs/config/version.js +1 -1
  12. package/cjs/hooks/useGasSufficiency.js +18 -38
  13. package/cjs/hooks/useRouteExecution.js +22 -9
  14. package/cjs/hooks/useSwapRoutes.js +1 -4
  15. package/cjs/hooks/useTelemetry.js +3 -2
  16. package/cjs/hooks/useTokenBalances.d.ts +1 -1
  17. package/cjs/hooks/useTokenBalances.js +3 -1
  18. package/cjs/hooks/useWidgetEvents.d.ts +3 -3
  19. package/cjs/hooks/useWidgetEvents.js +3 -6
  20. package/cjs/i18n/index.js +2 -5
  21. package/cjs/index.d.ts +2 -1
  22. package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +0 -1
  23. package/cjs/pages/SelectTokenPage/SearchTokenInput.d.ts +0 -1
  24. package/cjs/pages/SelectWalletPage/SelectWalletPage.d.ts +0 -1
  25. package/cjs/pages/SettingsPage/AdvancedPreferences.d.ts +0 -1
  26. package/cjs/pages/SettingsPage/EnabledBridgesSelect.js +1 -4
  27. package/cjs/pages/SettingsPage/EnabledExchangesSelect.js +1 -4
  28. package/cjs/pages/SettingsPage/GasPriceSelect.d.ts +0 -1
  29. package/cjs/pages/SettingsPage/SettingsPage.d.ts +0 -1
  30. package/cjs/pages/SettingsPage/ShowDestinationWallet.d.ts +0 -1
  31. package/cjs/pages/SettingsPage/SlippageInput.d.ts +0 -1
  32. package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +1 -4
  33. package/cjs/pages/SwapRoutesPage/SwapRoutesPage.js +2 -4
  34. package/cjs/providers/SDKProvider/SDKProvider.js +1 -4
  35. package/cjs/stores/chains/useChainOrder.js +1 -4
  36. package/cjs/stores/chains/useChainOrderStore.js +1 -4
  37. package/cjs/stores/route/useExecutingRoutesIds.js +1 -4
  38. package/cjs/stores/route/useRouteStore.js +1 -4
  39. package/cjs/stores/route/useSwapHistory.js +1 -4
  40. package/cjs/stores/route/utils.d.ts +2 -1
  41. package/cjs/stores/route/utils.js +14 -1
  42. package/cjs/stores/settings/useAppearance.js +1 -4
  43. package/cjs/stores/settings/useSettings.js +1 -4
  44. package/cjs/stores/settings/useSettingsStore.js +1 -4
  45. package/cjs/types/events.d.ts +15 -3
  46. package/cjs/types/events.js +4 -3
  47. package/cjs/utils/format.js +1 -4
  48. package/components/ChainSelect/ChainSelect.d.ts +0 -1
  49. package/components/Step/CircularProgress.d.ts +0 -1
  50. package/components/SwapButton/ButtonTooltip.d.ts +0 -1
  51. package/components/SwapInput/SwapInputAdornment.d.ts +0 -1
  52. package/components/TokenList/TokenList.js +4 -1
  53. package/config/version.d.ts +1 -1
  54. package/config/version.js +1 -1
  55. package/hooks/useGasSufficiency.js +19 -36
  56. package/hooks/useRouteExecution.js +22 -6
  57. package/hooks/useTelemetry.js +3 -2
  58. package/hooks/useTokenBalances.d.ts +1 -1
  59. package/hooks/useTokenBalances.js +3 -1
  60. package/hooks/useWidgetEvents.d.ts +3 -3
  61. package/hooks/useWidgetEvents.js +2 -2
  62. package/index.d.ts +2 -1
  63. package/package.json +10 -9
  64. package/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +0 -1
  65. package/pages/SelectTokenPage/SearchTokenInput.d.ts +0 -1
  66. package/pages/SelectWalletPage/SelectWalletPage.d.ts +0 -1
  67. package/pages/SettingsPage/AdvancedPreferences.d.ts +0 -1
  68. package/pages/SettingsPage/GasPriceSelect.d.ts +0 -1
  69. package/pages/SettingsPage/SettingsPage.d.ts +0 -1
  70. package/pages/SettingsPage/ShowDestinationWallet.d.ts +0 -1
  71. package/pages/SettingsPage/SlippageInput.d.ts +0 -1
  72. package/pages/SwapRoutesPage/SwapRoutesPage.js +3 -5
  73. package/stores/route/utils.d.ts +2 -1
  74. package/stores/route/utils.js +12 -0
  75. package/tsconfig.cjs.tsbuildinfo +1 -1
  76. package/types/events.d.ts +15 -3
  77. package/types/events.js +4 -3
package/AppDrawer.d.ts CHANGED
@@ -1,14 +1,14 @@
1
1
  import type { DrawerProps } from '@mui/material';
2
2
  import type { RefObject } from 'react';
3
3
  import type { WidgetConfig } from './types';
4
- export declare type AppDrawerProps = DrawerProps & {
4
+ export declare type WidgetDrawerProps = DrawerProps & {
5
5
  elementRef?: RefObject<HTMLDivElement>;
6
6
  config?: WidgetConfig;
7
7
  };
8
- export interface AppDrawerBase {
8
+ export interface WidgetDrawer {
9
9
  isOpen(): void;
10
10
  toggleDrawer(): void;
11
11
  openDrawer(): void;
12
12
  closeDrawer(): void;
13
13
  }
14
- export declare const AppDrawer: import("react").ForwardRefExoticComponent<Pick<AppDrawerProps, "className" | "style" | "classes" | "slot" | "title" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "children" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "key" | "transitionDuration" | "variant" | "open" | "anchor" | "elementRef" | "components" | "componentsProps" | "BackdropComponent" | "BackdropProps" | "closeAfterTransition" | "container" | "disableAutoFocus" | "disableEnforceFocus" | "disableEscapeKeyDown" | "disablePortal" | "disableRestoreFocus" | "disableScrollLock" | "hideBackdrop" | "keepMounted" | "onBackdropClick" | "onClose" | "config" | "elevation" | "ModalProps" | "PaperProps" | "SlideProps"> & import("react").RefAttributes<AppDrawerBase>>;
14
+ export declare const AppDrawer: import("react").ForwardRefExoticComponent<Pick<WidgetDrawerProps, "className" | "style" | "classes" | "slot" | "title" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "children" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "key" | "transitionDuration" | "variant" | "open" | "anchor" | "elementRef" | "components" | "componentsProps" | "BackdropComponent" | "BackdropProps" | "closeAfterTransition" | "container" | "disableAutoFocus" | "disableEnforceFocus" | "disableEscapeKeyDown" | "disablePortal" | "disableRestoreFocus" | "disableScrollLock" | "hideBackdrop" | "keepMounted" | "onBackdropClick" | "onClose" | "config" | "elevation" | "ModalProps" | "PaperProps" | "SlideProps"> & import("react").RefAttributes<WidgetDrawer>>;
@@ -1,14 +1,14 @@
1
1
  import type { DrawerProps } from '@mui/material';
2
2
  import type { RefObject } from 'react';
3
3
  import type { WidgetConfig } from './types';
4
- export declare type AppDrawerProps = DrawerProps & {
4
+ export declare type WidgetDrawerProps = DrawerProps & {
5
5
  elementRef?: RefObject<HTMLDivElement>;
6
6
  config?: WidgetConfig;
7
7
  };
8
- export interface AppDrawerBase {
8
+ export interface WidgetDrawer {
9
9
  isOpen(): void;
10
10
  toggleDrawer(): void;
11
11
  openDrawer(): void;
12
12
  closeDrawer(): void;
13
13
  }
14
- export declare const AppDrawer: import("react").ForwardRefExoticComponent<Pick<AppDrawerProps, "className" | "style" | "classes" | "slot" | "title" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "children" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "key" | "transitionDuration" | "variant" | "open" | "anchor" | "elementRef" | "components" | "componentsProps" | "BackdropComponent" | "BackdropProps" | "closeAfterTransition" | "container" | "disableAutoFocus" | "disableEnforceFocus" | "disableEscapeKeyDown" | "disablePortal" | "disableRestoreFocus" | "disableScrollLock" | "hideBackdrop" | "keepMounted" | "onBackdropClick" | "onClose" | "config" | "elevation" | "ModalProps" | "PaperProps" | "SlideProps"> & import("react").RefAttributes<AppDrawerBase>>;
14
+ export declare const AppDrawer: import("react").ForwardRefExoticComponent<Pick<WidgetDrawerProps, "className" | "style" | "classes" | "slot" | "title" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "children" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "key" | "transitionDuration" | "variant" | "open" | "anchor" | "elementRef" | "components" | "componentsProps" | "BackdropComponent" | "BackdropProps" | "closeAfterTransition" | "container" | "disableAutoFocus" | "disableEnforceFocus" | "disableEscapeKeyDown" | "disablePortal" | "disableRestoreFocus" | "disableScrollLock" | "hideBackdrop" | "keepMounted" | "onBackdropClick" | "onClose" | "config" | "elevation" | "ModalProps" | "PaperProps" | "SlideProps"> & import("react").RefAttributes<WidgetDrawer>>;
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  import type { SwapFormTypeProps } from '../../providers';
3
2
  export declare const ChainSelect: ({ formType }: SwapFormTypeProps) => JSX.Element;
@@ -1,11 +1,8 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.useHeaderActionStore = void 0;
7
4
  /* eslint-disable no-underscore-dangle */
8
- const zustand_1 = __importDefault(require("zustand"));
5
+ const zustand_1 = require("zustand");
9
6
  const immer_1 = require("zustand/middleware/immer");
10
7
  exports.useHeaderActionStore = (0, zustand_1.default)()((0, immer_1.immer)((set, get) => ({
11
8
  setAction: (element) => {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { Status } from '@lifi/sdk';
3
2
  export declare function CircularProgress({ status }: {
4
3
  status: Status;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const ButtonTooltip: ({ title, children, }: {
3
2
  title?: string | undefined;
4
3
  children: JSX.Element;
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  import type { SwapFormTypeProps } from '../../providers';
3
2
  export declare const SwapInputAdornment: ({ formType }: SwapFormTypeProps) => JSX.Element;
@@ -26,7 +26,10 @@ const TokenList = ({ formType, height, onClick, }) => {
26
26
  token.symbol.toUpperCase().includes(searchFilter) ||
27
27
  token.address.toUpperCase().includes(searchFilter))
28
28
  : filteredTokens;
29
- const tokenSearchEnabled = !filteredTokens.length && !isTokensLoading;
29
+ const tokenSearchEnabled = !isTokensLoading &&
30
+ !!filteredTokens.length &&
31
+ !!tokenSearchFilter &&
32
+ !!selectedChainId;
30
33
  const { token: searchedToken, isLoading: isSearchedTokenLoading } = (0, hooks_1.useTokenSearch)(tokenSearchFilter, selectedChainId, tokenSearchEnabled);
31
34
  const isLoading = isTokensLoading || (tokenSearchEnabled && isSearchedTokenLoading);
32
35
  const tokens = filteredTokens.length
@@ -1,27 +1,4 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -41,9 +18,9 @@ const initSentry = (enabled) => __awaiter(void 0, void 0, void 0, function* () {
41
18
  }
42
19
  if (enabled || sentryLoaded) {
43
20
  const [Sentry, { CaptureConsole }, { BrowserTracing }] = yield Promise.all([
44
- Promise.resolve().then(() => __importStar(require('@sentry/react'))),
45
- Promise.resolve().then(() => __importStar(require('@sentry/integrations'))),
46
- Promise.resolve().then(() => __importStar(require('@sentry/tracing'))),
21
+ Promise.resolve().then(() => require('@sentry/react')),
22
+ Promise.resolve().then(() => require('@sentry/integrations')),
23
+ Promise.resolve().then(() => require('@sentry/tracing')),
47
24
  ]);
48
25
  Sentry.init({
49
26
  dsn: 'https://bc1312161bf948db9b9c82618035ec22@o1302189.ingest.sentry.io/6539228',
@@ -1,2 +1,2 @@
1
1
  export declare const name = "@lifi/widget";
2
- export declare const version = "1.17.0";
2
+ export declare const version = "1.17.2";
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = exports.name = void 0;
4
4
  exports.name = '@lifi/widget';
5
- exports.version = '1.17.0';
5
+ exports.version = '1.17.2';
@@ -8,34 +8,23 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
12
  exports.useGasSufficiency = void 0;
16
- const big_js_1 = __importDefault(require("big.js"));
13
+ const big_js_1 = require("big.js");
17
14
  const react_1 = require("react");
18
- const react_hook_form_1 = require("react-hook-form");
19
15
  const _1 = require(".");
20
16
  const providers_1 = require("../providers");
21
17
  const useTokenBalances_1 = require("./useTokenBalances");
22
18
  const useGasSufficiency = (route) => {
23
19
  const lifi = (0, providers_1.useLiFi)();
24
20
  const { account } = (0, providers_1.useWallet)();
25
- const [fromChainId, toChainId, fromToken] = (0, react_hook_form_1.useWatch)({
26
- name: [
27
- providers_1.SwapFormKeyHelper.getChainKey('from'),
28
- providers_1.SwapFormKeyHelper.getChainKey('to'),
29
- providers_1.SwapFormKey.FromToken,
30
- ],
31
- });
32
- const fromAmount = (0, _1.useDebouncedWatch)(providers_1.SwapFormKey.FromAmount, 250);
33
21
  const { getChainById } = (0, _1.useChains)();
34
- const { tokensWithBalance: fromChainTokenBalances } = (0, useTokenBalances_1.useTokenBalances)(fromChainId);
22
+ const { tokensWithBalance: fromChainTokenBalances } = (0, useTokenBalances_1.useTokenBalances)(route === null || route === void 0 ? void 0 : route.fromChainId);
35
23
  const [insufficientGas, setInsufficientGas] = (0, react_1.useState)();
36
24
  const checkInsufficientGas = (0, react_1.useCallback)(() => __awaiter(void 0, void 0, void 0, function* () {
37
- var _a;
38
- if (!account.isActive || !route || !fromAmount) {
25
+ var _a, _b;
26
+ if (!account.isActive || !route) {
27
+ setInsufficientGas(undefined);
39
28
  return;
40
29
  }
41
30
  const gasCosts = route.steps.reduce((groupedGasCosts, step) => {
@@ -58,18 +47,19 @@ const useGasSufficiency = (route) => {
58
47
  }
59
48
  return groupedGasCosts;
60
49
  }, {});
61
- if (gasCosts[fromChainId] &&
62
- route.fromToken.address === gasCosts[fromChainId].token.address) {
63
- gasCosts[fromChainId].tokenAmount = (_a = gasCosts[fromChainId]) === null || _a === void 0 ? void 0 : _a.gasAmount.plus((0, big_js_1.default)(fromAmount));
50
+ if (route.fromToken.address === ((_a = gasCosts[route.fromChainId]) === null || _a === void 0 ? void 0 : _a.token.address)) {
51
+ gasCosts[route.fromChainId].tokenAmount = (_b = gasCosts[route.fromChainId]) === null || _b === void 0 ? void 0 : _b.gasAmount.plus((0, big_js_1.default)(route.fromAmount).div(Math.pow(10, route.fromToken.decimals)));
64
52
  }
65
53
  const tokenBalances = yield lifi.getTokenBalances(account.address, Object.values(gasCosts).map((item) => item.token));
66
54
  if (!(tokenBalances === null || tokenBalances === void 0 ? void 0 : tokenBalances.length)) {
55
+ setInsufficientGas(undefined);
67
56
  return;
68
57
  }
69
- [fromChainId, toChainId].forEach((chainId) => {
58
+ [route.fromChainId, route.toChainId].forEach((chainId) => {
70
59
  var _a, _b, _c, _d, _e, _f;
71
60
  if (gasCosts[chainId]) {
72
- const gasTokenBalance = (0, big_js_1.default)((_b = (_a = tokenBalances === null || tokenBalances === void 0 ? void 0 : tokenBalances.find((t) => t.address === gasCosts[chainId].token.address)) === null || _a === void 0 ? void 0 : _a.amount) !== null && _b !== void 0 ? _b : 0);
61
+ const gasTokenBalance = (0, big_js_1.default)((_b = (_a = tokenBalances === null || tokenBalances === void 0 ? void 0 : tokenBalances.find((t) => t.chainId === gasCosts[chainId].token.chainId &&
62
+ t.address === gasCosts[chainId].token.address)) === null || _a === void 0 ? void 0 : _a.amount) !== null && _b !== void 0 ? _b : 0);
73
63
  const insufficientFromChainGas = gasTokenBalance.lte(0) ||
74
64
  gasTokenBalance.lt((_c = gasCosts[chainId].gasAmount) !== null && _c !== void 0 ? _c : (0, big_js_1.default)(0)) ||
75
65
  gasTokenBalance.lt((_d = gasCosts[chainId].tokenAmount) !== null && _d !== void 0 ? _d : (0, big_js_1.default)(0));
@@ -81,27 +71,17 @@ const useGasSufficiency = (route) => {
81
71
  });
82
72
  const gasCostResult = Object.values(gasCosts).filter((gasCost) => gasCost.insufficient);
83
73
  setInsufficientGas(gasCostResult);
84
- }), [
85
- account.address,
86
- account.isActive,
87
- fromAmount,
88
- fromChainId,
89
- getChainById,
90
- lifi,
91
- route,
92
- toChainId,
93
- ]);
74
+ }), [account.address, account.isActive, getChainById, lifi, route]);
94
75
  const insufficientFunds = (0, react_1.useMemo)(() => {
95
76
  var _a, _b;
96
- if (!account.isActive ||
97
- !fromToken ||
98
- !fromAmount ||
99
- !fromChainTokenBalances) {
77
+ if (!account.isActive || !fromChainTokenBalances || !route) {
100
78
  return false;
101
79
  }
102
- const balance = (0, big_js_1.default)((_b = (_a = fromChainTokenBalances === null || fromChainTokenBalances === void 0 ? void 0 : fromChainTokenBalances.find((t) => t.address === fromToken)) === null || _a === void 0 ? void 0 : _a.amount) !== null && _b !== void 0 ? _b : 0);
103
- return (0, big_js_1.default)(fromAmount).gt(balance);
104
- }, [account.isActive, fromAmount, fromChainTokenBalances, fromToken]);
80
+ const balance = (0, big_js_1.default)((_b = (_a = fromChainTokenBalances === null || fromChainTokenBalances === void 0 ? void 0 : fromChainTokenBalances.find((t) => t.address === (route === null || route === void 0 ? void 0 : route.fromToken.address))) === null || _a === void 0 ? void 0 : _a.amount) !== null && _b !== void 0 ? _b : 0);
81
+ return (0, big_js_1.default)(route.fromAmount)
82
+ .div(Math.pow(10, route.fromToken.decimals))
83
+ .gt(balance);
84
+ }, [account.isActive, fromChainTokenBalances, route]);
105
85
  (0, react_1.useEffect)(() => {
106
86
  checkInsufficientGas();
107
87
  }, [checkInsufficientGas]);
@@ -8,14 +8,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
12
  exports.useRouteExecution = void 0;
16
13
  const react_query_1 = require("@tanstack/react-query");
17
14
  const react_1 = require("react");
18
- const shallow_1 = __importDefault(require("zustand/shallow"));
15
+ const shallow_1 = require("zustand/shallow");
19
16
  const providers_1 = require("../providers");
20
17
  const stores_1 = require("../stores");
21
18
  const events_1 = require("../types/events");
@@ -29,15 +26,29 @@ const useRouteExecution = (routeId, executeInBackground) => {
29
26
  const routeExecution = (0, stores_1.useRouteStore)((state) => state.routes[routeId]);
30
27
  const [updateRoute, restartRoute, deleteRoute] = (0, stores_1.useRouteStore)((state) => [state.updateRoute, state.restartRoute, state.deleteRoute], shallow_1.default);
31
28
  const updateCallback = (updatedRoute) => {
29
+ const routeExecution = stores_1.useRouteStore.getState().routes[updatedRoute.id];
30
+ if (!routeExecution) {
31
+ return;
32
+ }
32
33
  const clonedUpdatedRoute = (0, utils_1.deepClone)(updatedRoute);
33
- console.log('Route updated.', clonedUpdatedRoute);
34
34
  updateRoute(clonedUpdatedRoute);
35
+ const process = (0, stores_1.getUpdatedProcess)(routeExecution.route, clonedUpdatedRoute);
36
+ if (process) {
37
+ emitter.emit(events_1.WidgetEvent.RouteExecutionUpdated, {
38
+ route: clonedUpdatedRoute,
39
+ process,
40
+ });
41
+ }
35
42
  if ((0, stores_1.isRouteCompleted)(clonedUpdatedRoute)) {
36
- emitter.emit(events_1.WidgetEvent.SwapCompleted);
43
+ emitter.emit(events_1.WidgetEvent.RouteExecutionCompleted, clonedUpdatedRoute);
37
44
  }
38
- if ((0, stores_1.isRouteFailed)(clonedUpdatedRoute)) {
39
- emitter.emit(events_1.WidgetEvent.SwapFailed);
45
+ if ((0, stores_1.isRouteFailed)(clonedUpdatedRoute) && process) {
46
+ emitter.emit(events_1.WidgetEvent.RouteExecutionFailed, {
47
+ route: clonedUpdatedRoute,
48
+ process,
49
+ });
40
50
  }
51
+ console.log('Route updated.', clonedUpdatedRoute);
41
52
  };
42
53
  const switchChainHook = (requiredChainId) => __awaiter(void 0, void 0, void 0, function* () {
43
54
  if (!account.isActive || !account.signer) {
@@ -68,7 +79,9 @@ const useRouteExecution = (routeId, executeInBackground) => {
68
79
  }, {
69
80
  onMutate: () => {
70
81
  console.log('Execution started.', routeId);
71
- emitter.emit(events_1.WidgetEvent.SwapStarted);
82
+ if (routeExecution) {
83
+ emitter.emit(events_1.WidgetEvent.RouteExecutionStarted, routeExecution.route);
84
+ }
72
85
  },
73
86
  });
74
87
  const resumeRouteMutation = (0, react_query_1.useMutation)((resumedRoute) => {
@@ -8,14 +8,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
12
  exports.useSwapRoutes = void 0;
16
13
  const address_1 = require("@ethersproject/address");
17
14
  const react_query_1 = require("@tanstack/react-query");
18
- const big_js_1 = __importDefault(require("big.js"));
15
+ const big_js_1 = require("big.js");
19
16
  const react_hook_form_1 = require("react-hook-form");
20
17
  const _1 = require(".");
21
18
  const providers_1 = require("../providers");
@@ -4,11 +4,12 @@ exports.useTelemetry = void 0;
4
4
  /* eslint-disable consistent-return */
5
5
  const react_1 = require("react");
6
6
  const sentry_1 = require("../config/sentry");
7
+ const version_1 = require("../config/version");
7
8
  const useTelemetry = (disabled) => {
8
9
  (0, react_1.useEffect)(() => {
9
10
  if (disabled) {
10
- if (process.env.NODE_ENV === 'production') {
11
- console.warn('Enable crash reports and diagnostic data to be collected. This helps us to better understand how the widget is performing and where improvements need to be made.');
11
+ if (process.env.NODE_ENV === 'development') {
12
+ console.warn(`[${version_1.name}] Enable crash reports and diagnostic data to be collected. This helps us to better understand how the widget is performing and where improvements need to be made.`);
12
13
  }
13
14
  }
14
15
  else {
@@ -1,5 +1,5 @@
1
1
  import type { Token } from '../types';
2
- export declare const useTokenBalances: (selectedChainId: number) => {
2
+ export declare const useTokenBalances: (selectedChainId?: number) => {
3
3
  tokens: Token[] | undefined;
4
4
  tokensWithBalance: Token[] | undefined;
5
5
  featuredTokens: import("@lifi/types").Token[];
@@ -25,7 +25,9 @@ const useTokenBalances = (selectedChainId) => {
25
25
  const featuredTokens = (0, useFeaturedTokens_1.useFeaturedTokens)(selectedChainId);
26
26
  const { tokens, isLoading } = (0, useTokens_1.useTokens)(selectedChainId);
27
27
  const [refetchInterval, setRefetchInterval] = (0, react_1.useState)(defaultRefetchInterval);
28
- const isBalanceLoadingEnabled = Boolean(account.address) && Boolean(tokens === null || tokens === void 0 ? void 0 : tokens.length);
28
+ const isBalanceLoadingEnabled = Boolean(account.address) &&
29
+ Boolean(tokens === null || tokens === void 0 ? void 0 : tokens.length) &&
30
+ Boolean(selectedChainId);
29
31
  const { data: tokensWithBalance, isLoading: isBalanceLoading, refetch, } = (0, react_query_1.useQuery)(['token-balances', account.address, selectedChainId, tokens === null || tokens === void 0 ? void 0 : tokens.length], ({ queryKey: [, accountAddress] }) => __awaiter(void 0, void 0, void 0, function* () {
30
32
  if (!accountAddress || !tokens) {
31
33
  return;
@@ -1,3 +1,3 @@
1
- /// <reference types="node" />
2
- import { EventEmitter } from 'events';
3
- export declare const useWidgetEvents: () => EventEmitter;
1
+ import type { Emitter } from 'mitt';
2
+ import type { WidgetEvents } from '../types';
3
+ export declare const useWidgetEvents: () => Emitter<WidgetEvents>;
@@ -1,12 +1,9 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.useWidgetEvents = void 0;
7
- const events_1 = require("events");
8
- const zustand_1 = __importDefault(require("zustand"));
9
- const emitterStore = (0, zustand_1.default)()(() => new events_1.EventEmitter());
4
+ const mitt_1 = require("mitt");
5
+ const zustand_1 = require("zustand");
6
+ const emitterStore = (0, zustand_1.default)()(() => (0, mitt_1.default)());
10
7
  const useWidgetEvents = () => {
11
8
  return emitterStore();
12
9
  };
package/cjs/i18n/index.js CHANGED
@@ -1,12 +1,9 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.configureReactI18next = exports.resources = exports.defaultNS = void 0;
7
- const i18next_1 = __importDefault(require("i18next"));
4
+ const i18next_1 = require("i18next");
8
5
  const react_i18next_1 = require("react-i18next");
9
- const translation_json_1 = __importDefault(require("./en/translation.json"));
6
+ const translation_json_1 = require("./en/translation.json");
10
7
  exports.defaultNS = 'translation';
11
8
  exports.resources = {
12
9
  en: {
package/cjs/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import './fonts/inter.css';
3
+ export type { WidgetDrawer, WidgetDrawerProps } from './AppDrawer';
3
4
  export { useWidgetEvents } from './hooks';
4
5
  export * from './types';
5
6
  export declare const LiFiWidget: import("react").FC<import("./AppProvider").AppProps>;
6
- export declare const LiFiWidgetDrawer: import("react").ForwardRefExoticComponent<Pick<import("./AppDrawer").AppDrawerProps, "className" | "style" | "classes" | "slot" | "title" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "children" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "key" | "transitionDuration" | "variant" | "open" | "anchor" | "elementRef" | "components" | "componentsProps" | "BackdropComponent" | "BackdropProps" | "closeAfterTransition" | "container" | "disableAutoFocus" | "disableEnforceFocus" | "disableEscapeKeyDown" | "disablePortal" | "disableRestoreFocus" | "disableScrollLock" | "hideBackdrop" | "keepMounted" | "onBackdropClick" | "onClose" | "config" | "elevation" | "ModalProps" | "PaperProps" | "SlideProps"> & import("react").RefAttributes<import("./AppDrawer").AppDrawerBase>>;
7
+ export declare const LiFiWidgetDrawer: import("react").ForwardRefExoticComponent<Pick<import("./AppDrawer").WidgetDrawerProps, "className" | "style" | "classes" | "slot" | "title" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "children" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "key" | "transitionDuration" | "variant" | "open" | "anchor" | "elementRef" | "components" | "componentsProps" | "BackdropComponent" | "BackdropProps" | "closeAfterTransition" | "container" | "disableAutoFocus" | "disableEnforceFocus" | "disableEscapeKeyDown" | "disablePortal" | "disableRestoreFocus" | "disableScrollLock" | "hideBackdrop" | "keepMounted" | "onBackdropClick" | "onClose" | "config" | "elevation" | "ModalProps" | "PaperProps" | "SlideProps"> & import("react").RefAttributes<import("./AppDrawer").WidgetDrawer>>;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const ActiveSwapsPage: () => JSX.Element;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const SearchTokenInput: () => JSX.Element;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const SelectWalletPage: () => JSX.Element;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const AdvancedPreferences: () => JSX.Element;
@@ -1,14 +1,11 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.EnabledBridgesSelect = void 0;
7
4
  const jsx_runtime_1 = require("react/jsx-runtime");
8
5
  const icons_material_1 = require("@mui/icons-material");
9
6
  const material_1 = require("@mui/material");
10
7
  const react_i18next_1 = require("react-i18next");
11
- const shallow_1 = __importDefault(require("zustand/shallow"));
8
+ const shallow_1 = require("zustand/shallow");
12
9
  const Card_1 = require("../../components/Card");
13
10
  const Select_1 = require("../../components/Select");
14
11
  const hooks_1 = require("../../hooks");
@@ -1,14 +1,11 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.EnabledExchangesSelect = void 0;
7
4
  const jsx_runtime_1 = require("react/jsx-runtime");
8
5
  const icons_material_1 = require("@mui/icons-material");
9
6
  const material_1 = require("@mui/material");
10
7
  const react_i18next_1 = require("react-i18next");
11
- const shallow_1 = __importDefault(require("zustand/shallow"));
8
+ const shallow_1 = require("zustand/shallow");
12
9
  const Card_1 = require("../../components/Card");
13
10
  const Select_1 = require("../../components/Select");
14
11
  const hooks_1 = require("../../hooks");
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const GasPriceSelect: () => JSX.Element;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const SettingsPage: () => JSX.Element;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const ShowDestinationWallet: () => JSX.Element;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const SlippageInput: () => JSX.Element;
@@ -8,9 +8,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
12
  exports.SwapDetailsPage = void 0;
16
13
  const jsx_runtime_1 = require("react/jsx-runtime");
@@ -19,7 +16,7 @@ const material_1 = require("@mui/material");
19
16
  const react_1 = require("react");
20
17
  const react_i18next_1 = require("react-i18next");
21
18
  const react_router_dom_1 = require("react-router-dom");
22
- const shallow_1 = __importDefault(require("zustand/shallow"));
19
+ const shallow_1 = require("zustand/shallow");
23
20
  const Card_1 = require("../../components/Card");
24
21
  const Dialog_1 = require("../../components/Dialog");
25
22
  const Header_1 = require("../../components/Header");