@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,69 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
const axios = require("axios");
|
|
4
|
-
const api_getTokens = require("../getTokens.js");
|
|
5
|
-
jest.mock("axios");
|
|
6
|
-
const mockedAxios = axios;
|
|
7
|
-
describe("getTokens", () => {
|
|
8
|
-
const url = "https://api.example.com";
|
|
9
|
-
it("fetches tokens successfully without chainId", async () => {
|
|
10
|
-
const response = [
|
|
11
|
-
{
|
|
12
|
-
chainId: "1",
|
|
13
|
-
address: "0x123",
|
|
14
|
-
name: "Token One",
|
|
15
|
-
symbol: "T1",
|
|
16
|
-
decimals: 18,
|
|
17
|
-
crosschain: true,
|
|
18
|
-
pngUrl: "https://example.com/logo.png",
|
|
19
|
-
svgUrl: "https://example.com/logo.svg",
|
|
20
|
-
metadata: {
|
|
21
|
-
minBridgeAmount: "1",
|
|
22
|
-
maxBridgeAmount: "100"
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
];
|
|
26
|
-
mockedAxios.get.mockResolvedValue({ data: response });
|
|
27
|
-
const result = await api_getTokens.getTokens({
|
|
28
|
-
url,
|
|
29
|
-
nativeAuthToken: "",
|
|
30
|
-
bridgeOnly: false
|
|
31
|
-
});
|
|
32
|
-
expect(mockedAxios.get).toHaveBeenCalled();
|
|
33
|
-
expect(result.data).toEqual(response);
|
|
34
|
-
});
|
|
35
|
-
it("fetches tokens successfully with chainId", async () => {
|
|
36
|
-
const chainId = 1;
|
|
37
|
-
const response = [
|
|
38
|
-
{
|
|
39
|
-
chainId: "1",
|
|
40
|
-
address: "0x123",
|
|
41
|
-
name: "Token One",
|
|
42
|
-
symbol: "T1",
|
|
43
|
-
decimals: 18,
|
|
44
|
-
crosschain: true,
|
|
45
|
-
pngUrl: "https://example.com/logo.png",
|
|
46
|
-
svgUrl: "https://example.com/logo.svg",
|
|
47
|
-
metadata: {
|
|
48
|
-
minBridgeAmount: "1",
|
|
49
|
-
maxBridgeAmount: "100"
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
];
|
|
53
|
-
mockedAxios.get.mockResolvedValue({ data: response });
|
|
54
|
-
const result = await api_getTokens.getTokens({
|
|
55
|
-
url,
|
|
56
|
-
chainId,
|
|
57
|
-
nativeAuthToken: "",
|
|
58
|
-
bridgeOnly: false
|
|
59
|
-
});
|
|
60
|
-
expect(mockedAxios.get).toHaveBeenCalled();
|
|
61
|
-
expect(result.data).toEqual(response);
|
|
62
|
-
});
|
|
63
|
-
it("handles error when fetching tokens", async () => {
|
|
64
|
-
mockedAxios.get.mockRejectedValue(new Error("Network Error"));
|
|
65
|
-
await expect(
|
|
66
|
-
api_getTokens.getTokens({ url, nativeAuthToken: "", bridgeOnly: false })
|
|
67
|
-
).rejects.toThrow("Network Error");
|
|
68
|
-
});
|
|
69
|
-
});
|
|
2
|
+
"use strict";const c=require("axios"),a=require("../getTokens.js");jest.mock("axios");const e=c;describe("getTokens",()=>{const s="https://api.example.com";it("fetches tokens successfully without chainId",async()=>{const o=[{chainId:"1",address:"0x123",name:"Token One",symbol:"T1",decimals:18,crosschain:!0,pngUrl:"https://example.com/logo.png",svgUrl:"https://example.com/logo.svg",metadata:{minBridgeAmount:"1",maxBridgeAmount:"100"}}];e.get.mockResolvedValue({data:o});const t=await a.getTokens({url:s,nativeAuthToken:"",bridgeOnly:!1});expect(e.get).toHaveBeenCalled(),expect(t.data).toEqual(o)}),it("fetches tokens successfully with chainId",async()=>{const t=[{chainId:"1",address:"0x123",name:"Token One",symbol:"T1",decimals:18,crosschain:!0,pngUrl:"https://example.com/logo.png",svgUrl:"https://example.com/logo.svg",metadata:{minBridgeAmount:"1",maxBridgeAmount:"100"}}];e.get.mockResolvedValue({data:t});const n=await a.getTokens({url:s,chainId:1,nativeAuthToken:"",bridgeOnly:!1});expect(e.get).toHaveBeenCalled(),expect(n.data).toEqual(t)}),it("handles error when fetching tokens",async()=>{e.get.mockRejectedValue(new Error("Network Error")),await expect(a.getTokens({url:s,nativeAuthToken:"",bridgeOnly:!1})).rejects.toThrow("Network Error")})});
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { getTokens } from "../getTokens.mjs";
|
|
1
|
+
import c from "axios";
|
|
2
|
+
import { getTokens as s } from "../getTokens.mjs";
|
|
3
3
|
jest.mock("axios");
|
|
4
|
-
const
|
|
4
|
+
const e = c;
|
|
5
5
|
describe("getTokens", () => {
|
|
6
|
-
const
|
|
6
|
+
const o = "https://api.example.com";
|
|
7
7
|
it("fetches tokens successfully without chainId", async () => {
|
|
8
|
-
const
|
|
8
|
+
const a = [
|
|
9
9
|
{
|
|
10
10
|
chainId: "1",
|
|
11
11
|
address: "0x123",
|
|
12
12
|
name: "Token One",
|
|
13
13
|
symbol: "T1",
|
|
14
14
|
decimals: 18,
|
|
15
|
-
crosschain:
|
|
15
|
+
crosschain: !0,
|
|
16
16
|
pngUrl: "https://example.com/logo.png",
|
|
17
17
|
svgUrl: "https://example.com/logo.svg",
|
|
18
18
|
metadata: {
|
|
@@ -21,25 +21,22 @@ describe("getTokens", () => {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
];
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
url,
|
|
24
|
+
e.get.mockResolvedValue({ data: a });
|
|
25
|
+
const t = await s({
|
|
26
|
+
url: o,
|
|
27
27
|
nativeAuthToken: "",
|
|
28
|
-
bridgeOnly:
|
|
28
|
+
bridgeOnly: !1
|
|
29
29
|
});
|
|
30
|
-
expect(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
it("fetches tokens successfully with chainId", async () => {
|
|
34
|
-
const chainId = 1;
|
|
35
|
-
const response = [
|
|
30
|
+
expect(e.get).toHaveBeenCalled(), expect(t.data).toEqual(a);
|
|
31
|
+
}), it("fetches tokens successfully with chainId", async () => {
|
|
32
|
+
const t = [
|
|
36
33
|
{
|
|
37
34
|
chainId: "1",
|
|
38
35
|
address: "0x123",
|
|
39
36
|
name: "Token One",
|
|
40
37
|
symbol: "T1",
|
|
41
38
|
decimals: 18,
|
|
42
|
-
crosschain:
|
|
39
|
+
crosschain: !0,
|
|
43
40
|
pngUrl: "https://example.com/logo.png",
|
|
44
41
|
svgUrl: "https://example.com/logo.svg",
|
|
45
42
|
metadata: {
|
|
@@ -48,20 +45,17 @@ describe("getTokens", () => {
|
|
|
48
45
|
}
|
|
49
46
|
}
|
|
50
47
|
];
|
|
51
|
-
|
|
52
|
-
const
|
|
53
|
-
url,
|
|
54
|
-
chainId,
|
|
48
|
+
e.get.mockResolvedValue({ data: t });
|
|
49
|
+
const n = await s({
|
|
50
|
+
url: o,
|
|
51
|
+
chainId: 1,
|
|
55
52
|
nativeAuthToken: "",
|
|
56
|
-
bridgeOnly:
|
|
53
|
+
bridgeOnly: !1
|
|
57
54
|
});
|
|
58
|
-
expect(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
mockedAxios.get.mockRejectedValue(new Error("Network Error"));
|
|
63
|
-
await expect(
|
|
64
|
-
getTokens({ url, nativeAuthToken: "", bridgeOnly: false })
|
|
55
|
+
expect(e.get).toHaveBeenCalled(), expect(n.data).toEqual(t);
|
|
56
|
+
}), it("handles error when fetching tokens", async () => {
|
|
57
|
+
e.get.mockRejectedValue(new Error("Network Error")), await expect(
|
|
58
|
+
s({ url: o, nativeAuthToken: "", bridgeOnly: !1 })
|
|
65
59
|
).rejects.toThrow("Network Error");
|
|
66
60
|
});
|
|
67
61
|
});
|
|
@@ -1,95 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
const axios = require("axios");
|
|
4
|
-
const types_providerType = require("../../types/providerType.js");
|
|
5
|
-
const api_getTransactions = require("../getTransactions.js");
|
|
6
|
-
jest.mock("axios");
|
|
7
|
-
const mockedAxios = axios;
|
|
8
|
-
describe("getTransactions", () => {
|
|
9
|
-
const url = "https://api.example.com";
|
|
10
|
-
const mockResponse = [
|
|
11
|
-
{
|
|
12
|
-
fromChainId: "97",
|
|
13
|
-
toChainId: "44",
|
|
14
|
-
tokenIn: "0x063b637324e6115f8da67f761A99B7F00B7Fd908",
|
|
15
|
-
tokenOut: "USDT-58d5d0",
|
|
16
|
-
amountIn: "11000000",
|
|
17
|
-
amountOut: "11000000",
|
|
18
|
-
depositTimestamp: 1738054613,
|
|
19
|
-
sender: "0x1009c2f59e03c383ca8f2766cfe305a1e79f4c8d",
|
|
20
|
-
status: "success",
|
|
21
|
-
receiver: "erd1sp0aaszznqnuvyvkmxkv2ultcvlf637c093sfc26dszks60jdqsqy2knqu",
|
|
22
|
-
txHash: "0xe7e706c1793d06a252a3f040f07732989e4a6466d804cae17105c09818bc2994",
|
|
23
|
-
fee: "0",
|
|
24
|
-
provider: types_providerType.ProviderType.MultiversxBridge
|
|
25
|
-
}
|
|
26
|
-
];
|
|
27
|
-
beforeEach(() => {
|
|
28
|
-
mockedAxios.get.mockClear();
|
|
29
|
-
mockedAxios.get.mockResolvedValue({ data: mockResponse });
|
|
30
|
-
});
|
|
31
|
-
it("fetches transactions with only address parameter", async () => {
|
|
32
|
-
const address = "0x123";
|
|
33
|
-
const result = await api_getTransactions.getTransactions({ url, address, nativeAuthToken: "" });
|
|
34
|
-
expect(mockedAxios.get).toHaveBeenCalled();
|
|
35
|
-
expect(result.data).toEqual(mockResponse);
|
|
36
|
-
});
|
|
37
|
-
it("fetches transactions with empty address", async () => {
|
|
38
|
-
const address = "";
|
|
39
|
-
const result = await api_getTransactions.getTransactions({ url, address, nativeAuthToken: "" });
|
|
40
|
-
expect(mockedAxios.get).toHaveBeenCalled();
|
|
41
|
-
expect(result.data).toEqual(mockResponse);
|
|
42
|
-
});
|
|
43
|
-
it("includes all non-empty parameters in the query", async () => {
|
|
44
|
-
const result = await api_getTransactions.getTransactions({
|
|
45
|
-
url,
|
|
46
|
-
address: "0x123",
|
|
47
|
-
sender: "0xABC",
|
|
48
|
-
provider: types_providerType.ProviderType.MultiversxBridge,
|
|
49
|
-
status: "success",
|
|
50
|
-
tokenIn: "0xTOKEN",
|
|
51
|
-
tokenOut: "WEGLD-123456",
|
|
52
|
-
nativeAuthToken: ""
|
|
53
|
-
});
|
|
54
|
-
expect(mockedAxios.get).toHaveBeenCalled();
|
|
55
|
-
expect(result.data).toEqual(mockResponse);
|
|
56
|
-
});
|
|
57
|
-
it("excludes empty parameters from the query", async () => {
|
|
58
|
-
const result = await api_getTransactions.getTransactions({
|
|
59
|
-
url,
|
|
60
|
-
address: "0x123",
|
|
61
|
-
sender: "",
|
|
62
|
-
provider: types_providerType.ProviderType.MultiversxBridge,
|
|
63
|
-
status: "",
|
|
64
|
-
tokenIn: "0xTOKEN",
|
|
65
|
-
tokenOut: "",
|
|
66
|
-
nativeAuthToken: ""
|
|
67
|
-
});
|
|
68
|
-
expect(mockedAxios.get).toHaveBeenCalled();
|
|
69
|
-
expect(result.data).toEqual(mockResponse);
|
|
70
|
-
});
|
|
71
|
-
it("handles axios error", async () => {
|
|
72
|
-
const error = new Error("Network error");
|
|
73
|
-
mockedAxios.get.mockRejectedValueOnce(error);
|
|
74
|
-
await expect(
|
|
75
|
-
api_getTransactions.getTransactions({ url, address: "0x123", nativeAuthToken: "" })
|
|
76
|
-
).rejects.toThrow("Network error");
|
|
77
|
-
expect(mockedAxios.get).toHaveBeenCalled();
|
|
78
|
-
});
|
|
79
|
-
it("passes through axios response", async () => {
|
|
80
|
-
const axiosResponse = {
|
|
81
|
-
data: mockResponse,
|
|
82
|
-
status: 200,
|
|
83
|
-
statusText: "OK",
|
|
84
|
-
headers: {},
|
|
85
|
-
config: {}
|
|
86
|
-
};
|
|
87
|
-
mockedAxios.get.mockResolvedValueOnce(axiosResponse);
|
|
88
|
-
const result = await api_getTransactions.getTransactions({
|
|
89
|
-
url,
|
|
90
|
-
address: "0x123",
|
|
91
|
-
nativeAuthToken: ""
|
|
92
|
-
});
|
|
93
|
-
expect(result).toEqual(axiosResponse);
|
|
94
|
-
});
|
|
95
|
-
});
|
|
2
|
+
"use strict";const c=require("axios"),o=require("../../types/providerType.js"),r=require("../getTransactions.js");jest.mock("axios");const t=c;describe("getTransactions",()=>{const s="https://api.example.com",a=[{fromChainId:"97",toChainId:"44",tokenIn:"0x063b637324e6115f8da67f761A99B7F00B7Fd908",tokenOut:"USDT-58d5d0",amountIn:"11000000",amountOut:"11000000",depositTimestamp:1738054613,sender:"0x1009c2f59e03c383ca8f2766cfe305a1e79f4c8d",status:"success",receiver:"erd1sp0aaszznqnuvyvkmxkv2ultcvlf637c093sfc26dszks60jdqsqy2knqu",txHash:"0xe7e706c1793d06a252a3f040f07732989e4a6466d804cae17105c09818bc2994",fee:"0",provider:o.ProviderType.MultiversxBridge}];beforeEach(()=>{t.get.mockClear(),t.get.mockResolvedValue({data:a})}),it("fetches transactions with only address parameter",async()=>{const n=await r.getTransactions({url:s,address:"0x123",nativeAuthToken:""});expect(t.get).toHaveBeenCalled(),expect(n.data).toEqual(a)}),it("fetches transactions with empty address",async()=>{const n=await r.getTransactions({url:s,address:"",nativeAuthToken:""});expect(t.get).toHaveBeenCalled(),expect(n.data).toEqual(a)}),it("includes all non-empty parameters in the query",async()=>{const e=await r.getTransactions({url:s,address:"0x123",sender:"0xABC",provider:o.ProviderType.MultiversxBridge,status:"success",tokenIn:"0xTOKEN",tokenOut:"WEGLD-123456",nativeAuthToken:""});expect(t.get).toHaveBeenCalled(),expect(e.data).toEqual(a)}),it("excludes empty parameters from the query",async()=>{const e=await r.getTransactions({url:s,address:"0x123",sender:"",provider:o.ProviderType.MultiversxBridge,status:"",tokenIn:"0xTOKEN",tokenOut:"",nativeAuthToken:""});expect(t.get).toHaveBeenCalled(),expect(e.data).toEqual(a)}),it("handles axios error",async()=>{const e=new Error("Network error");t.get.mockRejectedValueOnce(e),await expect(r.getTransactions({url:s,address:"0x123",nativeAuthToken:""})).rejects.toThrow("Network error"),expect(t.get).toHaveBeenCalled()}),it("passes through axios response",async()=>{const e={data:a,status:200,statusText:"OK",headers:{},config:{}};t.get.mockResolvedValueOnce(e);const n=await r.getTransactions({url:s,address:"0x123",nativeAuthToken:""});expect(n).toEqual(e)})});
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ProviderType } from "../../types/providerType.mjs";
|
|
3
|
-
import { getTransactions } from "../getTransactions.mjs";
|
|
1
|
+
import c from "axios";
|
|
2
|
+
import { ProviderType as n } from "../../types/providerType.mjs";
|
|
3
|
+
import { getTransactions as o } from "../getTransactions.mjs";
|
|
4
4
|
jest.mock("axios");
|
|
5
|
-
const
|
|
5
|
+
const t = c;
|
|
6
6
|
describe("getTransactions", () => {
|
|
7
|
-
const
|
|
8
|
-
const mockResponse = [
|
|
7
|
+
const a = "https://api.example.com", s = [
|
|
9
8
|
{
|
|
10
9
|
fromChainId: "97",
|
|
11
10
|
toChainId: "44",
|
|
@@ -19,75 +18,60 @@ describe("getTransactions", () => {
|
|
|
19
18
|
receiver: "erd1sp0aaszznqnuvyvkmxkv2ultcvlf637c093sfc26dszks60jdqsqy2knqu",
|
|
20
19
|
txHash: "0xe7e706c1793d06a252a3f040f07732989e4a6466d804cae17105c09818bc2994",
|
|
21
20
|
fee: "0",
|
|
22
|
-
provider:
|
|
21
|
+
provider: n.MultiversxBridge
|
|
23
22
|
}
|
|
24
23
|
];
|
|
25
24
|
beforeEach(() => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
expect(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const address = "";
|
|
37
|
-
const result = await getTransactions({ url, address, nativeAuthToken: "" });
|
|
38
|
-
expect(mockedAxios.get).toHaveBeenCalled();
|
|
39
|
-
expect(result.data).toEqual(mockResponse);
|
|
40
|
-
});
|
|
41
|
-
it("includes all non-empty parameters in the query", async () => {
|
|
42
|
-
const result = await getTransactions({
|
|
43
|
-
url,
|
|
25
|
+
t.get.mockClear(), t.get.mockResolvedValue({ data: s });
|
|
26
|
+
}), it("fetches transactions with only address parameter", async () => {
|
|
27
|
+
const r = await o({ url: a, address: "0x123", nativeAuthToken: "" });
|
|
28
|
+
expect(t.get).toHaveBeenCalled(), expect(r.data).toEqual(s);
|
|
29
|
+
}), it("fetches transactions with empty address", async () => {
|
|
30
|
+
const r = await o({ url: a, address: "", nativeAuthToken: "" });
|
|
31
|
+
expect(t.get).toHaveBeenCalled(), expect(r.data).toEqual(s);
|
|
32
|
+
}), it("includes all non-empty parameters in the query", async () => {
|
|
33
|
+
const e = await o({
|
|
34
|
+
url: a,
|
|
44
35
|
address: "0x123",
|
|
45
36
|
sender: "0xABC",
|
|
46
|
-
provider:
|
|
37
|
+
provider: n.MultiversxBridge,
|
|
47
38
|
status: "success",
|
|
48
39
|
tokenIn: "0xTOKEN",
|
|
49
40
|
tokenOut: "WEGLD-123456",
|
|
50
41
|
nativeAuthToken: ""
|
|
51
42
|
});
|
|
52
|
-
expect(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const result = await getTransactions({
|
|
57
|
-
url,
|
|
43
|
+
expect(t.get).toHaveBeenCalled(), expect(e.data).toEqual(s);
|
|
44
|
+
}), it("excludes empty parameters from the query", async () => {
|
|
45
|
+
const e = await o({
|
|
46
|
+
url: a,
|
|
58
47
|
address: "0x123",
|
|
59
48
|
sender: "",
|
|
60
|
-
provider:
|
|
49
|
+
provider: n.MultiversxBridge,
|
|
61
50
|
status: "",
|
|
62
51
|
tokenIn: "0xTOKEN",
|
|
63
52
|
tokenOut: "",
|
|
64
53
|
nativeAuthToken: ""
|
|
65
54
|
});
|
|
66
|
-
expect(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
expect(mockedAxios.get).toHaveBeenCalled();
|
|
76
|
-
});
|
|
77
|
-
it("passes through axios response", async () => {
|
|
78
|
-
const axiosResponse = {
|
|
79
|
-
data: mockResponse,
|
|
55
|
+
expect(t.get).toHaveBeenCalled(), expect(e.data).toEqual(s);
|
|
56
|
+
}), it("handles axios error", async () => {
|
|
57
|
+
const e = new Error("Network error");
|
|
58
|
+
t.get.mockRejectedValueOnce(e), await expect(
|
|
59
|
+
o({ url: a, address: "0x123", nativeAuthToken: "" })
|
|
60
|
+
).rejects.toThrow("Network error"), expect(t.get).toHaveBeenCalled();
|
|
61
|
+
}), it("passes through axios response", async () => {
|
|
62
|
+
const e = {
|
|
63
|
+
data: s,
|
|
80
64
|
status: 200,
|
|
81
65
|
statusText: "OK",
|
|
82
66
|
headers: {},
|
|
83
67
|
config: {}
|
|
84
68
|
};
|
|
85
|
-
|
|
86
|
-
const
|
|
87
|
-
url,
|
|
69
|
+
t.get.mockResolvedValueOnce(e);
|
|
70
|
+
const r = await o({
|
|
71
|
+
url: a,
|
|
88
72
|
address: "0x123",
|
|
89
73
|
nativeAuthToken: ""
|
|
90
74
|
});
|
|
91
|
-
expect(
|
|
75
|
+
expect(r).toEqual(e);
|
|
92
76
|
});
|
|
93
77
|
});
|
|
@@ -1,97 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
const axios = require("axios");
|
|
4
|
-
const api_sendTransactions = require("../sendTransactions.js");
|
|
5
|
-
const helpers_serializeTransaction = require("../../helpers/serializeTransaction.js");
|
|
6
|
-
const types_providerType = require("../../types/providerType.js");
|
|
7
|
-
jest.mock("axios");
|
|
8
|
-
const mockedAxios = axios;
|
|
9
|
-
describe("sendTransactions", () => {
|
|
10
|
-
const url = "https://api.example.com";
|
|
11
|
-
const token = "someValidToken";
|
|
12
|
-
const transactions = [
|
|
13
|
-
{
|
|
14
|
-
from: "0xAlice",
|
|
15
|
-
to: "0xBob",
|
|
16
|
-
type: "eip1559",
|
|
17
|
-
gas: BigInt(1e5),
|
|
18
|
-
gasPrice: BigInt(1e9),
|
|
19
|
-
chainId: 1,
|
|
20
|
-
hash: "0x1234",
|
|
21
|
-
nonce: 1,
|
|
22
|
-
value: BigInt(1e18)
|
|
23
|
-
}
|
|
24
|
-
];
|
|
25
|
-
it("POST sendTransactions successfully", async () => {
|
|
26
|
-
const response = { data: { transactions, provider: types_providerType.ProviderType.None } };
|
|
27
|
-
mockedAxios.post.mockResolvedValue(response);
|
|
28
|
-
const result = await api_sendTransactions.sendTransactions({
|
|
29
|
-
transactions,
|
|
30
|
-
provider: types_providerType.ProviderType.None,
|
|
31
|
-
url,
|
|
32
|
-
token
|
|
33
|
-
});
|
|
34
|
-
expect(mockedAxios.post).toHaveBeenCalledWith(
|
|
35
|
-
"/transactions",
|
|
36
|
-
{
|
|
37
|
-
transactions: transactions.map(
|
|
38
|
-
(transaction) => JSON.parse(helpers_serializeTransaction.serializeTransaction(transaction))
|
|
39
|
-
),
|
|
40
|
-
provider: types_providerType.ProviderType.None
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
baseURL: url,
|
|
44
|
-
headers: {
|
|
45
|
-
"Content-Type": "application/json",
|
|
46
|
-
Accept: "application/json",
|
|
47
|
-
Authorization: `Bearer ${token}`
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
);
|
|
51
|
-
expect(result.data).toEqual(response.data);
|
|
52
|
-
});
|
|
53
|
-
it("POST sendTransactions with additional axiosConfig", async () => {
|
|
54
|
-
const axiosConfig = { timeout: 1e3 };
|
|
55
|
-
const response = { data: { transactions, provider: types_providerType.ProviderType.None } };
|
|
56
|
-
mockedAxios.post.mockResolvedValue(response);
|
|
57
|
-
const result = await api_sendTransactions.sendTransactions({
|
|
58
|
-
transactions,
|
|
59
|
-
provider: types_providerType.ProviderType.None,
|
|
60
|
-
url,
|
|
61
|
-
token,
|
|
62
|
-
axiosConfig
|
|
63
|
-
});
|
|
64
|
-
expect(mockedAxios.post).toHaveBeenCalledWith(
|
|
65
|
-
"/transactions",
|
|
66
|
-
{
|
|
67
|
-
transactions: transactions.map(
|
|
68
|
-
(transaction) => JSON.parse(helpers_serializeTransaction.serializeTransaction(transaction))
|
|
69
|
-
),
|
|
70
|
-
provider: types_providerType.ProviderType.None
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
baseURL: url,
|
|
74
|
-
headers: {
|
|
75
|
-
"Content-Type": "application/json",
|
|
76
|
-
Accept: "application/json",
|
|
77
|
-
Authorization: `Bearer ${token}`
|
|
78
|
-
},
|
|
79
|
-
timeout: 1e3
|
|
80
|
-
}
|
|
81
|
-
);
|
|
82
|
-
expect(result.data).toEqual(response.data);
|
|
83
|
-
});
|
|
84
|
-
it("handles error when sending transactions", async () => {
|
|
85
|
-
mockedAxios.post.mockRejectedValue(new Error("Network Error"));
|
|
86
|
-
await expect(
|
|
87
|
-
api_sendTransactions.sendTransactions({
|
|
88
|
-
transactions: transactions.map(
|
|
89
|
-
(transaction) => JSON.parse(helpers_serializeTransaction.serializeTransaction(transaction))
|
|
90
|
-
),
|
|
91
|
-
provider: types_providerType.ProviderType.None,
|
|
92
|
-
url,
|
|
93
|
-
token
|
|
94
|
-
})
|
|
95
|
-
).rejects.toThrow("Network Error");
|
|
96
|
-
});
|
|
97
|
-
});
|
|
2
|
+
"use strict";const l=require("axios"),c=require("../sendTransactions.js"),p=require("../../helpers/serializeTransaction.js"),o=require("../../types/providerType.js");jest.mock("axios");const n=l;describe("sendTransactions",()=>{const s="https://api.example.com",t="someValidToken",e=[{from:"0xAlice",to:"0xBob",type:"eip1559",gas:BigInt(1e5),gasPrice:BigInt(1e9),chainId:1,hash:"0x1234",nonce:1,value:BigInt(1e18)}];it("POST sendTransactions successfully",async()=>{const a={data:{transactions:e,provider:o.ProviderType.None}};n.post.mockResolvedValue(a);const r=await c.sendTransactions({transactions:e,provider:o.ProviderType.None,url:s,token:t});expect(n.post).toHaveBeenCalledWith("/transactions",{transactions:e.map(i=>JSON.parse(p.serializeTransaction(i))),provider:o.ProviderType.None},{baseURL:s,headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:`Bearer ${t}`}}),expect(r.data).toEqual(a.data)}),it("POST sendTransactions with additional axiosConfig",async()=>{const a={timeout:1e3},r={data:{transactions:e,provider:o.ProviderType.None}};n.post.mockResolvedValue(r);const i=await c.sendTransactions({transactions:e,provider:o.ProviderType.None,url:s,token:t,axiosConfig:a});expect(n.post).toHaveBeenCalledWith("/transactions",{transactions:e.map(d=>JSON.parse(p.serializeTransaction(d))),provider:o.ProviderType.None},{baseURL:s,headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:`Bearer ${t}`},timeout:1e3}),expect(i.data).toEqual(r.data)}),it("handles error when sending transactions",async()=>{n.post.mockRejectedValue(new Error("Network Error")),await expect(c.sendTransactions({transactions:e.map(a=>JSON.parse(p.serializeTransaction(a))),provider:o.ProviderType.None,url:s,token:t})).rejects.toThrow("Network Error")})});
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { sendTransactions } from "../sendTransactions.mjs";
|
|
3
|
-
import { serializeTransaction } from "../../helpers/serializeTransaction.mjs";
|
|
4
|
-
import { ProviderType } from "../../types/providerType.mjs";
|
|
1
|
+
import l from "axios";
|
|
2
|
+
import { sendTransactions as c } from "../sendTransactions.mjs";
|
|
3
|
+
import { serializeTransaction as p } from "../../helpers/serializeTransaction.mjs";
|
|
4
|
+
import { ProviderType as o } from "../../types/providerType.mjs";
|
|
5
5
|
jest.mock("axios");
|
|
6
|
-
const
|
|
6
|
+
const n = l;
|
|
7
7
|
describe("sendTransactions", () => {
|
|
8
|
-
const
|
|
9
|
-
const token = "someValidToken";
|
|
10
|
-
const transactions = [
|
|
8
|
+
const a = "https://api.example.com", s = "someValidToken", e = [
|
|
11
9
|
{
|
|
12
10
|
from: "0xAlice",
|
|
13
11
|
to: "0xBob",
|
|
@@ -21,74 +19,68 @@ describe("sendTransactions", () => {
|
|
|
21
19
|
}
|
|
22
20
|
];
|
|
23
21
|
it("POST sendTransactions successfully", async () => {
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
transactions,
|
|
28
|
-
provider:
|
|
29
|
-
url,
|
|
30
|
-
token
|
|
22
|
+
const t = { data: { transactions: e, provider: o.None } };
|
|
23
|
+
n.post.mockResolvedValue(t);
|
|
24
|
+
const r = await c({
|
|
25
|
+
transactions: e,
|
|
26
|
+
provider: o.None,
|
|
27
|
+
url: a,
|
|
28
|
+
token: s
|
|
31
29
|
});
|
|
32
|
-
expect(
|
|
30
|
+
expect(n.post).toHaveBeenCalledWith(
|
|
33
31
|
"/transactions",
|
|
34
32
|
{
|
|
35
|
-
transactions:
|
|
36
|
-
(
|
|
33
|
+
transactions: e.map(
|
|
34
|
+
(i) => JSON.parse(p(i))
|
|
37
35
|
),
|
|
38
|
-
provider:
|
|
36
|
+
provider: o.None
|
|
39
37
|
},
|
|
40
38
|
{
|
|
41
|
-
baseURL:
|
|
39
|
+
baseURL: a,
|
|
42
40
|
headers: {
|
|
43
41
|
"Content-Type": "application/json",
|
|
44
42
|
Accept: "application/json",
|
|
45
|
-
Authorization: `Bearer ${
|
|
43
|
+
Authorization: `Bearer ${s}`
|
|
46
44
|
}
|
|
47
45
|
}
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
url,
|
|
59
|
-
token,
|
|
60
|
-
axiosConfig
|
|
46
|
+
), expect(r.data).toEqual(t.data);
|
|
47
|
+
}), it("POST sendTransactions with additional axiosConfig", async () => {
|
|
48
|
+
const t = { timeout: 1e3 }, r = { data: { transactions: e, provider: o.None } };
|
|
49
|
+
n.post.mockResolvedValue(r);
|
|
50
|
+
const i = await c({
|
|
51
|
+
transactions: e,
|
|
52
|
+
provider: o.None,
|
|
53
|
+
url: a,
|
|
54
|
+
token: s,
|
|
55
|
+
axiosConfig: t
|
|
61
56
|
});
|
|
62
|
-
expect(
|
|
57
|
+
expect(n.post).toHaveBeenCalledWith(
|
|
63
58
|
"/transactions",
|
|
64
59
|
{
|
|
65
|
-
transactions:
|
|
66
|
-
(
|
|
60
|
+
transactions: e.map(
|
|
61
|
+
(d) => JSON.parse(p(d))
|
|
67
62
|
),
|
|
68
|
-
provider:
|
|
63
|
+
provider: o.None
|
|
69
64
|
},
|
|
70
65
|
{
|
|
71
|
-
baseURL:
|
|
66
|
+
baseURL: a,
|
|
72
67
|
headers: {
|
|
73
68
|
"Content-Type": "application/json",
|
|
74
69
|
Accept: "application/json",
|
|
75
|
-
Authorization: `Bearer ${
|
|
70
|
+
Authorization: `Bearer ${s}`
|
|
76
71
|
},
|
|
77
72
|
timeout: 1e3
|
|
78
73
|
}
|
|
79
|
-
);
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
sendTransactions({
|
|
86
|
-
transactions: transactions.map(
|
|
87
|
-
(transaction) => JSON.parse(serializeTransaction(transaction))
|
|
74
|
+
), expect(i.data).toEqual(r.data);
|
|
75
|
+
}), it("handles error when sending transactions", async () => {
|
|
76
|
+
n.post.mockRejectedValue(new Error("Network Error")), await expect(
|
|
77
|
+
c({
|
|
78
|
+
transactions: e.map(
|
|
79
|
+
(t) => JSON.parse(p(t))
|
|
88
80
|
),
|
|
89
|
-
provider:
|
|
90
|
-
url,
|
|
91
|
-
token
|
|
81
|
+
provider: o.None,
|
|
82
|
+
url: a,
|
|
83
|
+
token: s
|
|
92
84
|
})
|
|
93
85
|
).rejects.toThrow("Network Error");
|
|
94
86
|
});
|
package/constants/index.js
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const MVX_CHAIN_IDS = ["31", "44", "54"];
|
|
5
|
-
exports.MVX_CHAIN_IDS = MVX_CHAIN_IDS;
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=["31","44","54"];exports.MVX_CHAIN_IDS=e;
|
package/constants/index.mjs
CHANGED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const L = "data:image/svg+xml,%3csvg%20width='256'%20height='256'%20viewBox='0%200%20256%20256'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M128.625%2063.3125C128.312%2063%20127.688%2063%20127.062%2063.3125L102.375%2072.6875L128%2082.375L153.312%2072.6875L128.625%2063.3125ZM95.5%20113.938L120.5%20123.312V95.5L95.5%2085.8125V113.938ZM135.5%20123.312L160.5%20113.938V85.8125L135.5%2095.5V123.312ZM128%20191.125L92.375%20206.75C88%20208.625%2082.6875%20208.625%2078.3125%20206.75L48.3125%20193.625C42.0625%20190.812%2038%20184.562%2038%20177.375V140.188C38%20133%2042.375%20126.438%2049.25%20123.938L79.25%20112.375C79.5625%20112.375%2079.875%20112.062%2080.5%20112.062V77.0625C80.5%2069.875%2084.875%2063.3125%2091.75%2060.8125L121.75%2049.25C125.5%2047.6875%20130.188%2047.6875%20133.938%2049.25L163.938%2060.8125C170.812%2063.3125%20175.5%2069.875%20175.5%2077.0625V112.062C175.812%20112.375%20176.125%20112.375%20176.438%20112.375L206.438%20123.938C213.312%20126.438%20218%20133%20218%20140.188V177.375C218%20184.562%20213.625%20190.812%20207.375%20193.625L177.375%20206.75C173%20208.625%20167.688%20208.625%20163.312%20206.75L128%20191.125ZM84.5625%20126.438L59.875%20135.812L85.5%20145.5L110.812%20135.812L86.125%20126.438C85.8125%20126.438%2085.1875%20126.438%2084.5625%20126.438ZM93%20158.625V190.188L118%20179.25V149.25L93%20158.625ZM78%20158.625L53%20149.25V177.375C53%20178.625%2053.3125%20179.25%2054.25%20179.875L78%20190.188V158.625ZM169.562%20126.438L144.875%20135.812L170.5%20145.5L195.812%20135.812L171.125%20126.438C170.812%20126.438%20170.188%20126.438%20169.562%20126.438ZM178%20190.188L201.438%20179.875C202.375%20179.25%20203%20178.312%20203%20177.375V149.25L178%20158.625V190.188ZM163%20158.625L138%20149.25V179.25L163%20190.188V158.625Z'%20fill='%239195A3'/%3e%3cpath%20opacity='0.4'%20d='M95.5%2085.8125L120.5%2095.5V123.312L95.5%20113.938V85.8125ZM160.5%20113.938L135.5%20123.312V95.5L160.5%2085.8125V113.938ZM118%20149.25V179.25L93%20190.188V158.625L118%20149.25ZM53%20149.25L78%20158.625V190.188L54.25%20179.875C53.3125%20179.25%2053%20178.625%2053%20177.375V149.25ZM178%20158.625L203%20149.25V177.375C203%20178.312%20202.375%20179.25%20201.438%20179.875L178%20190.188V158.625ZM163%20190.188L138%20179.25V149.25L163%20158.625V190.188Z'%20fill='%239195A3'/%3e%3c/svg%3e";
|
|
2
|
+
export {
|
|
3
|
+
L as D
|
|
4
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";const L="data:image/svg+xml,%3csvg%20width='256'%20height='256'%20viewBox='0%200%20256%20256'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M128.625%2063.3125C128.312%2063%20127.688%2063%20127.062%2063.3125L102.375%2072.6875L128%2082.375L153.312%2072.6875L128.625%2063.3125ZM95.5%20113.938L120.5%20123.312V95.5L95.5%2085.8125V113.938ZM135.5%20123.312L160.5%20113.938V85.8125L135.5%2095.5V123.312ZM128%20191.125L92.375%20206.75C88%20208.625%2082.6875%20208.625%2078.3125%20206.75L48.3125%20193.625C42.0625%20190.812%2038%20184.562%2038%20177.375V140.188C38%20133%2042.375%20126.438%2049.25%20123.938L79.25%20112.375C79.5625%20112.375%2079.875%20112.062%2080.5%20112.062V77.0625C80.5%2069.875%2084.875%2063.3125%2091.75%2060.8125L121.75%2049.25C125.5%2047.6875%20130.188%2047.6875%20133.938%2049.25L163.938%2060.8125C170.812%2063.3125%20175.5%2069.875%20175.5%2077.0625V112.062C175.812%20112.375%20176.125%20112.375%20176.438%20112.375L206.438%20123.938C213.312%20126.438%20218%20133%20218%20140.188V177.375C218%20184.562%20213.625%20190.812%20207.375%20193.625L177.375%20206.75C173%20208.625%20167.688%20208.625%20163.312%20206.75L128%20191.125ZM84.5625%20126.438L59.875%20135.812L85.5%20145.5L110.812%20135.812L86.125%20126.438C85.8125%20126.438%2085.1875%20126.438%2084.5625%20126.438ZM93%20158.625V190.188L118%20179.25V149.25L93%20158.625ZM78%20158.625L53%20149.25V177.375C53%20178.625%2053.3125%20179.25%2054.25%20179.875L78%20190.188V158.625ZM169.562%20126.438L144.875%20135.812L170.5%20145.5L195.812%20135.812L171.125%20126.438C170.812%20126.438%20170.188%20126.438%20169.562%20126.438ZM178%20190.188L201.438%20179.875C202.375%20179.25%20203%20178.312%20203%20177.375V149.25L178%20158.625V190.188ZM163%20158.625L138%20149.25V179.25L163%20190.188V158.625Z'%20fill='%239195A3'/%3e%3cpath%20opacity='0.4'%20d='M95.5%2085.8125L120.5%2095.5V123.312L95.5%20113.938V85.8125ZM160.5%20113.938L135.5%20123.312V95.5L160.5%2085.8125V113.938ZM118%20149.25V179.25L93%20190.188V158.625L118%20149.25ZM53%20149.25L78%20158.625V190.188L54.25%20179.875C53.3125%20179.25%2053%20178.625%2053%20177.375V149.25ZM178%20158.625L203%20149.25V177.375C203%20178.312%20202.375%20179.25%20201.438%20179.875L178%20190.188V158.625ZM163%20190.188L138%20179.25V149.25L163%20158.625V190.188Z'%20fill='%239195A3'/%3e%3c/svg%3e";exports.DefaultIcon=L;
|