@onepercentio/one-ui 0.1.7 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__test__/analytics.d.ts +3 -3
- package/dist/__test__/analytics.js +18 -18
- package/dist/__test__/firestore.d.ts +2 -1
- package/dist/__test__/firestore.js +25 -19
- package/dist/__test__/firestore.js.map +1 -1
- package/dist/__test__/utils.d.ts +17 -17
- package/dist/__test__/utils.js +187 -182
- package/dist/__test__/utils.js.map +1 -1
- package/dist/components/AdaptiveButton/AdaptiveButton.d.ts +8 -8
- package/dist/components/AdaptiveButton/AdaptiveButton.js +84 -84
- package/dist/components/AdaptiveButton/AdaptiveButton.js.map +1 -1
- package/dist/components/AdaptiveButton/AdaptiveButton.stories.d.ts +18 -18
- package/dist/components/AdaptiveButton/AdaptiveButton.stories.js +81 -81
- package/dist/components/AdaptiveButton/index.d.ts +1 -1
- package/dist/components/AdaptiveButton/index.js +8 -8
- package/dist/components/AdaptiveDialog/AdaptiveDialog.d.ts +9 -9
- package/dist/components/AdaptiveDialog/AdaptiveDialog.js +59 -89
- package/dist/components/AdaptiveDialog/AdaptiveDialog.js.map +1 -1
- package/dist/components/AdaptiveDialog/AdaptiveDialog.stories.d.ts +19 -19
- package/dist/components/AdaptiveDialog/AdaptiveDialog.stories.js +93 -93
- package/dist/components/AdaptiveDialog/AdaptiveDialog.test.d.ts +1 -1
- package/dist/components/AdaptiveDialog/AdaptiveDialog.test.js +14 -14
- package/dist/components/AdaptiveDialog/index.d.ts +1 -1
- package/dist/components/AdaptiveDialog/index.js +8 -8
- package/dist/components/AdaptiveSidebar/AdaptiveSidebar.d.ts +10 -7
- package/dist/components/AdaptiveSidebar/AdaptiveSidebar.js +69 -64
- package/dist/components/AdaptiveSidebar/AdaptiveSidebar.js.map +1 -1
- package/dist/components/AdaptiveSidebar/AdaptiveSidebar.module.scss +4 -2
- package/dist/components/AdaptiveSidebar/AdaptiveSidebar.stories.d.ts +18 -15
- package/dist/components/AdaptiveSidebar/AdaptiveSidebar.stories.js +20 -20
- package/dist/components/AdaptiveSidebar/index.d.ts +1 -1
- package/dist/components/AdaptiveSidebar/index.js +8 -8
- package/dist/components/AnchoredTooltip/AnchoredTooltip.d.ts +13 -13
- package/dist/components/AnchoredTooltip/AnchoredTooltip.js +173 -171
- package/dist/components/AnchoredTooltip/AnchoredTooltip.js.map +1 -1
- package/dist/components/AnchoredTooltip/AnchoredTooltip.stories.d.ts +16 -16
- package/dist/components/AnchoredTooltip/AnchoredTooltip.stories.js +85 -85
- package/dist/components/AnchoredTooltip/AnchoredTooltip.test.d.ts +1 -1
- package/dist/components/AnchoredTooltip/AnchoredTooltip.test.js +19 -19
- package/dist/components/AnchoredTooltip/index.d.ts +1 -1
- package/dist/components/AnchoredTooltip/index.js +8 -8
- package/dist/components/AsyncWrapper/AsyncWrapper.d.ts +10 -10
- package/dist/components/AsyncWrapper/AsyncWrapper.js +24 -24
- package/dist/components/AsyncWrapper/AsyncWrapper.stories.d.ts +18 -18
- package/dist/components/AsyncWrapper/AsyncWrapper.stories.js +33 -33
- package/dist/components/AsyncWrapper/AsyncWrapper.test.d.ts +1 -1
- package/dist/components/AsyncWrapper/AsyncWrapper.test.js +18 -18
- package/dist/components/AsyncWrapper/index.d.ts +1 -1
- package/dist/components/AsyncWrapper/index.js +8 -8
- package/dist/components/Avatar/Avatar.d.ts +8 -8
- package/dist/components/Avatar/Avatar.js +44 -44
- package/dist/components/Avatar/Avatar.stories.d.ts +14 -14
- package/dist/components/Avatar/Avatar.stories.js +18 -18
- package/dist/components/Avatar/Avatar.test.d.ts +1 -1
- package/dist/components/Avatar/Avatar.test.js +35 -35
- package/dist/components/Avatar/index.d.ts +1 -1
- package/dist/components/Avatar/index.js +8 -8
- package/dist/components/Button/Button.d.ts +7 -7
- package/dist/components/Button/Button.js +49 -49
- package/dist/components/Button/Button.stories.d.ts +13 -13
- package/dist/components/Button/Button.stories.js +33 -33
- package/dist/components/Button/Button.test.d.ts +1 -1
- package/dist/components/Button/Button.test.js +14 -14
- package/dist/components/Button/index.d.ts +1 -1
- package/dist/components/Button/index.js +8 -8
- package/dist/components/Card/Card.d.ts +7 -7
- package/dist/components/Card/Card.js +14 -14
- package/dist/components/Card/Card.stories.d.ts +15 -15
- package/dist/components/Card/Card.stories.js +15 -15
- package/dist/components/Card/index.d.ts +1 -1
- package/dist/components/Card/index.js +8 -8
- package/dist/components/CheckBox/CheckBox.d.ts +11 -11
- package/dist/components/CheckBox/CheckBox.js +31 -31
- package/dist/components/CheckBox/CheckBox.stories.d.ts +20 -20
- package/dist/components/CheckBox/CheckBox.stories.js +29 -29
- package/dist/components/CheckBox/index.d.ts +1 -1
- package/dist/components/CheckBox/index.js +8 -8
- package/dist/components/Collapsable/Collapsable.d.ts +33 -33
- package/dist/components/Collapsable/Collapsable.js +128 -128
- package/dist/components/Collapsable/Collapsable.stories.d.ts +39 -39
- package/dist/components/Collapsable/Collapsable.stories.js +27 -27
- package/dist/components/Collapsable/index.d.ts +1 -1
- package/dist/components/Collapsable/index.js +8 -8
- package/dist/components/Countdown/Countdown.d.ts +13 -13
- package/dist/components/Countdown/Countdown.js +79 -79
- package/dist/components/Countdown/Countdown.stories.d.ts +14 -14
- package/dist/components/Countdown/Countdown.stories.js +31 -31
- package/dist/components/Countdown/index.d.ts +1 -1
- package/dist/components/Countdown/index.js +8 -8
- package/dist/components/Divider/Divider.d.ts +6 -6
- package/dist/components/Divider/Divider.js +15 -15
- package/dist/components/Divider/Divider.stories.d.ts +7 -7
- package/dist/components/Divider/Divider.stories.js +14 -14
- package/dist/components/Divider/index.d.ts +1 -1
- package/dist/components/Divider/index.js +8 -8
- package/dist/components/EmailInput/EmailInput.d.ts +23 -23
- package/dist/components/EmailInput/EmailInput.js +51 -51
- package/dist/components/EmailInput/EmailInput.stories.d.ts +26 -26
- package/dist/components/EmailInput/EmailInput.stories.js +14 -14
- package/dist/components/EmailInput/EmailInput.test.d.ts +1 -1
- package/dist/components/EmailInput/EmailInput.test.js +76 -76
- package/dist/components/EmailInput/index.d.ts +1 -1
- package/dist/components/EmailInput/index.js +9 -9
- package/dist/components/FadeIn/FadeIn.d.ts +10 -10
- package/dist/components/FadeIn/FadeIn.js +63 -63
- package/dist/components/FadeIn/FadeIn.stories.d.ts +24 -24
- package/dist/components/FadeIn/FadeIn.stories.js +15 -15
- package/dist/components/FadeIn/FadeIn.test.d.ts +1 -1
- package/dist/components/FadeIn/FadeIn.test.js +21 -21
- package/dist/components/FadeIn/index.d.ts +1 -1
- package/dist/components/FadeIn/index.js +8 -8
- package/dist/components/FileInput/FileInput.d.ts +13 -13
- package/dist/components/FileInput/FileInput.js +74 -74
- package/dist/components/FileInput/FileInput.stories.d.ts +19 -19
- package/dist/components/FileInput/FileInput.stories.js +58 -58
- package/dist/components/FileInput/index.d.ts +1 -1
- package/dist/components/FileInput/index.js +8 -8
- package/dist/components/FlowController/FlowController.d.ts +23 -23
- package/dist/components/FlowController/FlowController.js +33 -33
- package/dist/components/FlowController/FlowController.stories.d.ts +43 -43
- package/dist/components/FlowController/FlowController.stories.js +100 -100
- package/dist/components/FlowController/FlowController.test.d.ts +1 -1
- package/dist/components/FlowController/FlowController.test.js +165 -165
- package/dist/components/FlowController/index.d.ts +1 -1
- package/dist/components/FlowController/index.js +8 -8
- package/dist/components/Form/Form.d.ts +40 -40
- package/dist/components/Form/Form.js +91 -91
- package/dist/components/Form/index.d.ts +1 -1
- package/dist/components/Form/index.js +8 -8
- package/dist/components/Freeze/Freeze.d.ts +5 -5
- package/dist/components/Freeze/Freeze.js +12 -12
- package/dist/components/Freeze/Freeze.stories.d.ts +7 -7
- package/dist/components/Freeze/Freeze.stories.js +55 -55
- package/dist/components/Freeze/Freeze.test.d.ts +1 -1
- package/dist/components/Freeze/Freeze.test.js +14 -14
- package/dist/components/Freeze/index.d.ts +1 -1
- package/dist/components/Freeze/index.js +8 -8
- package/dist/components/HSForms/HSForms.d.ts +5 -5
- package/dist/components/HSForms/HSForms.js +46 -46
- package/dist/components/HSForms/index.d.ts +1 -1
- package/dist/components/HSForms/index.js +8 -8
- package/dist/components/Header/Header.d.ts +25 -25
- package/dist/components/Header/Header.js +74 -74
- package/dist/components/Header/Header.stories.d.ts +28 -28
- package/dist/components/Header/Header.stories.js +40 -40
- package/dist/components/Header/Header.test.d.ts +1 -1
- package/dist/components/Header/Header.test.js +99 -99
- package/dist/components/Header/index.d.ts +1 -1
- package/dist/components/Header/index.js +8 -8
- package/dist/components/HeaderCloseBtn/HeaderCloseBtn.d.ts +8 -8
- package/dist/components/HeaderCloseBtn/HeaderCloseBtn.js +16 -16
- package/dist/components/HeaderCloseBtn/HeaderCloseBtn.stories.d.ts +14 -14
- package/dist/components/HeaderCloseBtn/HeaderCloseBtn.stories.js +15 -15
- package/dist/components/HeaderCloseBtn/index.d.ts +1 -1
- package/dist/components/HeaderCloseBtn/index.js +8 -8
- package/dist/components/InfinityScroll/InfinityScroll.d.ts +11 -11
- package/dist/components/InfinityScroll/InfinityScroll.js +111 -111
- package/dist/components/InfinityScroll/InfinityScroll.stories.d.ts +23 -23
- package/dist/components/InfinityScroll/InfinityScroll.stories.js +53 -53
- package/dist/components/InfinityScroll/InfinityScroll.test.d.ts +1 -1
- package/dist/components/InfinityScroll/InfinityScroll.test.js +188 -188
- package/dist/components/InfinityScroll/index.d.ts +1 -1
- package/dist/components/InfinityScroll/index.js +8 -8
- package/dist/components/Input/Input.d.ts +30 -30
- package/dist/components/Input/Input.js +93 -93
- package/dist/components/Input/Input.stories.d.ts +22 -22
- package/dist/components/Input/Input.stories.js +20 -20
- package/dist/components/Input/Input.test.d.ts +1 -1
- package/dist/components/Input/Input.test.js +57 -57
- package/dist/components/Input/index.d.ts +1 -1
- package/dist/components/Input/index.js +8 -8
- package/dist/components/InstantCounter/InstantCounter.d.ts +13 -13
- package/dist/components/InstantCounter/InstantCounter.js +58 -58
- package/dist/components/InstantCounter/InstantCounter.stories.d.ts +28 -28
- package/dist/components/InstantCounter/InstantCounter.stories.js +15 -15
- package/dist/components/InstantCounter/InstantCounter.test.d.ts +1 -1
- package/dist/components/InstantCounter/InstantCounter.test.js +49 -49
- package/dist/components/InstantCounter/index.d.ts +1 -1
- package/dist/components/InstantCounter/index.js +8 -8
- package/dist/components/LinkToId/LinkToId.d.ts +10 -10
- package/dist/components/LinkToId/LinkToId.js +32 -32
- package/dist/components/LinkToId/LinkToId.test.d.ts +1 -1
- package/dist/components/LinkToId/LinkToId.test.js +11 -11
- package/dist/components/LinkToId/index.d.ts +1 -1
- package/dist/components/LinkToId/index.js +9 -9
- package/dist/components/Loader/Loader.d.ts +6 -6
- package/dist/components/Loader/Loader.js +17 -17
- package/dist/components/Loader/Loader.stories.d.ts +12 -12
- package/dist/components/Loader/Loader.stories.js +15 -15
- package/dist/components/Loader/index.d.ts +1 -1
- package/dist/components/Loader/index.js +8 -8
- package/dist/components/LoaderDotsIndicator/LoaderDotsIndicator.d.ts +6 -6
- package/dist/components/LoaderDotsIndicator/LoaderDotsIndicator.js +41 -41
- package/dist/components/LoaderDotsIndicator/index.d.ts +1 -1
- package/dist/components/LoaderDotsIndicator/index.js +8 -8
- package/dist/components/MainGrid/MainGrid.d.ts +10 -10
- package/dist/components/MainGrid/MainGrid.js +55 -55
- package/dist/components/MainGrid/MainGrid.stories.d.ts +14 -14
- package/dist/components/MainGrid/MainGrid.stories.js +69 -69
- package/dist/components/MainGrid/MainGrid.test.d.ts +1 -1
- package/dist/components/MainGrid/MainGrid.test.js +17 -17
- package/dist/components/MainGrid/index.d.ts +1 -1
- package/dist/components/MainGrid/index.js +8 -8
- package/dist/components/MutableHamburgerButton/MutableHamburgerButton.d.ts +8 -8
- package/dist/components/MutableHamburgerButton/MutableHamburgerButton.js +29 -29
- package/dist/components/MutableHamburgerButton/MutableHamburgerButton.module.scss +23 -0
- package/dist/components/MutableHamburgerButton/MutableHamburgerButton.stories.d.ts +14 -14
- package/dist/components/MutableHamburgerButton/MutableHamburgerButton.stories.js +15 -15
- package/dist/components/MutableHamburgerButton/index.d.ts +1 -1
- package/dist/components/MutableHamburgerButton/index.js +8 -8
- package/dist/components/Notification/Notification.d.ts +7 -7
- package/dist/components/Notification/Notification.js +15 -15
- package/dist/components/Notification/Notification.stories.d.ts +15 -15
- package/dist/components/Notification/Notification.stories.js +18 -18
- package/dist/components/Notification/index.d.ts +1 -1
- package/dist/components/Notification/index.js +8 -8
- package/dist/components/Parallax/Parallax.d.ts +15 -15
- package/dist/components/Parallax/Parallax.js +174 -174
- package/dist/components/Parallax/Parallax.stories.d.ts +32 -32
- package/dist/components/Parallax/Parallax.stories.js +22 -22
- package/dist/components/Parallax/Parallax.test.d.ts +1 -1
- package/dist/components/Parallax/Parallax.test.js +21 -21
- package/dist/components/Parallax/index.d.ts +1 -1
- package/dist/components/Parallax/index.js +8 -8
- package/dist/components/Parallax/math/helpers.d.ts +58 -58
- package/dist/components/Parallax/math/helpers.js +228 -228
- package/dist/components/PasswordInput/PasswordInput.d.ts +40 -40
- package/dist/components/PasswordInput/PasswordInput.js +105 -105
- package/dist/components/PasswordInput/PasswordInput.test.d.ts +1 -1
- package/dist/components/PasswordInput/PasswordInput.test.js +156 -156
- package/dist/components/PasswordInput/index.d.ts +1 -1
- package/dist/components/PasswordInput/index.js +8 -8
- package/dist/components/PixelatedScan/PixelatedScan.d.ts +8 -8
- package/dist/components/PixelatedScan/PixelatedScan.js +104 -104
- package/dist/components/PixelatedScan/PixelatedScan.stories.d.ts +15 -15
- package/dist/components/PixelatedScan/PixelatedScan.stories.js +39 -39
- package/dist/components/PixelatedScan/index.d.ts +1 -1
- package/dist/components/PixelatedScan/index.js +8 -8
- package/dist/components/ProgressTexts/ProgressTexts.d.ts +22 -22
- package/dist/components/ProgressTexts/ProgressTexts.js +37 -37
- package/dist/components/ProgressTexts/ProgressTexts.stories.d.ts +24 -24
- package/dist/components/ProgressTexts/ProgressTexts.stories.js +89 -89
- package/dist/components/ProgressTexts/ProgressTexts.test.d.ts +1 -1
- package/dist/components/ProgressTexts/ProgressTexts.test.js +51 -51
- package/dist/components/ProgressTexts/index.d.ts +1 -1
- package/dist/components/ProgressTexts/index.js +8 -8
- package/dist/components/SectionContainer/SectionContainer.d.ts +11 -11
- package/dist/components/SectionContainer/SectionContainer.js +45 -45
- package/dist/components/SectionContainer/index.d.ts +1 -1
- package/dist/components/SectionContainer/index.js +8 -8
- package/dist/components/Select/Select.d.ts +22 -22
- package/dist/components/Select/Select.js +75 -75
- package/dist/components/Select/Select.stories.d.ts +52 -52
- package/dist/components/Select/Select.stories.js +33 -33
- package/dist/components/Select/Select.test.d.ts +1 -1
- package/dist/components/Select/Select.test.js +11 -11
- package/dist/components/Select/index.d.ts +1 -1
- package/dist/components/Select/index.js +8 -8
- package/dist/components/Spacing/Spacing.d.ts +6 -6
- package/dist/components/Spacing/Spacing.js +14 -14
- package/dist/components/Spacing/Spacing.stories.d.ts +7 -7
- package/dist/components/Spacing/Spacing.stories.js +34 -34
- package/dist/components/Spacing/index.d.ts +1 -1
- package/dist/components/Spacing/index.js +8 -8
- package/dist/components/Table/Table.d.ts +19 -19
- package/dist/components/Table/Table.js +87 -87
- package/dist/components/Table/Table.stories.d.ts +15 -15
- package/dist/components/Table/Table.stories.js +87 -87
- package/dist/components/Table/Table.test.d.ts +1 -1
- package/dist/components/Table/Table.test.js +34 -34
- package/dist/components/Table/index.d.ts +1 -1
- package/dist/components/Table/index.js +8 -8
- package/dist/components/Tabs/Tabs.d.ts +11 -11
- package/dist/components/Tabs/Tabs.js +48 -48
- package/dist/components/Tabs/Tabs.test.d.ts +1 -1
- package/dist/components/Tabs/Tabs.test.js +38 -38
- package/dist/components/Tabs/index.d.ts +1 -1
- package/dist/components/Tabs/index.js +8 -8
- package/dist/components/Text/Text.d.ts +8 -8
- package/dist/components/Text/Text.js +51 -51
- package/dist/components/Text/Text.stories.d.ts +12 -12
- package/dist/components/Text/Text.stories.js +19 -19
- package/dist/components/Text/Text.test.d.ts +1 -1
- package/dist/components/Text/Text.test.js +11 -11
- package/dist/components/Text/index.d.ts +1 -1
- package/dist/components/Text/index.js +8 -8
- package/dist/components/Transition/Transition.d.ts +44 -44
- package/dist/components/Transition/Transition.js +226 -226
- package/dist/components/Transition/Transition.stories.d.ts +10 -10
- package/dist/components/Transition/Transition.stories.js +28 -28
- package/dist/components/Transition/Transition.test.d.ts +1 -1
- package/dist/components/Transition/Transition.test.js +54 -54
- package/dist/components/Transition/index.d.ts +1 -1
- package/dist/components/Transition/index.js +9 -9
- package/dist/components/UncontrolledTransition/UncontrolledTransition.d.ts +12 -12
- package/dist/components/UncontrolledTransition/UncontrolledTransition.js +95 -95
- package/dist/components/UncontrolledTransition/UncontrolledTransition.stories.d.ts +30 -30
- package/dist/components/UncontrolledTransition/UncontrolledTransition.stories.js +183 -183
- package/dist/components/UncontrolledTransition/UncontrolledTransition.test.d.ts +1 -1
- package/dist/components/UncontrolledTransition/UncontrolledTransition.test.js +134 -134
- package/dist/components/UncontrolledTransition/index.d.ts +1 -1
- package/dist/components/UncontrolledTransition/index.js +8 -8
- package/dist/components/WalletConnectionWrapper/WalletConnectionWrapper.d.ts +52 -35
- package/dist/components/WalletConnectionWrapper/WalletConnectionWrapper.js +121 -89
- package/dist/components/WalletConnectionWrapper/WalletConnectionWrapper.js.map +1 -1
- package/dist/components/WalletConnectionWrapper/WalletConnectionWrapper.stories.d.ts +70 -47
- package/dist/components/WalletConnectionWrapper/WalletConnectionWrapper.stories.js +64 -55
- package/dist/components/WalletConnectionWrapper/WalletConnectionWrapper.stories.js.map +1 -1
- package/dist/components/WalletConnectionWrapper/WalletConnectionWrapper.test.d.ts +1 -1
- package/dist/components/WalletConnectionWrapper/WalletConnectionWrapper.test.js +136 -136
- package/dist/components/WalletConnectionWrapper/index.d.ts +1 -1
- package/dist/components/WalletConnectionWrapper/index.js +9 -8
- package/dist/components/WalletConnectionWrapper/index.js.map +1 -1
- package/dist/components/WalletConnectionWrapper/v2/WalletConnectionWrapper.d.ts +40 -0
- package/dist/components/WalletConnectionWrapper/v2/WalletConnectionWrapper.js +130 -0
- package/dist/components/WalletConnectionWrapper/v2/WalletConnectionWrapper.js.map +1 -0
- package/dist/components/WalletConnectionWrapper/v2/WalletConnectionWrapper.stories.d.ts +59 -0
- package/dist/components/WalletConnectionWrapper/v2/WalletConnectionWrapper.stories.js +62 -0
- package/dist/components/WalletConnectionWrapper/v2/WalletConnectionWrapper.stories.js.map +1 -0
- package/dist/components/WalletConnectionWrapper/v2/index.d.ts +1 -0
- package/dist/components/WalletConnectionWrapper/v2/index.js +9 -0
- package/dist/components/WalletConnectionWrapper/v2/index.js.map +1 -0
- package/dist/components/WalletConnectionWrapper/v2/rLoginConfig.d.ts +6 -0
- package/dist/components/WalletConnectionWrapper/v2/rLoginConfig.js +52 -0
- package/dist/components/WalletConnectionWrapper/v2/rLoginConfig.js.map +1 -0
- package/dist/components/utilitary/ScrollAndFocusLock/ScrollAndFocusLock.d.ts +7 -0
- package/dist/components/utilitary/ScrollAndFocusLock/ScrollAndFocusLock.js +71 -0
- package/dist/components/utilitary/ScrollAndFocusLock/ScrollAndFocusLock.js.map +1 -0
- package/dist/components/utilitary/ScrollAndFocusLock/index.d.ts +1 -0
- package/dist/components/utilitary/ScrollAndFocusLock/index.js +9 -0
- package/dist/components/utilitary/ScrollAndFocusLock/index.js.map +1 -0
- package/dist/context/OneUIProvider.d.ts +67 -64
- package/dist/context/OneUIProvider.js +63 -63
- package/dist/context/OneUIProvider.js.map +1 -1
- package/dist/context/OneUIProvider.test.d.ts +1 -1
- package/dist/context/OneUIProvider.test.js +44 -44
- package/dist/context/__mocks__/OneUIProvider.d.ts +67 -64
- package/dist/context/__mocks__/OneUIProvider.js +12 -12
- package/dist/hooks/shims/ObjectWatchShim.d.ts +0 -0
- package/dist/hooks/shims/ObjectWatchShim.js +48 -0
- package/dist/hooks/shims/ObjectWatchShim.js.map +1 -0
- package/dist/hooks/useAsyncControl.d.ts +9 -9
- package/dist/hooks/useAsyncControl.js +39 -39
- package/dist/hooks/useIntersection.d.ts +4 -4
- package/dist/hooks/useIntersection.js +29 -29
- package/dist/hooks/useObserve.d.ts +2 -0
- package/dist/hooks/useObserve.js +14 -0
- package/dist/hooks/useObserve.js.map +1 -0
- package/dist/hooks/usePagination.d.ts +19 -19
- package/dist/hooks/usePagination.js +64 -64
- package/dist/hooks/usePooledOperation.d.ts +15 -15
- package/dist/hooks/usePooledOperation.js +63 -63
- package/dist/hooks/usePooling.d.ts +16 -16
- package/dist/hooks/usePooling.js +46 -46
- package/dist/hooks/usePooling.test.d.ts +1 -1
- package/dist/hooks/usePooling.test.js +103 -103
- package/dist/hooks/useScrollLock.d.ts +0 -0
- package/dist/hooks/useScrollLock.js +2 -0
- package/dist/hooks/useScrollLock.js.map +1 -0
- package/dist/hooks/useShortIntl.d.ts +14 -14
- package/dist/hooks/useShortIntl.js +34 -34
- package/dist/models/GenericContract.d.ts +66 -66
- package/dist/models/GenericContract.js +13 -13
- package/dist/storybookUtils/index.d.ts +5 -5
- package/dist/storybookUtils/index.js +26 -26
- package/package.json +7 -4
|
@@ -1,47 +1,70 @@
|
|
|
1
|
-
import React, { ComponentProps } from "react";
|
|
2
|
-
import WalletConnectionWrapper from "./WalletConnectionWrapper";
|
|
3
|
-
declare const _default: {
|
|
4
|
-
title: string;
|
|
5
|
-
component: React.ForwardRefExoticComponent<{
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
ProviderUnavailable?: React.FunctionComponent<{}> | undefined;
|
|
37
|
-
ChainIdInvalid?: React.FunctionComponent<{
|
|
38
|
-
changeChainId: () => void;
|
|
39
|
-
}> | undefined;
|
|
40
|
-
Content: React.FunctionComponent<import("./WalletConnectionWrapper").WalletConnectionProps>;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
};
|
|
1
|
+
import React, { ComponentProps } from "react";
|
|
2
|
+
import WalletConnectionWrapper from "./WalletConnectionWrapper";
|
|
3
|
+
declare const _default: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: React.ForwardRefExoticComponent<{
|
|
6
|
+
chain: {
|
|
7
|
+
id: number;
|
|
8
|
+
rpcUrl: string;
|
|
9
|
+
explorerUrl: string;
|
|
10
|
+
name: string;
|
|
11
|
+
currency: string;
|
|
12
|
+
};
|
|
13
|
+
ProviderUnavailable?: React.FunctionComponent<{}> | undefined;
|
|
14
|
+
ChainIdInvalid?: React.FunctionComponent<{
|
|
15
|
+
changeChainId: () => void;
|
|
16
|
+
}> | undefined;
|
|
17
|
+
Content: React.FunctionComponent<import("./WalletConnectionWrapper").WalletConnectionProps>;
|
|
18
|
+
} & {
|
|
19
|
+
children?: React.ReactNode;
|
|
20
|
+
} & React.RefAttributes<{
|
|
21
|
+
connect: () => Promise<void>;
|
|
22
|
+
disconnect: () => void;
|
|
23
|
+
}>>;
|
|
24
|
+
};
|
|
25
|
+
export default _default;
|
|
26
|
+
export declare const BasicUsage: {
|
|
27
|
+
(args: ComponentProps<typeof WalletConnectionWrapper>): JSX.Element;
|
|
28
|
+
args: {
|
|
29
|
+
chain: {
|
|
30
|
+
id: number;
|
|
31
|
+
rpcUrl: string;
|
|
32
|
+
explorerUrl: string;
|
|
33
|
+
name: string;
|
|
34
|
+
currency: string;
|
|
35
|
+
};
|
|
36
|
+
ProviderUnavailable?: React.FunctionComponent<{}> | undefined;
|
|
37
|
+
ChainIdInvalid?: React.FunctionComponent<{
|
|
38
|
+
changeChainId: () => void;
|
|
39
|
+
}> | undefined;
|
|
40
|
+
Content: React.FunctionComponent<import("./WalletConnectionWrapper").WalletConnectionProps>;
|
|
41
|
+
} & {
|
|
42
|
+
children?: React.ReactNode;
|
|
43
|
+
} & React.RefAttributes<{
|
|
44
|
+
connect: () => Promise<void>;
|
|
45
|
+
disconnect: () => void;
|
|
46
|
+
}>;
|
|
47
|
+
};
|
|
48
|
+
export declare const UsageWithActionProps: {
|
|
49
|
+
(args: ComponentProps<typeof WalletConnectionWrapper>): JSX.Element;
|
|
50
|
+
args: {
|
|
51
|
+
chain: {
|
|
52
|
+
id: number;
|
|
53
|
+
rpcUrl: string;
|
|
54
|
+
explorerUrl: string;
|
|
55
|
+
name: string;
|
|
56
|
+
currency: string;
|
|
57
|
+
};
|
|
58
|
+
ProviderUnavailable?: React.FunctionComponent<{}> | undefined;
|
|
59
|
+
ChainIdInvalid?: React.FunctionComponent<{
|
|
60
|
+
changeChainId: () => void;
|
|
61
|
+
}> | undefined;
|
|
62
|
+
Content: React.FunctionComponent<import("./WalletConnectionWrapper").WalletConnectionProps>;
|
|
63
|
+
children?: React.ReactNode;
|
|
64
|
+
ref?: React.Ref<{
|
|
65
|
+
connect: () => Promise<void>;
|
|
66
|
+
disconnect: () => void;
|
|
67
|
+
}> | undefined;
|
|
68
|
+
key?: React.Key | null | undefined;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
@@ -1,56 +1,65 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.UsageWithActionProps = exports.BasicUsage = void 0;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const WalletConnectionWrapper_1 = __importDefault(require("./WalletConnectionWrapper"));
|
|
9
|
-
const AdaptiveDialog_1 = __importDefault(require("../AdaptiveDialog"));
|
|
10
|
-
const Button_1 = __importDefault(require("../Button"));
|
|
11
|
-
exports.default = {
|
|
12
|
-
title: "Wallet Connection Wrapper",
|
|
13
|
-
component: WalletConnectionWrapper_1.default,
|
|
14
|
-
};
|
|
15
|
-
const BasicUsage = (args) => {
|
|
16
|
-
return (react_1.default.createElement(WalletConnectionWrapper_1.default, Object.assign({}, args, { Content: ({ error, loading, isChainIdValid, isProviderAvailable, isConnectedAndValidChain, connect, disconnect, changeChainId, }) => (react_1.default.createElement(react_1.default.Fragment, null,
|
|
17
|
-
react_1.default.createElement("h1", null, "The content prop will receive the props of control for handling wallet connection"),
|
|
18
|
-
react_1.default.createElement("h3", null, "You can test this component by using metamask"),
|
|
19
|
-
react_1.default.createElement("p", null,
|
|
20
|
-
react_1.default.createElement("b", null, "Is connected and valid chain: "),
|
|
21
|
-
" ",
|
|
22
|
-
String(isConnectedAndValidChain)),
|
|
23
|
-
react_1.default.createElement("p", null,
|
|
24
|
-
"Error: ",
|
|
25
|
-
String(error)),
|
|
26
|
-
react_1.default.createElement("p", null,
|
|
27
|
-
"Loading: ",
|
|
28
|
-
String(loading)),
|
|
29
|
-
react_1.default.createElement("p", null,
|
|
30
|
-
"Valid chain (",
|
|
31
|
-
args.
|
|
32
|
-
"): ",
|
|
33
|
-
String(isChainIdValid)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
react_1.default.createElement("
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
exports.
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.UsageWithActionProps = exports.BasicUsage = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const WalletConnectionWrapper_1 = __importDefault(require("./WalletConnectionWrapper"));
|
|
9
|
+
const AdaptiveDialog_1 = __importDefault(require("../AdaptiveDialog"));
|
|
10
|
+
const Button_1 = __importDefault(require("../Button"));
|
|
11
|
+
exports.default = {
|
|
12
|
+
title: "Wallet Connection Wrapper",
|
|
13
|
+
component: WalletConnectionWrapper_1.default,
|
|
14
|
+
};
|
|
15
|
+
const BasicUsage = (args) => {
|
|
16
|
+
return (react_1.default.createElement(WalletConnectionWrapper_1.default, Object.assign({}, args, { Content: ({ chainId, error, loading, isChainIdValid, isProviderAvailable, isConnectedAndValidChain, connect, disconnect, changeChainId, }) => (react_1.default.createElement(react_1.default.Fragment, null,
|
|
17
|
+
react_1.default.createElement("h1", null, "The content prop will receive the props of control for handling wallet connection"),
|
|
18
|
+
react_1.default.createElement("h3", null, "You can test this component by using metamask"),
|
|
19
|
+
react_1.default.createElement("p", null,
|
|
20
|
+
react_1.default.createElement("b", null, "Is connected and valid chain: "),
|
|
21
|
+
" ",
|
|
22
|
+
String(isConnectedAndValidChain)),
|
|
23
|
+
react_1.default.createElement("p", null,
|
|
24
|
+
"Error: ",
|
|
25
|
+
String(error)),
|
|
26
|
+
react_1.default.createElement("p", null,
|
|
27
|
+
"Loading: ",
|
|
28
|
+
String(loading)),
|
|
29
|
+
react_1.default.createElement("p", null,
|
|
30
|
+
"Valid chain (",
|
|
31
|
+
args.chain.id,
|
|
32
|
+
"): ",
|
|
33
|
+
String(isChainIdValid),
|
|
34
|
+
" (",
|
|
35
|
+
chainId,
|
|
36
|
+
")"),
|
|
37
|
+
react_1.default.createElement("p", null,
|
|
38
|
+
"Provider available (",
|
|
39
|
+
String(isProviderAvailable),
|
|
40
|
+
")"),
|
|
41
|
+
react_1.default.createElement("h2", null, "actions"),
|
|
42
|
+
react_1.default.createElement("button", { onClick: connect }, "Connect"),
|
|
43
|
+
react_1.default.createElement("button", { onClick: disconnect }, "Disconnect"),
|
|
44
|
+
react_1.default.createElement("button", { onClick: changeChainId }, "Change chain id (to the chain id defined on prop)"))) })));
|
|
45
|
+
};
|
|
46
|
+
exports.BasicUsage = BasicUsage;
|
|
47
|
+
const UsageWithActionProps = (args) => {
|
|
48
|
+
return (react_1.default.createElement(WalletConnectionWrapper_1.default, Object.assign({}, args, { ProviderUnavailable: () => (react_1.default.createElement(AdaptiveDialog_1.default, { open: true }, "Do something when the provider is not available")), ChainIdInvalid: ({ changeChainId }) => (react_1.default.createElement(AdaptiveDialog_1.default, { open: true },
|
|
49
|
+
"Some action when the chain id is invalid",
|
|
50
|
+
react_1.default.createElement(Button_1.default, { variant: "filled", onClick: changeChainId }, "This action come as prop"))), Content: ({ connect }) => (react_1.default.createElement(react_1.default.Fragment, null,
|
|
51
|
+
react_1.default.createElement("h1", null, "You can also delegate the handling to the props, check the story for more details"),
|
|
52
|
+
react_1.default.createElement("button", { onClick: connect }, "Connect"))) })));
|
|
53
|
+
};
|
|
54
|
+
exports.UsageWithActionProps = UsageWithActionProps;
|
|
55
|
+
exports.BasicUsage.args = {
|
|
56
|
+
chain: {
|
|
57
|
+
id: 80001,
|
|
58
|
+
name: "Polygon Testnet",
|
|
59
|
+
rpcUrl: "https://rpc-mumbai.matic.today/",
|
|
60
|
+
explorerUrl: "https://mumbai.polygonscan.com/",
|
|
61
|
+
currency: "MATIC",
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
exports.UsageWithActionProps.args = Object.assign({}, exports.BasicUsage.args);
|
|
56
65
|
//# sourceMappingURL=WalletConnectionWrapper.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WalletConnectionWrapper.stories.js","sourceRoot":"","sources":["../../../src/components/WalletConnectionWrapper/WalletConnectionWrapper.stories.tsx"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"WalletConnectionWrapper.stories.js","sourceRoot":"","sources":["../../../src/components/WalletConnectionWrapper/WalletConnectionWrapper.stories.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA8C;AAC9C,wFAAgE;AAChE,uEAA+C;AAC/C,uDAA+B;AAE/B,kBAAe;IACb,KAAK,EAAE,2BAA2B;IAClC,SAAS,EAAE,iCAAuB;CACnC,CAAC;AAEK,MAAM,UAAU,GAAG,CACxB,IAAoD,EACpD,EAAE;IACF,OAAO,CACL,8BAAC,iCAAuB,oBAClB,IAAI,IACR,OAAO,EAAE,CAAC,EACR,OAAO,EACP,KAAK,EACL,OAAO,EACP,cAAc,EACd,mBAAmB,EACnB,wBAAwB,EACxB,OAAO,EACP,UAAU,EACV,aAAa,GACd,EAAE,EAAE,CAAC,CACJ;YACE,8HAGK;YACL,0FAAsD;YACtD;gBACE,0EAAqC;gBAAC,GAAG;gBACxC,MAAM,CAAC,wBAAwB,CAAC,CAC/B;YACJ;;gBAAW,MAAM,CAAC,KAAK,CAAC,CAAK;YAC7B;;gBAAa,MAAM,CAAC,OAAO,CAAC,CAAK;YACjC;;gBACgB,IAAI,CAAC,KAAK,CAAC,EAAE;;gBAAK,MAAM,CAAC,cAAc,CAAC;;gBAAI,OAAO;oBAC/D;YACJ;;gBAAwB,MAAM,CAAC,mBAAmB,CAAC;oBAAM;YACzD,oDAAgB;YAChB,0CAAQ,OAAO,EAAE,OAAO,cAAkB;YAC1C,0CAAQ,OAAO,EAAE,UAAU,iBAAqB;YAChD,0CAAQ,OAAO,EAAE,aAAa,wDAErB,CACR,CACJ,IACD,CACH,CAAC;AACJ,CAAC,CAAC;AA3CW,QAAA,UAAU,cA2CrB;AAEK,MAAM,oBAAoB,GAAG,CAClC,IAAoD,EACpD,EAAE;IACF,OAAO,CACL,8BAAC,iCAAuB,oBAClB,IAAI,IACR,mBAAmB,EAAE,GAAG,EAAE,CAAC,CACzB,8BAAC,wBAAc,IAAC,IAAI,4DAEH,CAClB,EACD,cAAc,EAAE,CAAC,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC,CACrC,8BAAC,wBAAc,IAAC,IAAI;;YAElB,8BAAC,gBAAM,IAAC,OAAO,EAAC,QAAQ,EAAC,OAAO,EAAE,aAAa,+BAEtC,CACM,CAClB,EACD,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CACxB;YACE,8HAGK;YACL,0CAAQ,OAAO,EAAE,OAAO,cAAkB,CACzC,CACJ,IACD,CACH,CAAC;AACJ,CAAC,CAAC;AA9BW,QAAA,oBAAoB,wBA8B/B;AAEF,kBAAU,CAAC,IAAI,GAAG;IAChB,KAAK,EAAE;QACL,EAAE,EAAE,KAAK;QACT,IAAI,EAAE,iBAAiB;QACvB,MAAM,EAAE,iCAAiC;QACzC,WAAW,EAAE,iCAAiC;QAC9C,QAAQ,EAAE,OAAO;KAClB;CACgD,CAAC;AAEpD,4BAAoB,CAAC,IAAI,qBACpB,kBAAU,CAAC,IAAI,CACnB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1,137 +1,137 @@
|
|
|
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
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
-
};
|
|
37
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
const react_1 = __importStar(require("react"));
|
|
39
|
-
const react_2 = require("@testing-library/react");
|
|
40
|
-
const WalletConnectionWrapper_1 = __importDefault(require("./WalletConnectionWrapper"));
|
|
41
|
-
const utils_1 = require("../../__test__/utils");
|
|
42
|
-
const ProviderMock = jest.spyOn(require("use-wallet"), "UseWalletProvider");
|
|
43
|
-
const useWalletMock = jest
|
|
44
|
-
.spyOn(require("use-wallet"), "useWallet")
|
|
45
|
-
.mockImplementation(() => ({}));
|
|
46
|
-
const MockContent = () => null;
|
|
47
|
-
const defaultProps = {
|
|
48
|
-
Content: MockContent,
|
|
49
|
-
};
|
|
50
|
-
beforeEach(() => {
|
|
51
|
-
jest.clearAllMocks();
|
|
52
|
-
localStorage.removeItem("auto_connect");
|
|
53
|
-
});
|
|
54
|
-
it("Should auto connect the connection after the user connects", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
55
|
-
const connectCb = jest.fn(() => { });
|
|
56
|
-
useWalletMock.mockImplementation(() => (Object.assign({ isConnected: () => false, connect: connectCb, reset: () => { } }, {})));
|
|
57
|
-
global.window.ethereum = {};
|
|
58
|
-
function getAutoConnectFlag() {
|
|
59
|
-
return !!localStorage.getItem("auto_connect");
|
|
60
|
-
}
|
|
61
|
-
expect(getAutoConnectFlag()).toBeFalsy();
|
|
62
|
-
const ref = (0, react_1.createRef)();
|
|
63
|
-
(0, react_2.render)(react_1.default.createElement(WalletConnectionWrapper_1.default, Object.assign({ ref: ref }, defaultProps)));
|
|
64
|
-
expect(ProviderMock).toHaveBeenCalledTimes(1);
|
|
65
|
-
yield (0, react_2.act)(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
66
|
-
yield ref.current.connect();
|
|
67
|
-
}));
|
|
68
|
-
expect(connectCb).toHaveBeenCalledTimes(1);
|
|
69
|
-
(0, react_2.render)(react_1.default.createElement(WalletConnectionWrapper_1.default, Object.assign({ ref: ref }, defaultProps)));
|
|
70
|
-
yield (0, react_2.act)(() => (0, utils_1.WaitTimeout)(100));
|
|
71
|
-
expect(ProviderMock).toHaveBeenCalledTimes(2);
|
|
72
|
-
expect(getAutoConnectFlag()).toBeTruthy();
|
|
73
|
-
expect(connectCb).toHaveBeenCalledTimes(2);
|
|
74
|
-
ref.current.disconnect();
|
|
75
|
-
(0, react_2.render)(react_1.default.createElement(WalletConnectionWrapper_1.default, Object.assign({ ref: ref }, defaultProps)));
|
|
76
|
-
expect(ProviderMock).toHaveBeenCalledTimes(3);
|
|
77
|
-
expect(getAutoConnectFlag()).toBeFalsy();
|
|
78
|
-
expect(connectCb).toHaveBeenCalledTimes(2);
|
|
79
|
-
}));
|
|
80
|
-
it("Should warn when there is no provider available", () => {
|
|
81
|
-
useWalletMock.mockImplementation(() => (Object.assign({ isConnected: () => false }, {})));
|
|
82
|
-
delete window.ethereum;
|
|
83
|
-
const { container } = (0, react_2.render)(react_1.default.createElement(WalletConnectionWrapper_1.default, Object.assign({ ProviderUnavailable: () => react_1.default.createElement("h1", null, "Provider unavailable") }, defaultProps)));
|
|
84
|
-
expect(container.textContent).toEqual("Provider unavailable");
|
|
85
|
-
window.ethereum = {};
|
|
86
|
-
const { container: continer2 } = (0, react_2.render)(react_1.default.createElement(WalletConnectionWrapper_1.default, Object.assign({ ProviderUnavailable: () => react_1.default.createElement("h1", null, "Provider unavailable") }, defaultProps)));
|
|
87
|
-
expect(continer2.textContent).not.toEqual("Provider unavailable");
|
|
88
|
-
});
|
|
89
|
-
it("Should warn when the chainId is not the correct one", () => {
|
|
90
|
-
const requestMock = jest.fn();
|
|
91
|
-
window.ethereum = {
|
|
92
|
-
request: requestMock,
|
|
93
|
-
};
|
|
94
|
-
useWalletMock.mockImplementation(() => (Object.assign({ chainId: 56, isConnected: () => true }, {})));
|
|
95
|
-
const { container } = (0, react_2.render)(react_1.default.createElement(WalletConnectionWrapper_1.default, Object.assign({ allowedChainId: 56, ChainIdInvalid: () => react_1.default.createElement("h1", null, "Invalid") }, defaultProps)));
|
|
96
|
-
expect(container.textContent).not.toContain("Invalid");
|
|
97
|
-
const resetMock = jest.fn();
|
|
98
|
-
const connectMock = jest.fn();
|
|
99
|
-
useWalletMock.mockImplementation(() => (Object.assign({ chainId: "UNEXPECTED", reset: resetMock, connect: connectMock, isConnected: () => true }, {})));
|
|
100
|
-
const ui = jest.fn(({ changeChainId }) => (react_1.default.createElement("h1", null, "Invalid")));
|
|
101
|
-
const { container: container2 } = (0, react_2.render)(react_1.default.createElement(WalletConnectionWrapper_1.default, Object.assign({ allowedChainId: 56, ChainIdInvalid: ui }, defaultProps)));
|
|
102
|
-
expect(container2.textContent).toContain("Invalid");
|
|
103
|
-
// When the user clicks the change chain
|
|
104
|
-
ui.mock.calls.slice(-1)[0][0].changeChainId();
|
|
105
|
-
expect(resetMock).toHaveBeenCalled();
|
|
106
|
-
expect(connectMock).toHaveBeenCalled();
|
|
107
|
-
expect(requestMock).toHaveBeenCalledWith({
|
|
108
|
-
method: "wallet_switchEthereumChain",
|
|
109
|
-
params: [
|
|
110
|
-
{
|
|
111
|
-
chainId: `0x38`,
|
|
112
|
-
},
|
|
113
|
-
],
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
it("Should warn when the connection fails", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
117
|
-
useWalletMock.mockImplementation(() => (Object.assign({ chainId: "UNEXPECTED", isConnected: () => false, connect: () => Promise.reject() }, {})));
|
|
118
|
-
window.ethereum = {};
|
|
119
|
-
const ref = (0, react_1.createRef)();
|
|
120
|
-
const mockComp = jest.fn((props) => (props.error ? "Error" : props.loading ? "Loading" : "OK"));
|
|
121
|
-
const { findByText } = (0, react_2.render)(react_1.default.createElement(WalletConnectionWrapper_1.default, Object.assign({ ref: ref }, defaultProps, { Content: mockComp })));
|
|
122
|
-
(0, react_2.act)(() => {
|
|
123
|
-
ref.current.connect();
|
|
124
|
-
});
|
|
125
|
-
yield findByText("Error");
|
|
126
|
-
}));
|
|
127
|
-
// This cenario is given by the useWallet hook .isConnected()
|
|
128
|
-
//it("Should notify when the user connects", () => {});
|
|
129
|
-
describe("BUGFIX", () => {
|
|
130
|
-
it("Should not validate chainId if not connected yet", () => {
|
|
131
|
-
window.ethereum = {};
|
|
132
|
-
useWalletMock.mockImplementation(() => (Object.assign({ chainId: undefined, isConnected: () => false }, {})));
|
|
133
|
-
const { container, findByText } = (0, react_2.render)(react_1.default.createElement(WalletConnectionWrapper_1.default, Object.assign({ allowedChainId: 90, ChainIdInvalid: () => react_1.default.createElement("p", null, "Invalid") }, defaultProps)));
|
|
134
|
-
expect(container.textContent).not.toContain("Invalid");
|
|
135
|
-
});
|
|
136
|
-
});
|
|
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
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
+
};
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
const react_1 = __importStar(require("react"));
|
|
39
|
+
const react_2 = require("@testing-library/react");
|
|
40
|
+
const WalletConnectionWrapper_1 = __importDefault(require("./WalletConnectionWrapper"));
|
|
41
|
+
const utils_1 = require("../../__test__/utils");
|
|
42
|
+
const ProviderMock = jest.spyOn(require("use-wallet"), "UseWalletProvider");
|
|
43
|
+
const useWalletMock = jest
|
|
44
|
+
.spyOn(require("use-wallet"), "useWallet")
|
|
45
|
+
.mockImplementation(() => ({}));
|
|
46
|
+
const MockContent = () => null;
|
|
47
|
+
const defaultProps = {
|
|
48
|
+
Content: MockContent,
|
|
49
|
+
};
|
|
50
|
+
beforeEach(() => {
|
|
51
|
+
jest.clearAllMocks();
|
|
52
|
+
localStorage.removeItem("auto_connect");
|
|
53
|
+
});
|
|
54
|
+
it("Should auto connect the connection after the user connects", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
55
|
+
const connectCb = jest.fn(() => { });
|
|
56
|
+
useWalletMock.mockImplementation(() => (Object.assign({ isConnected: () => false, connect: connectCb, reset: () => { } }, {})));
|
|
57
|
+
global.window.ethereum = {};
|
|
58
|
+
function getAutoConnectFlag() {
|
|
59
|
+
return !!localStorage.getItem("auto_connect");
|
|
60
|
+
}
|
|
61
|
+
expect(getAutoConnectFlag()).toBeFalsy();
|
|
62
|
+
const ref = (0, react_1.createRef)();
|
|
63
|
+
(0, react_2.render)(react_1.default.createElement(WalletConnectionWrapper_1.default, Object.assign({ ref: ref }, defaultProps)));
|
|
64
|
+
expect(ProviderMock).toHaveBeenCalledTimes(1);
|
|
65
|
+
yield (0, react_2.act)(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
66
|
+
yield ref.current.connect();
|
|
67
|
+
}));
|
|
68
|
+
expect(connectCb).toHaveBeenCalledTimes(1);
|
|
69
|
+
(0, react_2.render)(react_1.default.createElement(WalletConnectionWrapper_1.default, Object.assign({ ref: ref }, defaultProps)));
|
|
70
|
+
yield (0, react_2.act)(() => (0, utils_1.WaitTimeout)(100));
|
|
71
|
+
expect(ProviderMock).toHaveBeenCalledTimes(2);
|
|
72
|
+
expect(getAutoConnectFlag()).toBeTruthy();
|
|
73
|
+
expect(connectCb).toHaveBeenCalledTimes(2);
|
|
74
|
+
ref.current.disconnect();
|
|
75
|
+
(0, react_2.render)(react_1.default.createElement(WalletConnectionWrapper_1.default, Object.assign({ ref: ref }, defaultProps)));
|
|
76
|
+
expect(ProviderMock).toHaveBeenCalledTimes(3);
|
|
77
|
+
expect(getAutoConnectFlag()).toBeFalsy();
|
|
78
|
+
expect(connectCb).toHaveBeenCalledTimes(2);
|
|
79
|
+
}));
|
|
80
|
+
it("Should warn when there is no provider available", () => {
|
|
81
|
+
useWalletMock.mockImplementation(() => (Object.assign({ isConnected: () => false }, {})));
|
|
82
|
+
delete window.ethereum;
|
|
83
|
+
const { container } = (0, react_2.render)(react_1.default.createElement(WalletConnectionWrapper_1.default, Object.assign({ ProviderUnavailable: () => react_1.default.createElement("h1", null, "Provider unavailable") }, defaultProps)));
|
|
84
|
+
expect(container.textContent).toEqual("Provider unavailable");
|
|
85
|
+
window.ethereum = {};
|
|
86
|
+
const { container: continer2 } = (0, react_2.render)(react_1.default.createElement(WalletConnectionWrapper_1.default, Object.assign({ ProviderUnavailable: () => react_1.default.createElement("h1", null, "Provider unavailable") }, defaultProps)));
|
|
87
|
+
expect(continer2.textContent).not.toEqual("Provider unavailable");
|
|
88
|
+
});
|
|
89
|
+
it("Should warn when the chainId is not the correct one", () => {
|
|
90
|
+
const requestMock = jest.fn();
|
|
91
|
+
window.ethereum = {
|
|
92
|
+
request: requestMock,
|
|
93
|
+
};
|
|
94
|
+
useWalletMock.mockImplementation(() => (Object.assign({ chainId: 56, isConnected: () => true }, {})));
|
|
95
|
+
const { container } = (0, react_2.render)(react_1.default.createElement(WalletConnectionWrapper_1.default, Object.assign({ allowedChainId: 56, ChainIdInvalid: () => react_1.default.createElement("h1", null, "Invalid") }, defaultProps)));
|
|
96
|
+
expect(container.textContent).not.toContain("Invalid");
|
|
97
|
+
const resetMock = jest.fn();
|
|
98
|
+
const connectMock = jest.fn();
|
|
99
|
+
useWalletMock.mockImplementation(() => (Object.assign({ chainId: "UNEXPECTED", reset: resetMock, connect: connectMock, isConnected: () => true }, {})));
|
|
100
|
+
const ui = jest.fn(({ changeChainId }) => (react_1.default.createElement("h1", null, "Invalid")));
|
|
101
|
+
const { container: container2 } = (0, react_2.render)(react_1.default.createElement(WalletConnectionWrapper_1.default, Object.assign({ allowedChainId: 56, ChainIdInvalid: ui }, defaultProps)));
|
|
102
|
+
expect(container2.textContent).toContain("Invalid");
|
|
103
|
+
// When the user clicks the change chain
|
|
104
|
+
ui.mock.calls.slice(-1)[0][0].changeChainId();
|
|
105
|
+
expect(resetMock).toHaveBeenCalled();
|
|
106
|
+
expect(connectMock).toHaveBeenCalled();
|
|
107
|
+
expect(requestMock).toHaveBeenCalledWith({
|
|
108
|
+
method: "wallet_switchEthereumChain",
|
|
109
|
+
params: [
|
|
110
|
+
{
|
|
111
|
+
chainId: `0x38`,
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
it("Should warn when the connection fails", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
117
|
+
useWalletMock.mockImplementation(() => (Object.assign({ chainId: "UNEXPECTED", isConnected: () => false, connect: () => Promise.reject() }, {})));
|
|
118
|
+
window.ethereum = {};
|
|
119
|
+
const ref = (0, react_1.createRef)();
|
|
120
|
+
const mockComp = jest.fn((props) => (props.error ? "Error" : props.loading ? "Loading" : "OK"));
|
|
121
|
+
const { findByText } = (0, react_2.render)(react_1.default.createElement(WalletConnectionWrapper_1.default, Object.assign({ ref: ref }, defaultProps, { Content: mockComp })));
|
|
122
|
+
(0, react_2.act)(() => {
|
|
123
|
+
ref.current.connect();
|
|
124
|
+
});
|
|
125
|
+
yield findByText("Error");
|
|
126
|
+
}));
|
|
127
|
+
// This cenario is given by the useWallet hook .isConnected()
|
|
128
|
+
//it("Should notify when the user connects", () => {});
|
|
129
|
+
describe("BUGFIX", () => {
|
|
130
|
+
it("Should not validate chainId if not connected yet", () => {
|
|
131
|
+
window.ethereum = {};
|
|
132
|
+
useWalletMock.mockImplementation(() => (Object.assign({ chainId: undefined, isConnected: () => false }, {})));
|
|
133
|
+
const { container, findByText } = (0, react_2.render)(react_1.default.createElement(WalletConnectionWrapper_1.default, Object.assign({ allowedChainId: 90, ChainIdInvalid: () => react_1.default.createElement("p", null, "Invalid") }, defaultProps)));
|
|
134
|
+
expect(container.textContent).not.toContain("Invalid");
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
137
|
//# sourceMappingURL=WalletConnectionWrapper.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from './WalletConnectionWrapper';
|
|
1
|
+
export { default, BaseWalletConnectionWrapper } from './WalletConnectionWrapper';
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var WalletConnectionWrapper_1 = require("./WalletConnectionWrapper");
|
|
8
|
-
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(WalletConnectionWrapper_1).default; } });
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.BaseWalletConnectionWrapper = exports.default = void 0;
|
|
7
|
+
var WalletConnectionWrapper_1 = require("./WalletConnectionWrapper");
|
|
8
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(WalletConnectionWrapper_1).default; } });
|
|
9
|
+
Object.defineProperty(exports, "BaseWalletConnectionWrapper", { enumerable: true, get: function () { return WalletConnectionWrapper_1.BaseWalletConnectionWrapper; } });
|
|
9
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/WalletConnectionWrapper/index.tsx"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/WalletConnectionWrapper/index.tsx"],"names":[],"mappings":";;;;;;AAAA,qEAAiF;AAAxE,mIAAA,OAAO,OAAA;AAAE,sIAAA,2BAA2B,OAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import useAsyncControl from "../../../hooks/useAsyncControl";
|
|
3
|
+
export declare type WalletConnectionProps = Omit<ReturnType<typeof useAsyncControl>, "process"> & {
|
|
4
|
+
chainId?: number;
|
|
5
|
+
isChainIdValid: boolean;
|
|
6
|
+
isProviderAvailable: boolean;
|
|
7
|
+
isConnectedAndValidChain: boolean;
|
|
8
|
+
connect: () => void;
|
|
9
|
+
disconnect: () => void;
|
|
10
|
+
changeChainId: () => void;
|
|
11
|
+
};
|
|
12
|
+
declare type Props = {
|
|
13
|
+
/**
|
|
14
|
+
* The chain id that the user is expected to connect to
|
|
15
|
+
*/
|
|
16
|
+
chain: {
|
|
17
|
+
id: number;
|
|
18
|
+
rpcUrl: string;
|
|
19
|
+
explorerUrl: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* When the user doesn't have a provider like metamask available
|
|
23
|
+
*/
|
|
24
|
+
ProviderUnavailable?: React.FunctionComponent;
|
|
25
|
+
/**
|
|
26
|
+
* This is invoked when the chain ID is not available
|
|
27
|
+
*/
|
|
28
|
+
ChainIdInvalid?: React.FunctionComponent<{
|
|
29
|
+
changeChainId: () => void;
|
|
30
|
+
}>;
|
|
31
|
+
/**
|
|
32
|
+
* This renders the content that is shown inside the wallet content
|
|
33
|
+
*/
|
|
34
|
+
Content: React.FunctionComponent<WalletConnectionProps>;
|
|
35
|
+
};
|
|
36
|
+
declare const _default: React.ForwardRefExoticComponent<Props & React.RefAttributes<{
|
|
37
|
+
connect: () => Promise<void>;
|
|
38
|
+
disconnect: () => void;
|
|
39
|
+
}>>;
|
|
40
|
+
export default _default;
|