@multiversx/sdk-dapp-liquidity 2.0.0 → 2.1.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/all-networks--dfVLHLJ.js +2 -0
- package/all-networks-Czd8zS1n.mjs +4 -0
- package/api/checkAccount.js +1 -21
- package/api/checkAccount.mjs +13 -13
- package/api/confirmRate.js +1 -29
- package/api/confirmRate.mjs +17 -22
- package/api/getChains.js +1 -17
- package/api/getChains.mjs +10 -10
- package/api/getRate.js +1 -27
- package/api/getRate.mjs +17 -20
- package/api/getTokens.js +1 -22
- package/api/getTokens.mjs +14 -15
- package/api/getTokensBalances.js +1 -21
- package/api/getTokensBalances.mjs +13 -13
- package/api/getTransactions.js +1 -38
- package/api/getTransactions.mjs +25 -31
- package/api/index.js +1 -18
- package/api/index.mjs +16 -16
- package/api/sendTransactions.js +1 -32
- package/api/sendTransactions.mjs +19 -19
- package/api/tests/confirmRate.spec.js +1 -130
- package/api/tests/confirmRate.spec.mjs +44 -58
- package/api/tests/getChains.spec.js +1 -43
- package/api/tests/getChains.spec.mjs +15 -18
- package/api/tests/getRate.spec.js +1 -87
- package/api/tests/getRate.spec.mjs +35 -49
- package/api/tests/getTokens.spec.js +1 -68
- package/api/tests/getTokens.spec.mjs +23 -29
- package/api/tests/getTransactions.spec.js +1 -94
- package/api/tests/getTransactions.spec.mjs +35 -51
- package/api/tests/sendTransactions.spec.js +1 -96
- package/api/tests/sendTransactions.spec.mjs +44 -52
- package/constants/index.js +1 -4
- package/constants/index.mjs +2 -2
- package/default-D0Jk5ROI.mjs +4 -0
- package/default-DbU6vPaB.js +2 -0
- package/helpers/assertRateConfirmationMatchesIntent.d.ts +8 -0
- package/helpers/assertRateConfirmationMatchesIntent.js +2 -0
- package/helpers/assertRateConfirmationMatchesIntent.mjs +20 -0
- package/helpers/base64Utils.js +1 -31
- package/helpers/base64Utils.mjs +14 -24
- package/helpers/decodeLoginToken.js +1 -27
- package/helpers/decodeLoginToken.mjs +13 -18
- package/helpers/decodeToken.js +1 -39
- package/helpers/decodeToken.mjs +20 -31
- package/helpers/getApiURL.js +1 -7
- package/helpers/getApiURL.mjs +3 -5
- package/helpers/getBridgeURL.js +1 -7
- package/helpers/getBridgeURL.mjs +3 -5
- package/helpers/getDisplayName.js +1 -11
- package/helpers/getDisplayName.mjs +3 -8
- package/helpers/getMvxApiURL.js +1 -7
- package/helpers/getMvxApiURL.mjs +3 -5
- package/helpers/getMvxChainId.js +1 -7
- package/helpers/getMvxChainId.mjs +3 -5
- package/helpers/getMvxExplorerAddress.js +1 -7
- package/helpers/getMvxExplorerAddress.mjs +3 -5
- package/helpers/index.d.ts +2 -0
- package/helpers/index.js +1 -22
- package/helpers/index.mjs +24 -20
- package/helpers/safeImageUrl.d.ts +1 -0
- package/helpers/safeImageUrl.js +2 -0
- package/helpers/safeImageUrl.mjs +13 -0
- package/helpers/serializeTransaction.js +1 -8
- package/helpers/serializeTransaction.mjs +3 -5
- package/helpers/tests/assertRateConfirmationMatchesIntent.spec.d.ts +1 -0
- package/helpers/tests/assertRateConfirmationMatchesIntent.spec.js +2 -0
- package/helpers/tests/assertRateConfirmationMatchesIntent.spec.mjs +52 -0
- package/helpers/tests/base64Utils.spec.js +1 -29
- package/helpers/tests/base64Utils.spec.mjs +11 -24
- package/helpers/tests/decodeLoginToken.spec.js +1 -34
- package/helpers/tests/decodeLoginToken.spec.mjs +13 -24
- package/helpers/tests/decodeToken.spec.js +1 -27
- package/helpers/tests/decodeToken.spec.mjs +7 -12
- package/helpers/tests/safeImageUrl.spec.d.ts +1 -0
- package/helpers/tests/safeImageUrl.spec.js +2 -0
- package/helpers/tests/safeImageUrl.spec.mjs +32 -0
- package/helpers/tests/serializeTransaction.spec.d.ts +1 -0
- package/helpers/tests/serializeTransaction.spec.js +2 -0
- package/helpers/tests/serializeTransaction.spec.mjs +24 -0
- package/index.js +1 -228
- package/index.mjs +196 -192
- package/package.json +14 -9
- package/react.esm-B0AMOHxa.js +73 -0
- package/react.esm-BxvJJ86Q.mjs +9949 -0
- package/reactjs/adapters/SuiAdapter.d.ts +14 -0
- package/reactjs/adapters/SuiAdapter.js +1 -349
- package/reactjs/adapters/SuiAdapter.mjs +171 -199
- package/reactjs/components/AccountAddress/AccountAddress.js +1 -31
- package/reactjs/components/AccountAddress/AccountAddress.mjs +16 -16
- package/reactjs/components/AccountAddress/index.js +1 -4
- package/reactjs/components/AccountAddress/index.mjs +2 -2
- package/reactjs/components/AmountCard/AmountCard.js +1 -33
- package/reactjs/components/AmountCard/AmountCard.mjs +19 -21
- package/reactjs/components/AmountCard/index.js +1 -4
- package/reactjs/components/AmountCard/index.mjs +2 -2
- package/reactjs/components/AmountInput/AmountInput.js +1 -71
- package/reactjs/components/AmountInput/AmountInput.mjs +42 -46
- package/reactjs/components/AmountInput/index.js +1 -4
- package/reactjs/components/AmountInput/index.mjs +2 -2
- package/reactjs/components/BridgeForm/BridgeForm.d.ts +9 -0
- package/reactjs/components/BridgeForm/BridgeForm.js +1 -89
- package/reactjs/components/BridgeForm/BridgeForm.mjs +72 -79
- package/reactjs/components/BridgeForm/Deposit.js +1 -673
- package/reactjs/components/BridgeForm/Deposit.mjs +381 -503
- package/reactjs/components/BridgeForm/Transfer.js +1 -559
- package/reactjs/components/BridgeForm/Transfer.mjs +316 -427
- package/reactjs/components/BridgeForm/hooks/useBridgeAmounts.js +1 -78
- package/reactjs/components/BridgeForm/hooks/useBridgeAmounts.mjs +47 -70
- package/reactjs/components/BridgeForm/hooks/useBridgeRateFetching.js +1 -58
- package/reactjs/components/BridgeForm/hooks/useBridgeRateFetching.mjs +36 -47
- package/reactjs/components/BridgeForm/hooks/useBridgeTokenSelection.js +1 -266
- package/reactjs/components/BridgeForm/hooks/useBridgeTokenSelection.mjs +163 -231
- package/reactjs/components/BridgeForm/index.js +1 -4
- package/reactjs/components/BridgeForm/index.mjs +2 -2
- package/reactjs/components/BridgeForm/utils/bridgeFormHelpers.js +1 -76
- package/reactjs/components/BridgeForm/utils/bridgeFormHelpers.mjs +35 -65
- package/reactjs/components/BridgeHistory/BridgeHistory.js +1 -367
- package/reactjs/components/BridgeHistory/BridgeHistory.mjs +177 -193
- package/reactjs/components/BridgeHistory/index.js +1 -4
- package/reactjs/components/BridgeHistory/index.mjs +2 -2
- package/reactjs/components/Connect/BridgeAccountDisplay.js +1 -150
- package/reactjs/components/Connect/BridgeAccountDisplay.mjs +99 -115
- package/reactjs/components/Connect/BridgeConnectButton.js +1 -34
- package/reactjs/components/Connect/BridgeConnectButton.mjs +20 -19
- package/reactjs/components/Connect/ChainSelectConnect.js +1 -144
- package/reactjs/components/Connect/ChainSelectConnect.mjs +70 -83
- package/reactjs/components/Connect/CustomConnectButton.js +1 -40
- package/reactjs/components/Connect/CustomConnectButton.mjs +24 -30
- package/reactjs/components/Connect/MvxAccountDisplay.js +1 -97
- package/reactjs/components/Connect/MvxAccountDisplay.mjs +47 -50
- package/reactjs/components/Connect/MvxConnectButton.js +1 -43
- package/reactjs/components/Connect/MvxConnectButton.mjs +35 -40
- package/reactjs/components/Connect/SwitchChainButton.js +1 -29
- package/reactjs/components/Connect/SwitchChainButton.mjs +15 -18
- package/reactjs/components/Connect/index.js +1 -16
- package/reactjs/components/Connect/index.mjs +14 -14
- package/reactjs/components/CopyButton/CopyButton.js +1 -46
- package/reactjs/components/CopyButton/CopyButton.mjs +33 -36
- package/reactjs/components/CopyButton/index.js +1 -4
- package/reactjs/components/CopyButton/index.mjs +2 -2
- package/reactjs/components/CopyButton/utils/copyToClipboard.js +1 -38
- package/reactjs/components/CopyButton/utils/copyToClipboard.mjs +20 -32
- package/reactjs/components/CopyButton/utils/index.js +1 -4
- package/reactjs/components/CopyButton/utils/index.mjs +2 -2
- package/reactjs/components/DisplayAmount/DisplayAmount.js +1 -90
- package/reactjs/components/DisplayAmount/DisplayAmount.mjs +68 -75
- package/reactjs/components/DisplayAmount/components/AnimateNumber/AnimateNumber.js +1 -39
- package/reactjs/components/DisplayAmount/components/AnimateNumber/AnimateNumber.mjs +26 -33
- package/reactjs/components/DisplayAmount/components/PrecisedAmount/PrecisedAmount.js +1 -61
- package/reactjs/components/DisplayAmount/components/PrecisedAmount/PrecisedAmount.mjs +38 -46
- package/reactjs/components/DisplayAmount/index.js +1 -4
- package/reactjs/components/DisplayAmount/index.mjs +2 -2
- package/reactjs/components/DisplayAmount/utils/index.js +1 -4
- package/reactjs/components/DisplayAmount/utils/index.mjs +2 -2
- package/reactjs/components/DisplayAmount/utils/truncateAmount.js +1 -21
- package/reactjs/components/DisplayAmount/utils/truncateAmount.mjs +9 -13
- package/reactjs/components/Error/Error.js +1 -66
- package/reactjs/components/Error/Error.mjs +29 -29
- package/reactjs/components/Error/index.js +1 -4
- package/reactjs/components/Error/index.mjs +2 -2
- package/reactjs/components/SmallLoader/SmallLoader.js +1 -21
- package/reactjs/components/SmallLoader/SmallLoader.mjs +13 -18
- package/reactjs/components/SmallLoader/index.js +1 -4
- package/reactjs/components/SmallLoader/index.mjs +2 -2
- package/reactjs/components/ToggleDirection/ToggleDirection.js +1 -30
- package/reactjs/components/ToggleDirection/ToggleDirection.mjs +22 -28
- package/reactjs/components/TokenSelector/TokenSelector.js +1 -172
- package/reactjs/components/TokenSelector/TokenSelector.mjs +98 -118
- package/reactjs/components/TokenSelector/components/ChainSelect/ChainSelect.js +1 -94
- package/reactjs/components/TokenSelector/components/ChainSelect/ChainSelect.mjs +48 -57
- package/reactjs/components/TokenSelector/components/ChainSelect/components/ChainOptionLabel.js +1 -51
- package/reactjs/components/TokenSelector/components/ChainSelect/components/ChainOptionLabel.mjs +45 -44
- package/reactjs/components/TokenSelector/components/ChainSelect/components/FormatChainOptionLabel.js +1 -18
- package/reactjs/components/TokenSelector/components/ChainSelect/components/FormatChainOptionLabel.mjs +9 -14
- package/reactjs/components/TokenSelector/components/ChainSelect/components/IndicatorSeparator.js +1 -6
- package/reactjs/components/TokenSelector/components/ChainSelect/components/IndicatorSeparator.mjs +2 -4
- package/reactjs/components/TokenSelector/components/ChainSelect/components/SelectedChainOption.js +1 -39
- package/reactjs/components/TokenSelector/components/ChainSelect/components/SelectedChainOption.mjs +22 -18
- package/reactjs/components/TokenSelector/components/SelectContainer.js +1 -40
- package/reactjs/components/TokenSelector/components/SelectContainer.mjs +36 -38
- package/reactjs/components/TokenSelector/components/SelectContent.js +1 -136
- package/reactjs/components/TokenSelector/components/SelectContent.mjs +79 -103
- package/reactjs/components/TokenSelector/components/SelectedOption.js +1 -28
- package/reactjs/components/TokenSelector/components/SelectedOption.mjs +22 -24
- package/reactjs/components/TokenSelector/components/TokenIcon.js +1 -81
- package/reactjs/components/TokenSelector/components/TokenIcon.mjs +52 -57
- package/reactjs/components/TokenSelector/components/TokenItem.js +1 -80
- package/reactjs/components/TokenSelector/components/TokenItem.mjs +41 -54
- package/reactjs/components/TokenSelector/components/TokenList.js +1 -23
- package/reactjs/components/TokenSelector/components/TokenList.mjs +19 -21
- package/reactjs/components/TokenSelector/components/TokenSymbol.js +1 -25
- package/reactjs/components/TokenSelector/components/TokenSymbol.mjs +14 -15
- package/reactjs/components/TokenSelector/index.js +1 -4
- package/reactjs/components/TokenSelector/index.mjs +2 -2
- package/reactjs/components/TransactionToast/TransactionToast.js +1 -53
- package/reactjs/components/TransactionToast/TransactionToast.mjs +27 -28
- package/reactjs/components/TransactionToast/TransactionToastContainer.js +1 -20
- package/reactjs/components/TransactionToast/TransactionToastContainer.mjs +16 -18
- package/reactjs/components/TransactionToast/index.js +1 -6
- package/reactjs/components/TransactionToast/index.mjs +4 -4
- package/reactjs/components/TrimAddress/TrimAddress.js +1 -27
- package/reactjs/components/TrimAddress/TrimAddress.mjs +19 -24
- package/reactjs/components/TrimAddress/index.js +1 -4
- package/reactjs/components/TrimAddress/index.mjs +2 -2
- package/reactjs/components/base/MxButton/MxButton.js +1 -71
- package/reactjs/components/base/MxButton/MxButton.mjs +46 -46
- package/reactjs/components/base/MxButton/index.js +1 -4
- package/reactjs/components/base/MxButton/index.mjs +2 -2
- package/reactjs/components/base/MxCard/MxCard.js +1 -54
- package/reactjs/components/base/MxCard/MxCard.mjs +34 -34
- package/reactjs/components/base/MxCard/index.js +1 -4
- package/reactjs/components/base/MxCard/index.mjs +2 -2
- package/reactjs/components/base/MxCircleLoader/MxCircleLoader.js +1 -28
- package/reactjs/components/base/MxCircleLoader/MxCircleLoader.mjs +24 -26
- package/reactjs/components/base/MxCircleLoader/index.js +1 -4
- package/reactjs/components/base/MxCircleLoader/index.mjs +2 -2
- package/reactjs/components/base/MxLink/MxLink.js +1 -70
- package/reactjs/components/base/MxLink/MxLink.mjs +44 -46
- package/reactjs/components/base/MxLink/index.js +1 -4
- package/reactjs/components/base/MxLink/index.mjs +2 -2
- package/reactjs/components/base/MxSearch/MxSearch.js +1 -69
- package/reactjs/components/base/MxSearch/MxSearch.mjs +37 -41
- package/reactjs/components/base/MxSearch/index.js +1 -4
- package/reactjs/components/base/MxSearch/index.mjs +2 -2
- package/reactjs/components/base/MxSlideover/MxSlideover.js +1 -78
- package/reactjs/components/base/MxSlideover/MxSlideover.mjs +72 -74
- package/reactjs/components/base/MxSlideover/index.js +1 -4
- package/reactjs/components/base/MxSlideover/index.mjs +2 -2
- package/reactjs/components/base/MxTooltip/MxTooltip.js +1 -163
- package/reactjs/components/base/MxTooltip/MxTooltip.mjs +92 -135
- package/reactjs/components/base/MxTooltip/components/TooltipContainer/TooltipContainer.js +1 -33
- package/reactjs/components/base/MxTooltip/components/TooltipContainer/TooltipContainer.mjs +29 -31
- package/reactjs/components/base/MxTooltip/components/TooltipContainer/index.js +1 -4
- package/reactjs/components/base/MxTooltip/components/TooltipContainer/index.mjs +2 -2
- package/reactjs/components/base/MxTooltip/components/TooltipContent/TooltipContent.js +1 -27
- package/reactjs/components/base/MxTooltip/components/TooltipContent/TooltipContent.mjs +23 -25
- package/reactjs/components/base/MxTooltip/components/TooltipContent/index.js +1 -4
- package/reactjs/components/base/MxTooltip/components/TooltipContent/index.mjs +2 -2
- package/reactjs/components/base/MxTooltip/components/index.js +1 -6
- package/reactjs/components/base/MxTooltip/components/index.mjs +4 -4
- package/reactjs/components/base/MxTooltip/index.js +1 -4
- package/reactjs/components/base/MxTooltip/index.mjs +2 -2
- package/reactjs/components/base/index.js +1 -14
- package/reactjs/components/base/index.mjs +12 -12
- package/reactjs/components/index.js +1 -54
- package/reactjs/components/index.mjs +52 -52
- package/reactjs/constants/chains.js +1 -54
- package/reactjs/constants/chains.mjs +33 -52
- package/reactjs/constants/index.js +1 -13
- package/reactjs/constants/index.mjs +9 -10
- package/reactjs/context/Web3AppProvider.js +1 -40
- package/reactjs/context/Web3AppProvider.mjs +34 -34
- package/reactjs/context/queryClient.js +1 -11
- package/reactjs/context/queryClient.mjs +5 -8
- package/reactjs/context/useWeb3App.js +1 -12
- package/reactjs/context/useWeb3App.mjs +7 -8
- package/reactjs/helpers/index.js +1 -6
- package/reactjs/helpers/index.mjs +4 -4
- package/reactjs/helpers/resolveBridgeApiChainId.js +1 -40
- package/reactjs/helpers/resolveBridgeApiChainId.mjs +21 -34
- package/reactjs/hooks/index.js +1 -35
- package/reactjs/hooks/index.mjs +33 -33
- package/reactjs/hooks/tests/useGenericSignMessage.spec.d.ts +1 -0
- package/reactjs/hooks/tests/useGenericSignMessage.spec.js +2 -0
- package/reactjs/hooks/tests/useGenericSignMessage.spec.mjs +52 -0
- package/reactjs/hooks/tests/useSignTransaction.spec.d.ts +1 -0
- package/reactjs/hooks/tests/useSignTransaction.spec.js +2 -0
- package/reactjs/hooks/tests/useSignTransaction.spec.mjs +156 -0
- package/reactjs/hooks/useAccount.js +1 -13
- package/reactjs/hooks/useAccount.mjs +7 -8
- package/reactjs/hooks/useBalances.js +1 -53
- package/reactjs/hooks/useBalances.mjs +28 -40
- package/reactjs/hooks/useBridgeApiChainId.js +1 -13
- package/reactjs/hooks/useBridgeApiChainId.mjs +9 -9
- package/reactjs/hooks/useBridgeFormik.js +1 -162
- package/reactjs/hooks/useBridgeFormik.mjs +110 -150
- package/reactjs/hooks/useDebounce.js +1 -13
- package/reactjs/hooks/useDebounce.mjs +8 -10
- package/reactjs/hooks/useFetchBridgeData.js +1 -45
- package/reactjs/hooks/useFetchBridgeData.mjs +37 -38
- package/reactjs/hooks/useFetchTokens.js +1 -113
- package/reactjs/hooks/useFetchTokens.mjs +80 -106
- package/reactjs/hooks/useGenericSignMessage.js +1 -55
- package/reactjs/hooks/useGenericSignMessage.mjs +47 -47
- package/reactjs/hooks/useGetChainId.js +1 -11
- package/reactjs/hooks/useGetChainId.mjs +7 -8
- package/reactjs/hooks/useResolveTokenChain.js +1 -20
- package/reactjs/hooks/useResolveTokenChain.mjs +11 -14
- package/reactjs/hooks/useSendTransactions.js +1 -25
- package/reactjs/hooks/useSendTransactions.mjs +19 -23
- package/reactjs/hooks/useSignTransaction.js +1 -86
- package/reactjs/hooks/useSignTransaction.mjs +59 -59
- package/reactjs/hooks/useSuiConnect.js +1 -86
- package/reactjs/hooks/useSuiConnect.mjs +52 -70
- package/reactjs/hooks/validation/index.js +1 -10
- package/reactjs/hooks/validation/index.mjs +8 -8
- package/reactjs/hooks/validation/useAmountSchema.js +1 -32
- package/reactjs/hooks/validation/useAmountSchema.mjs +8 -11
- package/reactjs/hooks/validation/useSecondAmountSchema.js +1 -26
- package/reactjs/hooks/validation/useSecondAmountSchema.mjs +5 -6
- package/reactjs/hooks/validation/useTestHasEnoughFunds.js +1 -37
- package/reactjs/hooks/validation/useTestHasEnoughFunds.mjs +20 -29
- package/reactjs/hooks/validation/useTestIsConnected.js +1 -27
- package/reactjs/hooks/validation/useTestIsConnected.mjs +13 -19
- package/reactjs/index.js +1 -190
- package/reactjs/index.mjs +154 -154
- package/reactjs/init/index.js +1 -5
- package/reactjs/init/index.mjs +3 -3
- package/reactjs/init/init.d.ts +1 -0
- package/reactjs/init/init.js +1 -139
- package/reactjs/init/init.mjs +59 -72
- package/reactjs/queries/index.js +1 -17
- package/reactjs/queries/index.mjs +15 -15
- package/reactjs/queries/useCheckAccount.query.js +1 -39
- package/reactjs/queries/useCheckAccount.query.mjs +29 -33
- package/reactjs/queries/useGetAllTokens.query.js +1 -35
- package/reactjs/queries/useGetAllTokens.query.mjs +26 -30
- package/reactjs/queries/useGetChains.query.js +1 -34
- package/reactjs/queries/useGetChains.query.mjs +26 -28
- package/reactjs/queries/useGetHistory.query.d.ts +1 -1
- package/reactjs/queries/useGetHistory.query.js +1 -68
- package/reactjs/queries/useGetHistory.query.mjs +55 -58
- package/reactjs/queries/useGetMvxTokensBalances.query.d.ts +1 -1
- package/reactjs/queries/useGetMvxTokensBalances.query.js +1 -71
- package/reactjs/queries/useGetMvxTokensBalances.query.mjs +40 -53
- package/reactjs/queries/useGetNonMvxTokensBalances.query.d.ts +1 -1
- package/reactjs/queries/useGetNonMvxTokensBalances.query.js +1 -81
- package/reactjs/queries/useGetNonMvxTokensBalances.query.mjs +51 -59
- package/reactjs/queries/useGetRate.mutation.js +1 -18
- package/reactjs/queries/useGetRate.mutation.mjs +12 -15
- package/reactjs/reexports.js +1 -48
- package/reactjs/reexports.mjs +13 -13
- package/reactjs/utils/delay.js +1 -6
- package/reactjs/utils/delay.mjs +3 -3
- package/reactjs/utils/formatAmount.js +1 -23
- package/reactjs/utils/formatAmount.mjs +16 -17
- package/reactjs/utils/getCleanStringAmount.js +1 -11
- package/reactjs/utils/getCleanStringAmount.mjs +6 -8
- package/reactjs/utils/getCompletePathname.js +1 -5
- package/reactjs/utils/getCompletePathname.mjs +3 -3
- package/reactjs/utils/getInitialTokens.js +1 -12
- package/reactjs/utils/getInitialTokens.mjs +6 -7
- package/reactjs/utils/hasEnoughFunds.js +1 -19
- package/reactjs/utils/hasEnoughFunds.mjs +11 -14
- package/reactjs/utils/index.js +1 -26
- package/reactjs/utils/index.mjs +24 -24
- package/reactjs/utils/isStringFloat.js +1 -21
- package/reactjs/utils/isStringFloat.mjs +11 -18
- package/reactjs/utils/mxClsx.js +1 -8
- package/reactjs/utils/mxClsx.mjs +4 -6
- package/reactjs/utils/pipe.js +1 -25
- package/reactjs/utils/pipe.mjs +13 -17
- package/reactjs/utils/removeCommas.js +1 -6
- package/reactjs/utils/removeCommas.mjs +2 -4
- package/reactjs/utils/roundAmount.js +1 -40
- package/reactjs/utils/roundAmount.mjs +16 -36
- package/reactjs/utils/testNumber.js +1 -4
- package/reactjs/utils/testNumber.mjs +2 -2
- package/store/inMemoryStore.js +1 -39
- package/store/inMemoryStore.mjs +17 -21
- package/style.css +1 -2274
- package/types/chainType.js +1 -11
- package/types/chainType.mjs +2 -9
- package/types/errors.d.ts +3 -0
- package/types/errors.js +2 -0
- package/types/errors.mjs +8 -0
- package/types/providerType.js +1 -9
- package/types/providerType.mjs +2 -7
- package/types/transaction.d.ts +2 -0
- package/all-networks-EJIVYZ_i.mjs +0 -4
- package/all-networks-NYACMyeN.js +0 -4
- package/default-BYtXv70Z.mjs +0 -4
- package/default-H3AbmzFV.js +0 -4
- package/reactjs/hooks/useSignTransaction.d.ts +0 -511
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
import { useAppKitProvider } from "@reown/appkit/react";
|
|
2
|
-
import { useAppKitConnection } from "@reown/appkit-adapter-solana/react";
|
|
3
|
-
import { TransactionInstruction, Transaction, PublicKey } from "@solana/web3.js";
|
|
4
|
-
import { useSendTransaction } from "wagmi";
|
|
5
|
-
const
|
|
1
|
+
import { useAppKitProvider as l, useAppKitAccount as S } from "@reown/appkit/react";
|
|
2
|
+
import { useAppKitConnection as v } from "@reown/appkit-adapter-solana/react";
|
|
3
|
+
import { TransactionInstruction as y, Transaction as E, PublicKey as b } from "@solana/web3.js";
|
|
4
|
+
import { useSendTransaction as A } from "wagmi";
|
|
5
|
+
const k = () => {
|
|
6
6
|
const {
|
|
7
|
-
data:
|
|
8
|
-
sendTransactionAsync:
|
|
9
|
-
...
|
|
10
|
-
} =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
feePayer,
|
|
17
|
-
instructions,
|
|
18
|
-
recentBlockhash
|
|
7
|
+
data: u,
|
|
8
|
+
sendTransactionAsync: g,
|
|
9
|
+
...h
|
|
10
|
+
} = A(), { connection: i } = v(), { walletProvider: w } = l("solana"), { walletProvider: s } = l("bip122"), { walletProvider: a } = l("sui"), { address: c } = S({
|
|
11
|
+
namespace: "sui"
|
|
12
|
+
}), p = async ({
|
|
13
|
+
feePayer: n,
|
|
14
|
+
instructions: t,
|
|
15
|
+
recentBlockhash: r
|
|
19
16
|
}) => {
|
|
20
|
-
for (const
|
|
21
|
-
const
|
|
22
|
-
...
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
transaction.feePayer = new PublicKey(feePayer);
|
|
26
|
-
if (connection) {
|
|
27
|
-
transaction.recentBlockhash = recentBlockhash ?? (await connection.getLatestBlockhash("confirmed")).blockhash;
|
|
28
|
-
}
|
|
29
|
-
return await solWalletProvider.signAndSendTransaction(transaction);
|
|
17
|
+
for (const e of t) {
|
|
18
|
+
const o = new y({
|
|
19
|
+
...e
|
|
20
|
+
}), d = new E().add(o);
|
|
21
|
+
return d.feePayer = new b(n), i && (d.recentBlockhash = r ?? (await i.getLatestBlockhash("confirmed")).blockhash), await w.signAndSendTransaction(d);
|
|
30
22
|
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (!btcWalletProvider) {
|
|
23
|
+
}, f = async (n) => {
|
|
24
|
+
if (!s)
|
|
34
25
|
throw Error("user is disconnected");
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
};
|
|
40
|
-
const signSuiTransaction = async (suiParams) => {
|
|
41
|
-
const transaction = (suiParams == null ? void 0 : suiParams.transaction) ?? (suiParams == null ? void 0 : suiParams.transactionBlock);
|
|
42
|
-
if (!transaction) {
|
|
26
|
+
return (await s.signPSBT(n)).psbt;
|
|
27
|
+
}, T = async (n) => {
|
|
28
|
+
const t = (n == null ? void 0 : n.transaction) ?? (n == null ? void 0 : n.transactionBlock);
|
|
29
|
+
if (!t)
|
|
43
30
|
throw new Error("No Sui transaction bytes provided");
|
|
44
|
-
|
|
45
|
-
if (!(suiParams == null ? void 0 : suiParams.address)) {
|
|
31
|
+
if (!(n != null && n.address))
|
|
46
32
|
throw new Error("No Sui sender address");
|
|
47
|
-
|
|
48
|
-
if (!suiWalletProvider) {
|
|
33
|
+
if (!a)
|
|
49
34
|
throw new Error("Sui wallet not connected");
|
|
35
|
+
const r = 32 * 1024;
|
|
36
|
+
if (!t || typeof t != "string")
|
|
37
|
+
throw new Error(
|
|
38
|
+
"Invalid Sui transaction: payload must be a non-empty string"
|
|
39
|
+
);
|
|
40
|
+
try {
|
|
41
|
+
if (atob(t).length > r)
|
|
42
|
+
throw new Error(
|
|
43
|
+
`Sui transaction payload exceeds maximum size of ${r} bytes`
|
|
44
|
+
);
|
|
45
|
+
} catch (o) {
|
|
46
|
+
throw o instanceof Error && o.message.includes("maximum size") ? o : new Error("Invalid Sui transaction: payload is not valid base64");
|
|
50
47
|
}
|
|
51
|
-
|
|
48
|
+
if (n.address && c && n.address !== c)
|
|
49
|
+
throw new Error(
|
|
50
|
+
`Sui address mismatch: expected ${c}, got ${n.address}`
|
|
51
|
+
);
|
|
52
|
+
const e = await a.request({
|
|
52
53
|
method: "sui_signTransaction",
|
|
53
54
|
params: {
|
|
54
|
-
transaction,
|
|
55
|
-
address:
|
|
55
|
+
transaction: t,
|
|
56
|
+
address: n.address
|
|
56
57
|
}
|
|
57
58
|
});
|
|
58
|
-
if (!
|
|
59
|
+
if (!e)
|
|
59
60
|
throw new Error("Sui wallet did not return a signature");
|
|
60
|
-
|
|
61
|
-
return result.signature;
|
|
61
|
+
return e.signature;
|
|
62
62
|
};
|
|
63
63
|
return {
|
|
64
64
|
evm: {
|
|
65
|
-
hash,
|
|
66
|
-
signTransaction:
|
|
67
|
-
...
|
|
65
|
+
hash: u,
|
|
66
|
+
signTransaction: g,
|
|
67
|
+
...h
|
|
68
68
|
},
|
|
69
69
|
solana: {
|
|
70
|
-
signTransaction:
|
|
71
|
-
connection,
|
|
72
|
-
walletProvider:
|
|
70
|
+
signTransaction: p,
|
|
71
|
+
connection: i,
|
|
72
|
+
walletProvider: w
|
|
73
73
|
},
|
|
74
74
|
bitcoin: {
|
|
75
|
-
signTransaction:
|
|
76
|
-
walletProvider:
|
|
75
|
+
signTransaction: f,
|
|
76
|
+
walletProvider: s
|
|
77
77
|
},
|
|
78
78
|
sui: {
|
|
79
|
-
signTransaction:
|
|
80
|
-
walletProvider:
|
|
79
|
+
signTransaction: T,
|
|
80
|
+
walletProvider: a
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
83
|
};
|
|
84
84
|
export {
|
|
85
|
-
useSignTransaction
|
|
85
|
+
k as useSignTransaction
|
|
86
86
|
};
|
|
@@ -1,87 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const react = require("@reown/appkit/react");
|
|
5
|
-
const appkitControllers = require("@reown/appkit-controllers");
|
|
6
|
-
const React = require("react");
|
|
7
|
-
const SUI_NS = "sui";
|
|
8
|
-
const STUCK_WHILE_MODAL_OPEN_MS = 6e4;
|
|
9
|
-
const STUCK_WHILE_MODAL_CLOSED_MS = 8e3;
|
|
10
|
-
const MODAL_CLOSE_SETTLE_MS = 200;
|
|
11
|
-
const WC_RECONNECT_GRACE_MS = 25e3;
|
|
12
|
-
function useSuiConnect() {
|
|
13
|
-
const { open: openAppKitModal } = react.useAppKit();
|
|
14
|
-
const { open: isModalOpen } = react.useAppKitState();
|
|
15
|
-
const { disconnect: appKitDisconnect } = react.useDisconnect();
|
|
16
|
-
const appKitAccount = react.useAppKitAccount({ namespace: SUI_NS });
|
|
17
|
-
const wasModalOpenRef = React.useRef(isModalOpen);
|
|
18
|
-
const [reconnectGraceExpired, setReconnectGraceExpired] = React.useState(false);
|
|
19
|
-
React.useEffect(() => {
|
|
20
|
-
const t = globalThis.setTimeout(
|
|
21
|
-
() => setReconnectGraceExpired(true),
|
|
22
|
-
WC_RECONNECT_GRACE_MS
|
|
23
|
-
);
|
|
24
|
-
return () => globalThis.clearTimeout(t);
|
|
25
|
-
}, []);
|
|
26
|
-
const clearStuckConnecting = React.useCallback(async () => {
|
|
27
|
-
if (appKitAccount.status !== "connecting" || appKitAccount.isConnected) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
try {
|
|
31
|
-
await appKitDisconnect({ namespace: SUI_NS });
|
|
32
|
-
} catch {
|
|
33
|
-
}
|
|
34
|
-
try {
|
|
35
|
-
appkitControllers.ChainController.resetAccount(SUI_NS);
|
|
36
|
-
} catch {
|
|
37
|
-
}
|
|
38
|
-
}, [appKitAccount.status, appKitAccount.isConnected, appKitDisconnect]);
|
|
39
|
-
React.useEffect(() => {
|
|
40
|
-
const prev = wasModalOpenRef.current;
|
|
41
|
-
wasModalOpenRef.current = isModalOpen;
|
|
42
|
-
if (prev === true && isModalOpen === false) {
|
|
43
|
-
const t = globalThis.setTimeout(() => {
|
|
44
|
-
void clearStuckConnecting();
|
|
45
|
-
}, MODAL_CLOSE_SETTLE_MS);
|
|
46
|
-
return () => globalThis.clearTimeout(t);
|
|
47
|
-
}
|
|
48
|
-
}, [isModalOpen, clearStuckConnecting]);
|
|
49
|
-
React.useEffect(() => {
|
|
50
|
-
if (appKitAccount.status !== "connecting" || appKitAccount.isConnected) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
if (!reconnectGraceExpired) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
const delayMs = isModalOpen ? STUCK_WHILE_MODAL_OPEN_MS : STUCK_WHILE_MODAL_CLOSED_MS;
|
|
57
|
-
const t = globalThis.setTimeout(() => {
|
|
58
|
-
void clearStuckConnecting();
|
|
59
|
-
}, delayMs);
|
|
60
|
-
return () => globalThis.clearTimeout(t);
|
|
61
|
-
}, [
|
|
62
|
-
appKitAccount.status,
|
|
63
|
-
appKitAccount.isConnected,
|
|
64
|
-
isModalOpen,
|
|
65
|
-
reconnectGraceExpired,
|
|
66
|
-
clearStuckConnecting
|
|
67
|
-
]);
|
|
68
|
-
const connect = React.useCallback(() => {
|
|
69
|
-
openAppKitModal({ view: "Connect", namespace: SUI_NS });
|
|
70
|
-
}, [openAppKitModal]);
|
|
71
|
-
const disconnect = React.useCallback(async () => {
|
|
72
|
-
try {
|
|
73
|
-
await appKitDisconnect({ namespace: SUI_NS });
|
|
74
|
-
} catch (error) {
|
|
75
|
-
console.error("Sui disconnect failed:", error);
|
|
76
|
-
}
|
|
77
|
-
}, [appKitDisconnect]);
|
|
78
|
-
return {
|
|
79
|
-
suiAddress: appKitAccount.address ?? null,
|
|
80
|
-
isConnecting: appKitAccount.status === "connecting",
|
|
81
|
-
isConnected: appKitAccount.isConnected,
|
|
82
|
-
connect,
|
|
83
|
-
disconnect,
|
|
84
|
-
cancelPendingConnection: clearStuckConnecting
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
exports.useSuiConnect = useSuiConnect;
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@reown/appkit/react"),T=require("@reown/appkit-controllers"),t=require("react"),o="sui",f=6e4,E=8e3,_=200,g=25e3;function b(){const{open:u}=a.useAppKit(),{open:c}=a.useAppKitState(),{disconnect:i}=a.useDisconnect(),e=a.useAppKitAccount({namespace:o}),l=t.useRef(c),[p,d]=t.useState(!1);t.useEffect(()=>{const n=globalThis.setTimeout(()=>d(!0),g);return()=>globalThis.clearTimeout(n)},[]);const s=t.useCallback(async()=>{if(!(e.status!=="connecting"||e.isConnected)){try{await i({namespace:o})}catch{}try{T.ChainController.resetAccount(o)}catch{}}},[e.status,e.isConnected,i]);t.useEffect(()=>{const n=l.current;if(l.current=c,n===!0&&c===!1){const r=globalThis.setTimeout(()=>{s()},_);return()=>globalThis.clearTimeout(r)}},[c,s]),t.useEffect(()=>{if(e.status!=="connecting"||e.isConnected||!p)return;const n=c?f:E,r=globalThis.setTimeout(()=>{s()},n);return()=>globalThis.clearTimeout(r)},[e.status,e.isConnected,c,p,s]);const C=t.useCallback(()=>{u({view:"Connect",namespace:o})},[u]),S=t.useCallback(async()=>{try{await i({namespace:o})}catch(n){console.error("Sui disconnect failed:",n)}},[i]);return{suiAddress:e.address??null,isConnecting:e.status==="connecting",isConnected:e.isConnected,connect:C,disconnect:S,cancelPendingConnection:s}}exports.useSuiConnect=b;
|
|
@@ -1,86 +1,68 @@
|
|
|
1
|
-
import { useAppKit, useAppKitState, useDisconnect, useAppKitAccount } from "@reown/appkit/react";
|
|
2
|
-
import { ChainController } from "@reown/appkit-controllers";
|
|
3
|
-
import { useRef, useState, useEffect, useCallback } from "react";
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
const WC_RECONNECT_GRACE_MS = 25e3;
|
|
9
|
-
function useSuiConnect() {
|
|
10
|
-
const { open: openAppKitModal } = useAppKit();
|
|
11
|
-
const { open: isModalOpen } = useAppKitState();
|
|
12
|
-
const { disconnect: appKitDisconnect } = useDisconnect();
|
|
13
|
-
const appKitAccount = useAppKitAccount({ namespace: SUI_NS });
|
|
14
|
-
const wasModalOpenRef = useRef(isModalOpen);
|
|
15
|
-
const [reconnectGraceExpired, setReconnectGraceExpired] = useState(false);
|
|
16
|
-
useEffect(() => {
|
|
1
|
+
import { useAppKit as m, useAppKitState as S, useDisconnect as f, useAppKitAccount as _ } from "@reown/appkit/react";
|
|
2
|
+
import { ChainController as E } from "@reown/appkit-controllers";
|
|
3
|
+
import { useRef as g, useState as A, useEffect as a, useCallback as r } from "react";
|
|
4
|
+
const o = "sui", M = 6e4, h = 8e3, O = 200, K = 25e3;
|
|
5
|
+
function D() {
|
|
6
|
+
const { open: u } = m(), { open: n } = S(), { disconnect: s } = f(), e = _({ namespace: o }), l = g(n), [p, d] = A(!1);
|
|
7
|
+
a(() => {
|
|
17
8
|
const t = globalThis.setTimeout(
|
|
18
|
-
() =>
|
|
19
|
-
|
|
9
|
+
() => d(!0),
|
|
10
|
+
K
|
|
20
11
|
);
|
|
21
12
|
return () => globalThis.clearTimeout(t);
|
|
22
13
|
}, []);
|
|
23
|
-
const
|
|
24
|
-
if (
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
} catch {
|
|
14
|
+
const c = r(async () => {
|
|
15
|
+
if (!(e.status !== "connecting" || e.isConnected)) {
|
|
16
|
+
try {
|
|
17
|
+
await s({ namespace: o });
|
|
18
|
+
} catch {
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
E.resetAccount(o);
|
|
22
|
+
} catch {
|
|
23
|
+
}
|
|
34
24
|
}
|
|
35
|
-
}, [
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return () => globalThis.clearTimeout(t);
|
|
25
|
+
}, [e.status, e.isConnected, s]);
|
|
26
|
+
a(() => {
|
|
27
|
+
const t = l.current;
|
|
28
|
+
if (l.current = n, t === !0 && n === !1) {
|
|
29
|
+
const i = globalThis.setTimeout(() => {
|
|
30
|
+
c();
|
|
31
|
+
}, O);
|
|
32
|
+
return () => globalThis.clearTimeout(i);
|
|
44
33
|
}
|
|
45
|
-
}, [
|
|
46
|
-
|
|
47
|
-
if (appKitAccount.status !== "connecting" || appKitAccount.isConnected) {
|
|
34
|
+
}, [n, c]), a(() => {
|
|
35
|
+
if (e.status !== "connecting" || e.isConnected || !p)
|
|
48
36
|
return;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const delayMs = isModalOpen ? STUCK_WHILE_MODAL_OPEN_MS : STUCK_WHILE_MODAL_CLOSED_MS;
|
|
54
|
-
const t = globalThis.setTimeout(() => {
|
|
55
|
-
void clearStuckConnecting();
|
|
56
|
-
}, delayMs);
|
|
57
|
-
return () => globalThis.clearTimeout(t);
|
|
37
|
+
const t = n ? M : h, i = globalThis.setTimeout(() => {
|
|
38
|
+
c();
|
|
39
|
+
}, t);
|
|
40
|
+
return () => globalThis.clearTimeout(i);
|
|
58
41
|
}, [
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
42
|
+
e.status,
|
|
43
|
+
e.isConnected,
|
|
44
|
+
n,
|
|
45
|
+
p,
|
|
46
|
+
c
|
|
64
47
|
]);
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
}, [
|
|
68
|
-
const disconnect = useCallback(async () => {
|
|
48
|
+
const C = r(() => {
|
|
49
|
+
u({ view: "Connect", namespace: o });
|
|
50
|
+
}, [u]), T = r(async () => {
|
|
69
51
|
try {
|
|
70
|
-
await
|
|
71
|
-
} catch (
|
|
72
|
-
console.error("Sui disconnect failed:",
|
|
52
|
+
await s({ namespace: o });
|
|
53
|
+
} catch (t) {
|
|
54
|
+
console.error("Sui disconnect failed:", t);
|
|
73
55
|
}
|
|
74
|
-
}, [
|
|
56
|
+
}, [s]);
|
|
75
57
|
return {
|
|
76
|
-
suiAddress:
|
|
77
|
-
isConnecting:
|
|
78
|
-
isConnected:
|
|
79
|
-
connect,
|
|
80
|
-
disconnect,
|
|
81
|
-
cancelPendingConnection:
|
|
58
|
+
suiAddress: e.address ?? null,
|
|
59
|
+
isConnecting: e.status === "connecting",
|
|
60
|
+
isConnected: e.isConnected,
|
|
61
|
+
connect: C,
|
|
62
|
+
disconnect: T,
|
|
63
|
+
cancelPendingConnection: c
|
|
82
64
|
};
|
|
83
65
|
}
|
|
84
66
|
export {
|
|
85
|
-
useSuiConnect
|
|
67
|
+
D as useSuiConnect
|
|
86
68
|
};
|
|
@@ -1,11 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const reactjs_hooks_validation_useAmountSchema = require("./useAmountSchema.js");
|
|
5
|
-
const reactjs_hooks_validation_useSecondAmountSchema = require("./useSecondAmountSchema.js");
|
|
6
|
-
const reactjs_hooks_validation_useTestHasEnoughFunds = require("./useTestHasEnoughFunds.js");
|
|
7
|
-
const reactjs_hooks_validation_useTestIsConnected = require("./useTestIsConnected.js");
|
|
8
|
-
exports.useAmountSchema = reactjs_hooks_validation_useAmountSchema.useAmountSchema;
|
|
9
|
-
exports.useSecondAmountSchema = reactjs_hooks_validation_useSecondAmountSchema.useSecondAmountSchema;
|
|
10
|
-
exports.useTestHasEnoughFunds = reactjs_hooks_validation_useTestHasEnoughFunds.useTestHasEnoughFunds;
|
|
11
|
-
exports.useTestIsConnected = reactjs_hooks_validation_useTestIsConnected.useTestIsConnected;
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useAmountSchema.js"),s=require("./useSecondAmountSchema.js"),o=require("./useTestHasEnoughFunds.js"),n=require("./useTestIsConnected.js");exports.useAmountSchema=e.useAmountSchema;exports.useSecondAmountSchema=s.useSecondAmountSchema;exports.useTestHasEnoughFunds=o.useTestHasEnoughFunds;exports.useTestIsConnected=n.useTestIsConnected;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { useAmountSchema } from "./useAmountSchema.mjs";
|
|
2
|
-
import { useSecondAmountSchema } from "./useSecondAmountSchema.mjs";
|
|
3
|
-
import { useTestHasEnoughFunds } from "./useTestHasEnoughFunds.mjs";
|
|
4
|
-
import { useTestIsConnected } from "./useTestIsConnected.mjs";
|
|
1
|
+
import { useAmountSchema as s } from "./useAmountSchema.mjs";
|
|
2
|
+
import { useSecondAmountSchema as m } from "./useSecondAmountSchema.mjs";
|
|
3
|
+
import { useTestHasEnoughFunds as u } from "./useTestHasEnoughFunds.mjs";
|
|
4
|
+
import { useTestIsConnected as c } from "./useTestIsConnected.mjs";
|
|
5
5
|
export {
|
|
6
|
-
useAmountSchema,
|
|
7
|
-
useSecondAmountSchema,
|
|
8
|
-
useTestHasEnoughFunds,
|
|
9
|
-
useTestIsConnected
|
|
6
|
+
s as useAmountSchema,
|
|
7
|
+
m as useSecondAmountSchema,
|
|
8
|
+
u as useTestHasEnoughFunds,
|
|
9
|
+
c as useTestIsConnected
|
|
10
10
|
};
|
|
@@ -1,33 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const yup = require("yup");
|
|
5
|
-
const reactjs_hooks_validation_useTestHasEnoughFunds = require("./useTestHasEnoughFunds.js");
|
|
6
|
-
const reactjs_hooks_validation_useTestIsConnected = require("./useTestIsConnected.js");
|
|
7
|
-
function _interopNamespaceDefault(e) {
|
|
8
|
-
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
9
|
-
if (e) {
|
|
10
|
-
for (const k in e) {
|
|
11
|
-
if (k !== "default") {
|
|
12
|
-
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
13
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: () => e[k]
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
n.default = e;
|
|
21
|
-
return Object.freeze(n);
|
|
22
|
-
}
|
|
23
|
-
const yup__namespace = /* @__PURE__ */ _interopNamespaceDefault(yup);
|
|
24
|
-
const useAmountSchema = ({
|
|
25
|
-
isMvxConnected
|
|
26
|
-
}) => {
|
|
27
|
-
const testHasEnoughFunds = reactjs_hooks_validation_useTestHasEnoughFunds.useTestHasEnoughFunds();
|
|
28
|
-
const testIsConnected = reactjs_hooks_validation_useTestIsConnected.useTestIsConnected({ isMvxConnected });
|
|
29
|
-
const testStartDot = (value) => !(value == null ? void 0 : value.startsWith("."));
|
|
30
|
-
const testEndDot = (value) => !(value == null ? void 0 : value.endsWith("."));
|
|
31
|
-
return yup__namespace.string().required("Amount is a required field").test("account", testIsConnected).test("startDot", "Amount must not start with dot", testStartDot).test("endDot", "Amount must not end with dot", testEndDot).test("funds", testHasEnoughFunds);
|
|
32
|
-
};
|
|
33
|
-
exports.useAmountSchema = useAmountSchema;
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("yup"),c=require("./useTestHasEnoughFunds.js"),i=require("./useTestIsConnected.js");function d(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const o=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(n,s,o.get?o:{enumerable:!0,get:()=>t[s]})}}return n.default=t,Object.freeze(n)}const a=d(u),m=({isMvxConnected:t})=>{const n=c.useTestHasEnoughFunds(),s=i.useTestIsConnected({isMvxConnected:t}),o=e=>!(e!=null&&e.startsWith(".")),r=e=>!(e!=null&&e.endsWith("."));return a.string().required("Amount is a required field").test("account",s).test("startDot","Amount must not start with dot",o).test("endDot","Amount must not end with dot",r).test("funds",n)};exports.useAmountSchema=m;
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { useTestHasEnoughFunds } from "./useTestHasEnoughFunds.mjs";
|
|
3
|
-
import { useTestIsConnected } from "./useTestIsConnected.mjs";
|
|
4
|
-
const
|
|
5
|
-
isMvxConnected
|
|
1
|
+
import * as d from "yup";
|
|
2
|
+
import { useTestHasEnoughFunds as m } from "./useTestHasEnoughFunds.mjs";
|
|
3
|
+
import { useTestIsConnected as i } from "./useTestIsConnected.mjs";
|
|
4
|
+
const h = ({
|
|
5
|
+
isMvxConnected: s
|
|
6
6
|
}) => {
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const testStartDot = (value) => !(value == null ? void 0 : value.startsWith("."));
|
|
10
|
-
const testEndDot = (value) => !(value == null ? void 0 : value.endsWith("."));
|
|
11
|
-
return yup.string().required("Amount is a required field").test("account", testIsConnected).test("startDot", "Amount must not start with dot", testStartDot).test("endDot", "Amount must not end with dot", testEndDot).test("funds", testHasEnoughFunds);
|
|
7
|
+
const o = m(), n = i({ isMvxConnected: s }), e = (t) => !(t != null && t.startsWith(".")), r = (t) => !(t != null && t.endsWith("."));
|
|
8
|
+
return d.string().required("Amount is a required field").test("account", n).test("startDot", "Amount must not start with dot", e).test("endDot", "Amount must not end with dot", r).test("funds", o);
|
|
12
9
|
};
|
|
13
10
|
export {
|
|
14
|
-
useAmountSchema
|
|
11
|
+
h as useAmountSchema
|
|
15
12
|
};
|
|
@@ -1,27 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const yup = require("yup");
|
|
5
|
-
function _interopNamespaceDefault(e) {
|
|
6
|
-
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
7
|
-
if (e) {
|
|
8
|
-
for (const k in e) {
|
|
9
|
-
if (k !== "default") {
|
|
10
|
-
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
11
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
get: () => e[k]
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
n.default = e;
|
|
19
|
-
return Object.freeze(n);
|
|
20
|
-
}
|
|
21
|
-
const yup__namespace = /* @__PURE__ */ _interopNamespaceDefault(yup);
|
|
22
|
-
const useSecondAmountSchema = () => {
|
|
23
|
-
const testStartDot = (value) => !(value == null ? void 0 : value.startsWith("."));
|
|
24
|
-
const testEndDot = (value) => !(value == null ? void 0 : value.endsWith("."));
|
|
25
|
-
return yup__namespace.string().required("Amount is a required field").test("startDot", "Amount must not start with dot", testStartDot).test("endDot", "Amount must not end with dot", testEndDot);
|
|
26
|
-
};
|
|
27
|
-
exports.useSecondAmountSchema = useSecondAmountSchema;
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("yup");function s(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const c=s(r),i=()=>{const e=t=>!(t!=null&&t.startsWith(".")),n=t=>!(t!=null&&t.endsWith("."));return c.string().required("Amount is a required field").test("startDot","Amount must not start with dot",e).test("endDot","Amount must not end with dot",n)};exports.useSecondAmountSchema=i;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
return yup.string().required("Amount is a required field").test("startDot", "Amount must not start with dot", testStartDot).test("endDot", "Amount must not end with dot", testEndDot);
|
|
1
|
+
import * as n from "yup";
|
|
2
|
+
const r = () => {
|
|
3
|
+
const o = (t) => !(t != null && t.startsWith(".")), s = (t) => !(t != null && t.endsWith("."));
|
|
4
|
+
return n.string().required("Amount is a required field").test("startDot", "Amount must not start with dot", o).test("endDot", "Amount must not end with dot", s);
|
|
6
5
|
};
|
|
7
6
|
export {
|
|
8
|
-
useSecondAmountSchema
|
|
7
|
+
r as useSecondAmountSchema
|
|
9
8
|
};
|
|
@@ -1,38 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const React = require("react");
|
|
5
|
-
const reactjs_utils_hasEnoughFunds = require("../../utils/hasEnoughFunds.js");
|
|
6
|
-
const reactjs_utils_testNumber = require("../../utils/testNumber.js");
|
|
7
|
-
const useTestHasEnoughFunds = () => {
|
|
8
|
-
const shouldThrow = React.useCallback(
|
|
9
|
-
(value, context) => {
|
|
10
|
-
if (!reactjs_utils_testNumber.testNumber(value)) {
|
|
11
|
-
return false;
|
|
12
|
-
}
|
|
13
|
-
const asset = context.parent.firstToken;
|
|
14
|
-
const balance = (asset == null ? void 0 : asset.balance) ?? "0";
|
|
15
|
-
const decimals = asset == null ? void 0 : asset.decimals;
|
|
16
|
-
const hasFunds = reactjs_utils_hasEnoughFunds.hasEnoughFunds({
|
|
17
|
-
balance: balance ?? "0",
|
|
18
|
-
amount: value ?? "0",
|
|
19
|
-
decimals
|
|
20
|
-
});
|
|
21
|
-
return !hasFunds;
|
|
22
|
-
},
|
|
23
|
-
[]
|
|
24
|
-
);
|
|
25
|
-
return React.useCallback(
|
|
26
|
-
(value, context) => {
|
|
27
|
-
if (!shouldThrow(value, context)) {
|
|
28
|
-
return true;
|
|
29
|
-
}
|
|
30
|
-
return context.createError({
|
|
31
|
-
message: "Not enough funds",
|
|
32
|
-
path: context.path
|
|
33
|
-
});
|
|
34
|
-
},
|
|
35
|
-
[shouldThrow]
|
|
36
|
-
);
|
|
37
|
-
};
|
|
38
|
-
exports.useTestHasEnoughFunds = useTestHasEnoughFunds;
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),o=require("../../utils/hasEnoughFunds.js"),c=require("../../utils/testNumber.js"),l=()=>{const u=r.useCallback((n,s)=>{if(!c.testNumber(n))return!1;const e=s.parent.firstToken,t=(e==null?void 0:e.balance)??"0",a=e==null?void 0:e.decimals;return!o.hasEnoughFunds({balance:t??"0",amount:n??"0",decimals:a})},[]);return r.useCallback((n,s)=>u(n,s)?s.createError({message:"Not enough funds",path:s.path}):!0,[u])};exports.useTestHasEnoughFunds=l;
|
|
@@ -1,37 +1,28 @@
|
|
|
1
|
-
import { useCallback } from "react";
|
|
2
|
-
import { hasEnoughFunds } from "../../utils/hasEnoughFunds.mjs";
|
|
3
|
-
import { testNumber } from "../../utils/testNumber.mjs";
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
(
|
|
7
|
-
if (!
|
|
8
|
-
return
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
balance: balance ?? "0",
|
|
15
|
-
amount: value ?? "0",
|
|
16
|
-
decimals
|
|
1
|
+
import { useCallback as e } from "react";
|
|
2
|
+
import { hasEnoughFunds as a } from "../../utils/hasEnoughFunds.mjs";
|
|
3
|
+
import { testNumber as c } from "../../utils/testNumber.mjs";
|
|
4
|
+
const i = () => {
|
|
5
|
+
const s = e(
|
|
6
|
+
(o, n) => {
|
|
7
|
+
if (!c(o))
|
|
8
|
+
return !1;
|
|
9
|
+
const r = n.parent.firstToken, t = (r == null ? void 0 : r.balance) ?? "0", u = r == null ? void 0 : r.decimals;
|
|
10
|
+
return !a({
|
|
11
|
+
balance: t ?? "0",
|
|
12
|
+
amount: o ?? "0",
|
|
13
|
+
decimals: u
|
|
17
14
|
});
|
|
18
|
-
return !hasFunds;
|
|
19
15
|
},
|
|
20
16
|
[]
|
|
21
17
|
);
|
|
22
|
-
return
|
|
23
|
-
(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
message: "Not enough funds",
|
|
29
|
-
path: context.path
|
|
30
|
-
});
|
|
31
|
-
},
|
|
32
|
-
[shouldThrow]
|
|
18
|
+
return e(
|
|
19
|
+
(o, n) => s(o, n) ? n.createError({
|
|
20
|
+
message: "Not enough funds",
|
|
21
|
+
path: n.path
|
|
22
|
+
}) : !0,
|
|
23
|
+
[s]
|
|
33
24
|
);
|
|
34
25
|
};
|
|
35
26
|
export {
|
|
36
|
-
useTestHasEnoughFunds
|
|
27
|
+
i as useTestHasEnoughFunds
|
|
37
28
|
};
|
|
@@ -1,28 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const React = require("react");
|
|
5
|
-
const helpers_getMvxChainId = require("../../../helpers/getMvxChainId.js");
|
|
6
|
-
const reactjs_hooks_useAccount = require("../useAccount.js");
|
|
7
|
-
const useTestIsConnected = ({
|
|
8
|
-
isMvxConnected
|
|
9
|
-
}) => {
|
|
10
|
-
const { address } = reactjs_hooks_useAccount.useAccount();
|
|
11
|
-
return React.useCallback(
|
|
12
|
-
(_value, context) => {
|
|
13
|
-
const firstToken = context.parent.firstToken;
|
|
14
|
-
const mvxChainId = helpers_getMvxChainId.getMvxChainId();
|
|
15
|
-
const isFromMvxChain = (firstToken == null ? void 0 : firstToken.chainId) === mvxChainId;
|
|
16
|
-
const isConnected = isFromMvxChain ? isMvxConnected : Boolean(address);
|
|
17
|
-
if (isConnected) {
|
|
18
|
-
return true;
|
|
19
|
-
}
|
|
20
|
-
return context.createError({
|
|
21
|
-
message: "Please connect your wallet",
|
|
22
|
-
path: context.path
|
|
23
|
-
});
|
|
24
|
-
},
|
|
25
|
-
[address, isMvxConnected]
|
|
26
|
-
);
|
|
27
|
-
};
|
|
28
|
-
exports.useTestIsConnected = useTestIsConnected;
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react"),c=require("../../../helpers/getMvxChainId.js"),a=require("../useAccount.js"),u=({isMvxConnected:s})=>{const{address:t}=a.useAccount();return o.useCallback((i,e)=>{const n=e.parent.firstToken,r=c.getMvxChainId();return((n==null?void 0:n.chainId)===r?s:!!t)?!0:e.createError({message:"Please connect your wallet",path:e.path})},[t,s])};exports.useTestIsConnected=u;
|