@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,34 +1,32 @@
|
|
|
1
|
-
import { useQuery } from "@tanstack/react-query";
|
|
2
|
-
import { useWeb3App } from "../context/useWeb3App.mjs";
|
|
3
|
-
import { getChains } from "../../api/getChains.mjs";
|
|
4
|
-
import { getApiURL } from "../../helpers/getApiURL.mjs";
|
|
5
|
-
const
|
|
6
|
-
const { nativeAuthToken, bridgeOnly } =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
retry,
|
|
27
|
-
refetchOnWindowFocus: false,
|
|
1
|
+
import { useQuery as s } from "@tanstack/react-query";
|
|
2
|
+
import { useWeb3App as u } from "../context/useWeb3App.mjs";
|
|
3
|
+
import { getChains as i } from "../../api/getChains.mjs";
|
|
4
|
+
import { getApiURL as a } from "../../helpers/getApiURL.mjs";
|
|
5
|
+
const l = () => {
|
|
6
|
+
const { nativeAuthToken: n, bridgeOnly: r } = u();
|
|
7
|
+
return s({
|
|
8
|
+
queryKey: ["chains", r],
|
|
9
|
+
queryFn: async () => {
|
|
10
|
+
try {
|
|
11
|
+
const { data: e } = await i({
|
|
12
|
+
url: a(),
|
|
13
|
+
nativeAuthToken: n,
|
|
14
|
+
bridgeOnly: !!r
|
|
15
|
+
});
|
|
16
|
+
return e;
|
|
17
|
+
} catch (e) {
|
|
18
|
+
throw e;
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
retry: (e, o) => {
|
|
22
|
+
var t;
|
|
23
|
+
return ((t = o.response) == null ? void 0 : t.status) === 404;
|
|
24
|
+
},
|
|
25
|
+
refetchOnWindowFocus: !1,
|
|
28
26
|
gcTime: 5 * 60 * 1e3,
|
|
29
27
|
staleTime: 0
|
|
30
28
|
});
|
|
31
29
|
};
|
|
32
30
|
export {
|
|
33
|
-
useGetChainsQuery
|
|
31
|
+
l as useGetChainsQuery
|
|
34
32
|
};
|
|
@@ -10,5 +10,5 @@ type HistoryQueryType = {
|
|
|
10
10
|
tokenOut?: string;
|
|
11
11
|
};
|
|
12
12
|
export declare const useGetHistoryQuery: ({ address, sender, provider, status, tokenIn, tokenOut }?: HistoryQueryType) => import('@tanstack/react-query').UseQueryResult<import('../..').TransactionDTO[], AxiosError<unknown, any>>;
|
|
13
|
-
export declare const
|
|
13
|
+
export declare const useInvalidateHistoryQuery: () => () => void;
|
|
14
14
|
export {};
|
|
@@ -1,69 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const reactQuery = require("@tanstack/react-query");
|
|
5
|
-
const api_getTransactions = require("../../api/getTransactions.js");
|
|
6
|
-
const helpers_getApiURL = require("../../helpers/getApiURL.js");
|
|
7
|
-
const reactjs_context_queryClient = require("../context/queryClient.js");
|
|
8
|
-
const reactjs_context_useWeb3App = require("../context/useWeb3App.js");
|
|
9
|
-
const useGetHistoryQuery = ({
|
|
10
|
-
address,
|
|
11
|
-
sender,
|
|
12
|
-
provider,
|
|
13
|
-
status,
|
|
14
|
-
tokenIn,
|
|
15
|
-
tokenOut
|
|
16
|
-
} = {}) => {
|
|
17
|
-
const { nativeAuthToken } = reactjs_context_useWeb3App.useWeb3App();
|
|
18
|
-
const queryFn = async () => {
|
|
19
|
-
if (!address) {
|
|
20
|
-
throw new Error("User is not connected");
|
|
21
|
-
}
|
|
22
|
-
try {
|
|
23
|
-
const { data } = await api_getTransactions.getTransactions({
|
|
24
|
-
url: helpers_getApiURL.getApiURL(),
|
|
25
|
-
address,
|
|
26
|
-
sender,
|
|
27
|
-
provider,
|
|
28
|
-
status,
|
|
29
|
-
tokenIn,
|
|
30
|
-
tokenOut,
|
|
31
|
-
nativeAuthToken
|
|
32
|
-
});
|
|
33
|
-
return data;
|
|
34
|
-
} catch (error) {
|
|
35
|
-
throw error;
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
const retry = (_failureCount, error) => {
|
|
39
|
-
var _a;
|
|
40
|
-
return ((_a = error.response) == null ? void 0 : _a.status) === 404;
|
|
41
|
-
};
|
|
42
|
-
return reactQuery.useQuery({
|
|
43
|
-
queryKey: [
|
|
44
|
-
"user-history",
|
|
45
|
-
address,
|
|
46
|
-
sender,
|
|
47
|
-
provider,
|
|
48
|
-
status,
|
|
49
|
-
tokenIn,
|
|
50
|
-
tokenOut,
|
|
51
|
-
nativeAuthToken
|
|
52
|
-
],
|
|
53
|
-
queryFn,
|
|
54
|
-
retry,
|
|
55
|
-
enabled: Boolean(address),
|
|
56
|
-
refetchOnWindowFocus: false,
|
|
57
|
-
refetchIntervalInBackground: true,
|
|
58
|
-
refetchInterval: 1e4,
|
|
59
|
-
gcTime: 0
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
const invalidateHistoryQuery = () => {
|
|
63
|
-
const queryClient = reactjs_context_queryClient.getQueryClient();
|
|
64
|
-
queryClient.invalidateQueries({
|
|
65
|
-
queryKey: ["user-history"]
|
|
66
|
-
});
|
|
67
|
-
};
|
|
68
|
-
exports.invalidateHistoryQuery = invalidateHistoryQuery;
|
|
69
|
-
exports.useGetHistoryQuery = useGetHistoryQuery;
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@tanstack/react-query"),p=require("react"),q=require("../../api/getTransactions.js"),g=require("../../helpers/getApiURL.js"),Q=require("../context/useWeb3App.js"),b=({address:e,sender:t,provider:n,status:u,tokenIn:s,tokenOut:o}={})=>{const{nativeAuthToken:a}=Q.useWeb3App(),y=async()=>{if(!e)throw new Error("User is not connected");try{const{data:r}=await q.getTransactions({url:g.getApiURL(),address:e,sender:t,provider:n,status:u,tokenIn:s,tokenOut:o,nativeAuthToken:a});return r}catch(r){throw r}},l=(r,h)=>{var i;return((i=h.response)==null?void 0:i.status)===404};return c.useQuery({queryKey:["user-history",e,t,n,u,s,o],queryFn:y,retry:l,enabled:!!e,refetchOnWindowFocus:!1,refetchIntervalInBackground:!0,refetchInterval:1e4,gcTime:0})},f=()=>{const e=c.useQueryClient();return p.useCallback(()=>{e.invalidateQueries({queryKey:["user-history"]})},[e])};exports.useGetHistoryQuery=b;exports.useInvalidateHistoryQuery=f;
|
|
@@ -1,68 +1,65 @@
|
|
|
1
|
-
import { useQuery } from "@tanstack/react-query";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { useWeb3App } from "../context/useWeb3App.mjs";
|
|
6
|
-
const
|
|
7
|
-
address,
|
|
8
|
-
sender,
|
|
9
|
-
provider,
|
|
10
|
-
status,
|
|
11
|
-
tokenIn,
|
|
12
|
-
tokenOut
|
|
1
|
+
import { useQuery as y, useQueryClient as l } from "@tanstack/react-query";
|
|
2
|
+
import { useCallback as f } from "react";
|
|
3
|
+
import { getTransactions as m } from "../../api/getTransactions.mjs";
|
|
4
|
+
import { getApiURL as h } from "../../helpers/getApiURL.mjs";
|
|
5
|
+
import { useWeb3App as p } from "../context/useWeb3App.mjs";
|
|
6
|
+
const A = ({
|
|
7
|
+
address: r,
|
|
8
|
+
sender: t,
|
|
9
|
+
provider: o,
|
|
10
|
+
status: n,
|
|
11
|
+
tokenIn: u,
|
|
12
|
+
tokenOut: i
|
|
13
13
|
} = {}) => {
|
|
14
|
-
const { nativeAuthToken } =
|
|
15
|
-
|
|
16
|
-
if (!address) {
|
|
17
|
-
throw new Error("User is not connected");
|
|
18
|
-
}
|
|
19
|
-
try {
|
|
20
|
-
const { data } = await getTransactions({
|
|
21
|
-
url: getApiURL(),
|
|
22
|
-
address,
|
|
23
|
-
sender,
|
|
24
|
-
provider,
|
|
25
|
-
status,
|
|
26
|
-
tokenIn,
|
|
27
|
-
tokenOut,
|
|
28
|
-
nativeAuthToken
|
|
29
|
-
});
|
|
30
|
-
return data;
|
|
31
|
-
} catch (error) {
|
|
32
|
-
throw error;
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
const retry = (_failureCount, error) => {
|
|
36
|
-
var _a;
|
|
37
|
-
return ((_a = error.response) == null ? void 0 : _a.status) === 404;
|
|
38
|
-
};
|
|
39
|
-
return useQuery({
|
|
14
|
+
const { nativeAuthToken: c } = p();
|
|
15
|
+
return y({
|
|
40
16
|
queryKey: [
|
|
41
17
|
"user-history",
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
nativeAuthToken
|
|
18
|
+
r,
|
|
19
|
+
t,
|
|
20
|
+
o,
|
|
21
|
+
n,
|
|
22
|
+
u,
|
|
23
|
+
i
|
|
49
24
|
],
|
|
50
|
-
queryFn
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
25
|
+
queryFn: async () => {
|
|
26
|
+
if (!r)
|
|
27
|
+
throw new Error("User is not connected");
|
|
28
|
+
try {
|
|
29
|
+
const { data: e } = await m({
|
|
30
|
+
url: h(),
|
|
31
|
+
address: r,
|
|
32
|
+
sender: t,
|
|
33
|
+
provider: o,
|
|
34
|
+
status: n,
|
|
35
|
+
tokenIn: u,
|
|
36
|
+
tokenOut: i,
|
|
37
|
+
nativeAuthToken: c
|
|
38
|
+
});
|
|
39
|
+
return e;
|
|
40
|
+
} catch (e) {
|
|
41
|
+
throw e;
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
retry: (e, a) => {
|
|
45
|
+
var s;
|
|
46
|
+
return ((s = a.response) == null ? void 0 : s.status) === 404;
|
|
47
|
+
},
|
|
48
|
+
enabled: !!r,
|
|
49
|
+
refetchOnWindowFocus: !1,
|
|
50
|
+
refetchIntervalInBackground: !0,
|
|
55
51
|
refetchInterval: 1e4,
|
|
56
52
|
gcTime: 0
|
|
57
53
|
});
|
|
58
|
-
}
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
54
|
+
}, F = () => {
|
|
55
|
+
const r = l();
|
|
56
|
+
return f(() => {
|
|
57
|
+
r.invalidateQueries({
|
|
58
|
+
queryKey: ["user-history"]
|
|
59
|
+
});
|
|
60
|
+
}, [r]);
|
|
64
61
|
};
|
|
65
62
|
export {
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
A as useGetHistoryQuery,
|
|
64
|
+
F as useInvalidateHistoryQuery
|
|
68
65
|
};
|
|
@@ -26,4 +26,4 @@ export declare const useGetMvxTokensBalancesQuery: ({ tokens, mvxAddress, apiURL
|
|
|
26
26
|
}[];
|
|
27
27
|
isNative?: boolean;
|
|
28
28
|
}[], AxiosError<unknown, any>>;
|
|
29
|
-
export declare function
|
|
29
|
+
export declare function useInvalidateMvxTokensBalancesQuery(): () => void;
|
|
@@ -1,72 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const reactQuery = require("@tanstack/react-query");
|
|
5
|
-
const axios = require("axios");
|
|
6
|
-
const React = require("react");
|
|
7
|
-
const reactjs_context_queryClient = require("../context/queryClient.js");
|
|
8
|
-
const reactjs_context_useWeb3App = require("../context/useWeb3App.js");
|
|
9
|
-
const useGetMvxTokensBalancesQuery = ({
|
|
10
|
-
tokens,
|
|
11
|
-
mvxAddress,
|
|
12
|
-
apiURL
|
|
13
|
-
}) => {
|
|
14
|
-
const { nativeAuthToken } = reactjs_context_useWeb3App.useWeb3App();
|
|
15
|
-
const tokenIdentifiers = React.useMemo(() => {
|
|
16
|
-
return tokens.map(({ address }) => address);
|
|
17
|
-
}, [tokens]);
|
|
18
|
-
const url = `${apiURL}/accounts/${mvxAddress}/tokens?identifiers=${tokenIdentifiers}`;
|
|
19
|
-
const config = {
|
|
20
|
-
headers: {
|
|
21
|
-
Authorization: `Bearer ${nativeAuthToken}`
|
|
22
|
-
},
|
|
23
|
-
timeout: 3e3
|
|
24
|
-
};
|
|
25
|
-
const queryFn = async () => {
|
|
26
|
-
const { data } = await axios.get(url, config);
|
|
27
|
-
return data.map((asset) => {
|
|
28
|
-
var _a;
|
|
29
|
-
const foundToken = tokens.find(
|
|
30
|
-
(token) => token.address.toLowerCase() === asset.identifier.toLowerCase()
|
|
31
|
-
);
|
|
32
|
-
if (!foundToken) {
|
|
33
|
-
throw new Error("Token not found");
|
|
34
|
-
}
|
|
35
|
-
return {
|
|
36
|
-
...foundToken,
|
|
37
|
-
balance: ((_a = asset.balance) == null ? void 0 : _a.toString()) ?? "0",
|
|
38
|
-
address: asset.identifier,
|
|
39
|
-
symbol: asset.ticker ?? foundToken.symbol
|
|
40
|
-
};
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
const retry = (_failureCount, error) => {
|
|
44
|
-
var _a;
|
|
45
|
-
return ((_a = error.response) == null ? void 0 : _a.status) === 404;
|
|
46
|
-
};
|
|
47
|
-
return reactQuery.useQuery({
|
|
48
|
-
queryKey: [
|
|
49
|
-
"mvx-tokens-balances",
|
|
50
|
-
mvxAddress,
|
|
51
|
-
tokenIdentifiers.sort(),
|
|
52
|
-
nativeAuthToken
|
|
53
|
-
],
|
|
54
|
-
queryFn,
|
|
55
|
-
retry,
|
|
56
|
-
enabled: Boolean(mvxAddress) && tokenIdentifiers.length > 0,
|
|
57
|
-
refetchOnWindowFocus: false,
|
|
58
|
-
refetchIntervalInBackground: true,
|
|
59
|
-
refetchInterval: 2e4,
|
|
60
|
-
refetchOnReconnect: "always",
|
|
61
|
-
gcTime: 0
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
function invalidateMvxTokensBalancesQuery() {
|
|
65
|
-
const queryKey = ["mvx-tokens-balances"];
|
|
66
|
-
const queryClient = reactjs_context_queryClient.getQueryClient();
|
|
67
|
-
queryClient.invalidateQueries({
|
|
68
|
-
queryKey
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
exports.invalidateMvxTokensBalancesQuery = invalidateMvxTokensBalancesQuery;
|
|
72
|
-
exports.useGetMvxTokensBalancesQuery = useGetMvxTokensBalancesQuery;
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("@tanstack/react-query"),v=require("axios"),c=require("react"),h=require("../context/useWeb3App.js"),T=({tokens:e,mvxAddress:o,apiURL:i})=>{const{nativeAuthToken:l}=h.useWeb3App(),a=c.useMemo(()=>e.map(({address:r})=>r),[e]),y=`${i}/accounts/${o}/tokens?identifiers=${a}`,d={headers:{Authorization:`Bearer ${l}`},timeout:3e3},f=async()=>{const{data:r}=await v.get(y,d);return r.map(n=>{var s;const t=e.find(k=>k.address.toLowerCase()===n.identifier.toLowerCase());if(!t)throw new Error("Token not found");return{...t,balance:((s=n.balance)==null?void 0:s.toString())??"0",address:n.identifier,symbol:n.ticker??t.symbol}})},b=(r,n)=>{var t;return((t=n.response)==null?void 0:t.status)===404};return u.useQuery({queryKey:["mvx-tokens-balances",o,a.sort()],queryFn:f,retry:b,enabled:!!o&&a.length>0,refetchOnWindowFocus:!1,refetchIntervalInBackground:!0,refetchInterval:2e4,refetchOnReconnect:"always",gcTime:0})};function g(){const e=u.useQueryClient();return c.useCallback(()=>{e.invalidateQueries({queryKey:["mvx-tokens-balances"]})},[e])}exports.useGetMvxTokensBalancesQuery=T;exports.useInvalidateMvxTokensBalancesQuery=g;
|
|
@@ -1,71 +1,58 @@
|
|
|
1
|
-
import { useQuery } from "@tanstack/react-query";
|
|
2
|
-
import
|
|
3
|
-
import { useMemo } from "react";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
apiURL
|
|
1
|
+
import { useQuery as d, useQueryClient as k } from "@tanstack/react-query";
|
|
2
|
+
import p from "axios";
|
|
3
|
+
import { useMemo as b, useCallback as h } from "react";
|
|
4
|
+
import { useWeb3App as v } from "../context/useWeb3App.mjs";
|
|
5
|
+
const B = ({
|
|
6
|
+
tokens: e,
|
|
7
|
+
mvxAddress: o,
|
|
8
|
+
apiURL: i
|
|
10
9
|
}) => {
|
|
11
|
-
const { nativeAuthToken } =
|
|
12
|
-
const tokenIdentifiers = useMemo(() => {
|
|
13
|
-
return tokens.map(({ address }) => address);
|
|
14
|
-
}, [tokens]);
|
|
15
|
-
const url = `${apiURL}/accounts/${mvxAddress}/tokens?identifiers=${tokenIdentifiers}`;
|
|
16
|
-
const config = {
|
|
10
|
+
const { nativeAuthToken: u } = v(), a = b(() => e.map(({ address: r }) => r), [e]), c = `${i}/accounts/${o}/tokens?identifiers=${a}`, l = {
|
|
17
11
|
headers: {
|
|
18
|
-
Authorization: `Bearer ${
|
|
12
|
+
Authorization: `Bearer ${u}`
|
|
19
13
|
},
|
|
20
14
|
timeout: 3e3
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
(token) => token.address.toLowerCase() === asset.identifier.toLowerCase()
|
|
15
|
+
}, f = async () => {
|
|
16
|
+
const { data: r } = await p.get(c, l);
|
|
17
|
+
return r.map((n) => {
|
|
18
|
+
var s;
|
|
19
|
+
const t = e.find(
|
|
20
|
+
(y) => y.address.toLowerCase() === n.identifier.toLowerCase()
|
|
28
21
|
);
|
|
29
|
-
if (!
|
|
22
|
+
if (!t)
|
|
30
23
|
throw new Error("Token not found");
|
|
31
|
-
}
|
|
32
24
|
return {
|
|
33
|
-
...
|
|
34
|
-
balance: ((
|
|
35
|
-
address:
|
|
36
|
-
symbol:
|
|
25
|
+
...t,
|
|
26
|
+
balance: ((s = n.balance) == null ? void 0 : s.toString()) ?? "0",
|
|
27
|
+
address: n.identifier,
|
|
28
|
+
symbol: n.ticker ?? t.symbol
|
|
37
29
|
};
|
|
38
30
|
});
|
|
31
|
+
}, m = (r, n) => {
|
|
32
|
+
var t;
|
|
33
|
+
return ((t = n.response) == null ? void 0 : t.status) === 404;
|
|
39
34
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
mvxAddress,
|
|
48
|
-
tokenIdentifiers.sort(),
|
|
49
|
-
nativeAuthToken
|
|
50
|
-
],
|
|
51
|
-
queryFn,
|
|
52
|
-
retry,
|
|
53
|
-
enabled: Boolean(mvxAddress) && tokenIdentifiers.length > 0,
|
|
54
|
-
refetchOnWindowFocus: false,
|
|
55
|
-
refetchIntervalInBackground: true,
|
|
35
|
+
return d({
|
|
36
|
+
queryKey: ["mvx-tokens-balances", o, a.sort()],
|
|
37
|
+
queryFn: f,
|
|
38
|
+
retry: m,
|
|
39
|
+
enabled: !!o && a.length > 0,
|
|
40
|
+
refetchOnWindowFocus: !1,
|
|
41
|
+
refetchIntervalInBackground: !0,
|
|
56
42
|
refetchInterval: 2e4,
|
|
57
43
|
refetchOnReconnect: "always",
|
|
58
44
|
gcTime: 0
|
|
59
45
|
});
|
|
60
46
|
};
|
|
61
|
-
function
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
47
|
+
function I() {
|
|
48
|
+
const e = k();
|
|
49
|
+
return h(() => {
|
|
50
|
+
e.invalidateQueries({
|
|
51
|
+
queryKey: ["mvx-tokens-balances"]
|
|
52
|
+
});
|
|
53
|
+
}, [e]);
|
|
67
54
|
}
|
|
68
55
|
export {
|
|
69
|
-
|
|
70
|
-
|
|
56
|
+
B as useGetMvxTokensBalancesQuery,
|
|
57
|
+
I as useInvalidateMvxTokensBalancesQuery
|
|
71
58
|
};
|
|
@@ -25,4 +25,4 @@ export declare const useGetNonMvxTokensBalancesQuery: ({ tokens, chainId }: {
|
|
|
25
25
|
}[];
|
|
26
26
|
isNative?: boolean;
|
|
27
27
|
}[], AxiosError<unknown, any>>;
|
|
28
|
-
export declare function
|
|
28
|
+
export declare function useInvalidateEvmTokensBalances(): () => void;
|
|
@@ -1,82 +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 reactQuery = require("@tanstack/react-query");
|
|
6
|
-
const React = require("react");
|
|
7
|
-
const reactjs_context_queryClient = require("../context/queryClient.js");
|
|
8
|
-
require("yup");
|
|
9
|
-
require("@multiversx/sdk-dapp-utils/out/helpers/parseAmount");
|
|
10
|
-
require("bignumber.js");
|
|
11
|
-
require("wagmi");
|
|
12
|
-
const reactjs_hooks_useBalances = require("../hooks/useBalances.js");
|
|
13
|
-
require("formik");
|
|
14
|
-
require("axios");
|
|
15
|
-
require("../context/Web3AppProvider.js");
|
|
16
|
-
require("../constants/index.js");
|
|
17
|
-
require("@reown/appkit-adapter-solana/react");
|
|
18
|
-
require("@solana/web3.js");
|
|
19
|
-
require("@reown/appkit-controllers");
|
|
20
|
-
const useGetNonMvxTokensBalancesQuery = ({
|
|
21
|
-
tokens,
|
|
22
|
-
chainId
|
|
23
|
-
}) => {
|
|
24
|
-
const { address } = react.useAppKitAccount();
|
|
25
|
-
const { getBalances } = reactjs_hooks_useBalances.useBalances();
|
|
26
|
-
const identifiers = React.useMemo(
|
|
27
|
-
() => tokens.map((token) => token.address),
|
|
28
|
-
[tokens]
|
|
29
|
-
);
|
|
30
|
-
const queryFn = async () => {
|
|
31
|
-
try {
|
|
32
|
-
if (!address) {
|
|
33
|
-
throw new Error("User address is required");
|
|
34
|
-
}
|
|
35
|
-
if (!chainId) {
|
|
36
|
-
throw new Error("Chain ID is required");
|
|
37
|
-
}
|
|
38
|
-
const assets = await getBalances({
|
|
39
|
-
tokens,
|
|
40
|
-
chainId
|
|
41
|
-
});
|
|
42
|
-
return assets.map((asset) => {
|
|
43
|
-
const foundToken = tokens.find(
|
|
44
|
-
(token) => token.address.toLowerCase() === asset.tokenId.toLowerCase()
|
|
45
|
-
);
|
|
46
|
-
if (!foundToken) {
|
|
47
|
-
throw new Error("Token not found");
|
|
48
|
-
}
|
|
49
|
-
return {
|
|
50
|
-
...foundToken,
|
|
51
|
-
balance: asset.balance.toString()
|
|
52
|
-
};
|
|
53
|
-
});
|
|
54
|
-
} catch (error) {
|
|
55
|
-
throw error;
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
const retry = (_failureCount, error) => {
|
|
59
|
-
var _a;
|
|
60
|
-
return ((_a = error.response) == null ? void 0 : _a.status) === 404;
|
|
61
|
-
};
|
|
62
|
-
return reactQuery.useQuery({
|
|
63
|
-
queryKey: ["non-mvx-tokens-balances", address, chainId, identifiers],
|
|
64
|
-
queryFn,
|
|
65
|
-
retry,
|
|
66
|
-
enabled: Boolean(address) && Boolean(chainId),
|
|
67
|
-
refetchOnWindowFocus: false,
|
|
68
|
-
refetchIntervalInBackground: true,
|
|
69
|
-
refetchInterval: 2e4,
|
|
70
|
-
refetchOnReconnect: "always",
|
|
71
|
-
gcTime: 0
|
|
72
|
-
});
|
|
73
|
-
};
|
|
74
|
-
function invalidateEvmTokensBalances() {
|
|
75
|
-
const queryKey = ["non-mvx-tokens-balances"];
|
|
76
|
-
const queryClient = reactjs_context_queryClient.getQueryClient();
|
|
77
|
-
queryClient.invalidateQueries({
|
|
78
|
-
queryKey
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
exports.invalidateEvmTokensBalances = invalidateEvmTokensBalances;
|
|
82
|
-
exports.useGetNonMvxTokensBalancesQuery = useGetNonMvxTokensBalancesQuery;
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("@reown/appkit/react"),a=require("@tanstack/react-query"),u=require("react");require("yup");require("@multiversx/sdk-dapp-utils/out/helpers/parseAmount");require("bignumber.js");require("wagmi");const f=require("../hooks/useBalances.js");require("formik");require("axios");require("../context/Web3AppProvider.js");require("../constants/index.js");require("@reown/appkit-adapter-solana/react");require("@solana/web3.js");require("@reown/appkit-controllers");const v=({tokens:e,chainId:s})=>{const{address:o}=y.useAppKitAccount(),{getBalances:c}=f.useBalances(),i=u.useMemo(()=>e.map(r=>r.address),[e]),l=async()=>{try{if(!o)throw new Error("User address is required");if(!s)throw new Error("Chain ID is required");return(await c({tokens:e,chainId:s})).map(t=>{const n=e.find(q=>q.address.toLowerCase()===t.tokenId.toLowerCase());if(!n)throw new Error("Token not found");return{...n,balance:t.balance.toString()}})}catch(r){throw r}},d=(r,t)=>{var n;return((n=t.response)==null?void 0:n.status)===404};return a.useQuery({queryKey:["non-mvx-tokens-balances",o,s,i],queryFn:l,retry:d,enabled:!!o&&!!s,refetchOnWindowFocus:!1,refetchIntervalInBackground:!0,refetchInterval:2e4,refetchOnReconnect:"always",gcTime:0})};function w(){const e=a.useQueryClient();return u.useCallback(()=>{e.invalidateQueries({queryKey:["non-mvx-tokens-balances"]})},[e])}exports.useGetNonMvxTokensBalancesQuery=v;exports.useInvalidateEvmTokensBalances=w;
|