@multiversx/sdk-dapp-liquidity 0.2.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/README.md +186 -0
- package/all-networks-EJIVYZ_i.mjs +4 -0
- package/all-networks-NYACMyeN.js +4 -0
- package/api/confirmRate.d.ts +11 -0
- package/api/confirmRate.js +30 -0
- package/api/confirmRate.mjs +29 -0
- package/api/getChains.d.ts +6 -0
- package/api/getChains.js +12 -0
- package/api/getChains.mjs +11 -0
- package/api/getRate.d.ts +10 -0
- package/api/getRate.js +28 -0
- package/api/getRate.mjs +27 -0
- package/api/getTokens.d.ts +7 -0
- package/api/getTokens.js +14 -0
- package/api/getTokens.mjs +13 -0
- package/api/getTokensBalances.d.ts +8 -0
- package/api/getTokensBalances.js +17 -0
- package/api/getTokensBalances.mjs +16 -0
- package/api/getTransactions.d.ts +7 -0
- package/api/getTransactions.js +14 -0
- package/api/getTransactions.mjs +13 -0
- package/api/index.d.ts +7 -0
- package/api/index.js +17 -0
- package/api/index.mjs +16 -0
- package/api/sendTransactions.d.ts +11 -0
- package/api/sendTransactions.js +29 -0
- package/api/sendTransactions.mjs +28 -0
- package/api/tests/confirmRate.spec.d.ts +1 -0
- package/api/tests/confirmRate.spec.js +124 -0
- package/api/tests/confirmRate.spec.mjs +122 -0
- package/api/tests/getChains.spec.d.ts +1 -0
- package/api/tests/getChains.spec.js +37 -0
- package/api/tests/getChains.spec.mjs +35 -0
- package/api/tests/getRate.spec.d.ts +1 -0
- package/api/tests/getRate.spec.js +83 -0
- package/api/tests/getRate.spec.mjs +81 -0
- package/api/tests/getTokens.spec.d.ts +1 -0
- package/api/tests/getTokens.spec.js +60 -0
- package/api/tests/getTokens.spec.mjs +58 -0
- package/api/tests/getTransactions.spec.d.ts +1 -0
- package/api/tests/getTransactions.spec.js +89 -0
- package/api/tests/getTransactions.spec.mjs +87 -0
- package/api/tests/sendTransactions.spec.d.ts +1 -0
- package/api/tests/sendTransactions.spec.js +83 -0
- package/api/tests/sendTransactions.spec.mjs +81 -0
- package/bignumber-B8vjg9qn.js +1334 -0
- package/bignumber-CKZkoo0g.mjs +1334 -0
- package/constants/index.d.ts +1 -0
- package/constants/index.js +5 -0
- package/constants/index.mjs +4 -0
- package/default-BYtXv70Z.mjs +4 -0
- package/default-H3AbmzFV.js +4 -0
- package/dto/Chain.dto.d.ts +16 -0
- package/dto/Chain.dto.js +2 -0
- package/dto/Chain.dto.mjs +1 -0
- package/dto/ConfirmRate.dto.d.ts +11 -0
- package/dto/ConfirmRate.dto.js +2 -0
- package/dto/ConfirmRate.dto.mjs +1 -0
- package/dto/Token.dto.d.ts +14 -0
- package/dto/Token.dto.js +2 -0
- package/dto/Token.dto.mjs +1 -0
- package/dto/TokenBalance.dto.d.ts +4 -0
- package/dto/TokenBalance.dto.js +2 -0
- package/dto/TokenBalance.dto.mjs +1 -0
- package/dto/Transaction.dto.d.ts +14 -0
- package/dto/Transaction.dto.js +2 -0
- package/dto/Transaction.dto.mjs +1 -0
- package/dto/index.d.ts +5 -0
- package/dto/index.js +2 -0
- package/dto/index.mjs +1 -0
- package/helpers/base64Utils.d.ts +3 -0
- package/helpers/base64Utils.js +32 -0
- package/helpers/base64Utils.mjs +31 -0
- package/helpers/decodeLoginToken.d.ts +9 -0
- package/helpers/decodeLoginToken.js +28 -0
- package/helpers/decodeLoginToken.mjs +27 -0
- package/helpers/decodeToken.d.ts +11 -0
- package/helpers/decodeToken.js +40 -0
- package/helpers/decodeToken.mjs +39 -0
- package/helpers/getApiURL.d.ts +1 -0
- package/helpers/getApiURL.js +8 -0
- package/helpers/getApiURL.mjs +7 -0
- package/helpers/getBridgeURL.d.ts +1 -0
- package/helpers/getBridgeURL.js +8 -0
- package/helpers/getBridgeURL.mjs +7 -0
- package/helpers/getMvxApiURL.d.ts +1 -0
- package/helpers/getMvxApiURL.js +8 -0
- package/helpers/getMvxApiURL.mjs +7 -0
- package/helpers/getMvxChainId.d.ts +1 -0
- package/helpers/getMvxChainId.js +8 -0
- package/helpers/getMvxChainId.mjs +7 -0
- package/helpers/getMvxExplorerAddress.d.ts +1 -0
- package/helpers/getMvxExplorerAddress.js +8 -0
- package/helpers/getMvxExplorerAddress.mjs +7 -0
- package/helpers/index.d.ts +9 -0
- package/helpers/index.js +23 -0
- package/helpers/index.mjs +22 -0
- package/helpers/serializeTransaction.d.ts +3 -0
- package/helpers/serializeTransaction.js +9 -0
- package/helpers/serializeTransaction.mjs +8 -0
- package/helpers/tests/base64Utils.spec.d.ts +1 -0
- package/helpers/tests/base64Utils.spec.js +30 -0
- package/helpers/tests/base64Utils.spec.mjs +28 -0
- package/helpers/tests/decodeLoginToken.spec.d.ts +1 -0
- package/helpers/tests/decodeLoginToken.spec.js +35 -0
- package/helpers/tests/decodeLoginToken.spec.mjs +33 -0
- package/helpers/tests/decodeToken.spec.d.ts +1 -0
- package/helpers/tests/decodeToken.spec.js +28 -0
- package/helpers/tests/decodeToken.spec.mjs +26 -0
- package/index-B9WqxUXM.mjs +91 -0
- package/index-BXwpbIDQ.mjs +107 -0
- package/index-CnudU77V.js +329 -0
- package/index-DSnomXRI.mjs +68025 -0
- package/index-DZHiA1sX.js +107 -0
- package/index-cvy2-uZ_.js +67946 -0
- package/index.d.ts +6 -0
- package/index.js +189 -0
- package/index.mjs +185 -0
- package/package.json +107 -0
- package/react-B9sQBOh0.mjs +3040 -0
- package/react-BaXyw3AO.js +3040 -0
- package/react-CNXJSTCv.js +38 -0
- package/react-CSQpf1zk.mjs +38 -0
- package/reactjs/components/AccountAddress/AccountAddress.d.ts +6 -0
- package/reactjs/components/AccountAddress/AccountAddress.js +25 -0
- package/reactjs/components/AccountAddress/AccountAddress.mjs +24 -0
- package/reactjs/components/AccountAddress/index.d.ts +1 -0
- package/reactjs/components/AccountAddress/index.js +5 -0
- package/reactjs/components/AccountAddress/index.mjs +4 -0
- package/reactjs/components/AmountCard/AmountCard.d.ts +6 -0
- package/reactjs/components/AmountCard/AmountCard.js +33 -0
- package/reactjs/components/AmountCard/AmountCard.mjs +32 -0
- package/reactjs/components/AmountCard/index.d.ts +1 -0
- package/reactjs/components/AmountCard/index.js +5 -0
- package/reactjs/components/AmountCard/index.mjs +4 -0
- package/reactjs/components/AmountInput/AmountInput.d.ts +13 -0
- package/reactjs/components/AmountInput/AmountInput.js +61 -0
- package/reactjs/components/AmountInput/AmountInput.mjs +60 -0
- package/reactjs/components/AmountInput/index.d.ts +1 -0
- package/reactjs/components/AmountInput/index.js +5 -0
- package/reactjs/components/AmountInput/index.mjs +4 -0
- package/reactjs/components/BridgeForm/BridgeForm.d.ts +16 -0
- package/reactjs/components/BridgeForm/BridgeForm.js +680 -0
- package/reactjs/components/BridgeForm/BridgeForm.mjs +679 -0
- package/reactjs/components/BridgeForm/index.d.ts +1 -0
- package/reactjs/components/BridgeForm/index.js +5 -0
- package/reactjs/components/BridgeForm/index.mjs +4 -0
- package/reactjs/components/BridgeHistory/BridgeHistory.d.ts +4 -0
- package/reactjs/components/BridgeHistory/BridgeHistory.js +233 -0
- package/reactjs/components/BridgeHistory/BridgeHistory.mjs +232 -0
- package/reactjs/components/BridgeHistory/index.d.ts +1 -0
- package/reactjs/components/BridgeHistory/index.js +5 -0
- package/reactjs/components/BridgeHistory/index.mjs +4 -0
- package/reactjs/components/Connect/BridgeAccountDisplay.d.ts +6 -0
- package/reactjs/components/Connect/BridgeAccountDisplay.js +85 -0
- package/reactjs/components/Connect/BridgeAccountDisplay.mjs +84 -0
- package/reactjs/components/Connect/BridgeConnectButton.d.ts +7 -0
- package/reactjs/components/Connect/BridgeConnectButton.js +26 -0
- package/reactjs/components/Connect/BridgeConnectButton.mjs +25 -0
- package/reactjs/components/Connect/CustomConnectButton.d.ts +7 -0
- package/reactjs/components/Connect/CustomConnectButton.js +42 -0
- package/reactjs/components/Connect/CustomConnectButton.mjs +41 -0
- package/reactjs/components/Connect/MvxAccountDisplay.d.ts +9 -0
- package/reactjs/components/Connect/MvxAccountDisplay.js +75 -0
- package/reactjs/components/Connect/MvxAccountDisplay.mjs +74 -0
- package/reactjs/components/Connect/MvxConnectButton.d.ts +11 -0
- package/reactjs/components/Connect/MvxConnectButton.js +43 -0
- package/reactjs/components/Connect/MvxConnectButton.mjs +42 -0
- package/reactjs/components/Connect/SwitchChainButton.d.ts +7 -0
- package/reactjs/components/Connect/SwitchChainButton.js +33 -0
- package/reactjs/components/Connect/SwitchChainButton.mjs +32 -0
- package/reactjs/components/Connect/index.d.ts +6 -0
- package/reactjs/components/Connect/index.js +15 -0
- package/reactjs/components/Connect/index.mjs +14 -0
- package/reactjs/components/CopyButton/CopyButton.d.ts +6 -0
- package/reactjs/components/CopyButton/CopyButton.js +42 -0
- package/reactjs/components/CopyButton/CopyButton.mjs +41 -0
- package/reactjs/components/CopyButton/index.d.ts +1 -0
- package/reactjs/components/CopyButton/index.js +5 -0
- package/reactjs/components/CopyButton/index.mjs +4 -0
- package/reactjs/components/CopyButton/utils/copyToClipboard.d.ts +1 -0
- package/reactjs/components/CopyButton/utils/copyToClipboard.js +38 -0
- package/reactjs/components/CopyButton/utils/copyToClipboard.mjs +37 -0
- package/reactjs/components/CopyButton/utils/index.d.ts +1 -0
- package/reactjs/components/CopyButton/utils/index.js +5 -0
- package/reactjs/components/CopyButton/utils/index.mjs +4 -0
- package/reactjs/components/DisplayAmount/DisplayAmount.d.ts +21 -0
- package/reactjs/components/DisplayAmount/DisplayAmount.js +91 -0
- package/reactjs/components/DisplayAmount/DisplayAmount.mjs +90 -0
- package/reactjs/components/DisplayAmount/components/AnimateNumber/AnimateNumber.d.ts +7 -0
- package/reactjs/components/DisplayAmount/components/AnimateNumber/AnimateNumber.js +40 -0
- package/reactjs/components/DisplayAmount/components/AnimateNumber/AnimateNumber.mjs +39 -0
- package/reactjs/components/DisplayAmount/components/AnimateNumber/index.d.ts +0 -0
- package/reactjs/components/DisplayAmount/components/AnimateNumber/index.js +2 -0
- package/reactjs/components/DisplayAmount/components/AnimateNumber/index.mjs +1 -0
- package/reactjs/components/DisplayAmount/components/PrecisedAmount/PrecisedAmount.d.ts +14 -0
- package/reactjs/components/DisplayAmount/components/PrecisedAmount/PrecisedAmount.js +62 -0
- package/reactjs/components/DisplayAmount/components/PrecisedAmount/PrecisedAmount.mjs +61 -0
- package/reactjs/components/DisplayAmount/components/index.d.ts +0 -0
- package/reactjs/components/DisplayAmount/components/index.js +2 -0
- package/reactjs/components/DisplayAmount/components/index.mjs +1 -0
- package/reactjs/components/DisplayAmount/index.d.ts +1 -0
- package/reactjs/components/DisplayAmount/index.js +5 -0
- package/reactjs/components/DisplayAmount/index.mjs +4 -0
- package/reactjs/components/DisplayAmount/utils/index.d.ts +1 -0
- package/reactjs/components/DisplayAmount/utils/index.js +5 -0
- package/reactjs/components/DisplayAmount/utils/index.mjs +4 -0
- package/reactjs/components/DisplayAmount/utils/truncateAmount.d.ts +1 -0
- package/reactjs/components/DisplayAmount/utils/truncateAmount.js +22 -0
- package/reactjs/components/DisplayAmount/utils/truncateAmount.mjs +21 -0
- package/reactjs/components/SmallLoader/SmallLoader.d.ts +4 -0
- package/reactjs/components/SmallLoader/SmallLoader.js +22 -0
- package/reactjs/components/SmallLoader/SmallLoader.mjs +21 -0
- package/reactjs/components/SmallLoader/index.d.ts +1 -0
- package/reactjs/components/SmallLoader/index.js +5 -0
- package/reactjs/components/SmallLoader/index.mjs +4 -0
- package/reactjs/components/TokenSelector/TokenSelector.d.ts +16 -0
- package/reactjs/components/TokenSelector/TokenSelector.js +158 -0
- package/reactjs/components/TokenSelector/TokenSelector.mjs +157 -0
- package/reactjs/components/TokenSelector/components/ChainSelect/ChainSelect.d.ts +8 -0
- package/reactjs/components/TokenSelector/components/ChainSelect/ChainSelect.js +86 -0
- package/reactjs/components/TokenSelector/components/ChainSelect/ChainSelect.mjs +85 -0
- package/reactjs/components/TokenSelector/components/ChainSelect/components/ChainOptionLabel.d.ts +11 -0
- package/reactjs/components/TokenSelector/components/ChainSelect/components/ChainOptionLabel.js +45 -0
- package/reactjs/components/TokenSelector/components/ChainSelect/components/ChainOptionLabel.mjs +44 -0
- package/reactjs/components/TokenSelector/components/ChainSelect/components/FormatChainOptionLabel.d.ts +6 -0
- package/reactjs/components/TokenSelector/components/ChainSelect/components/FormatChainOptionLabel.js +19 -0
- package/reactjs/components/TokenSelector/components/ChainSelect/components/FormatChainOptionLabel.mjs +18 -0
- package/reactjs/components/TokenSelector/components/ChainSelect/components/IndicatorSeparator.d.ts +3 -0
- package/reactjs/components/TokenSelector/components/ChainSelect/components/IndicatorSeparator.js +7 -0
- package/reactjs/components/TokenSelector/components/ChainSelect/components/IndicatorSeparator.mjs +6 -0
- package/reactjs/components/TokenSelector/components/ChainSelect/components/SelectedChainOption.d.ts +4 -0
- package/reactjs/components/TokenSelector/components/ChainSelect/components/SelectedChainOption.js +33 -0
- package/reactjs/components/TokenSelector/components/ChainSelect/components/SelectedChainOption.mjs +32 -0
- package/reactjs/components/TokenSelector/components/ChainSelect/types/chainSelectOption.d.ts +10 -0
- package/reactjs/components/TokenSelector/components/ChainSelect/types/chainSelectOption.js +2 -0
- package/reactjs/components/TokenSelector/components/ChainSelect/types/chainSelectOption.mjs +1 -0
- package/reactjs/components/TokenSelector/components/ChainSelect/types/partialChainOption.d.ts +10 -0
- package/reactjs/components/TokenSelector/components/ChainSelect/types/partialChainOption.js +2 -0
- package/reactjs/components/TokenSelector/components/ChainSelect/types/partialChainOption.mjs +1 -0
- package/reactjs/components/TokenSelector/components/SelectContainer.d.ts +7 -0
- package/reactjs/components/TokenSelector/components/SelectContainer.js +41 -0
- package/reactjs/components/TokenSelector/components/SelectContainer.mjs +40 -0
- package/reactjs/components/TokenSelector/components/SelectContent.d.ts +10 -0
- package/reactjs/components/TokenSelector/components/SelectContent.js +93 -0
- package/reactjs/components/TokenSelector/components/SelectContent.mjs +92 -0
- package/reactjs/components/TokenSelector/components/SelectedOption.d.ts +5 -0
- package/reactjs/components/TokenSelector/components/SelectedOption.js +29 -0
- package/reactjs/components/TokenSelector/components/SelectedOption.mjs +28 -0
- package/reactjs/components/TokenSelector/components/TokenIcon.d.ts +8 -0
- package/reactjs/components/TokenSelector/components/TokenIcon.js +82 -0
- package/reactjs/components/TokenSelector/components/TokenIcon.mjs +81 -0
- package/reactjs/components/TokenSelector/components/TokenItem.d.ts +7 -0
- package/reactjs/components/TokenSelector/components/TokenItem.js +69 -0
- package/reactjs/components/TokenSelector/components/TokenItem.mjs +68 -0
- package/reactjs/components/TokenSelector/components/TokenList.d.ts +7 -0
- package/reactjs/components/TokenSelector/components/TokenList.js +21 -0
- package/reactjs/components/TokenSelector/components/TokenList.mjs +20 -0
- package/reactjs/components/TokenSelector/components/TokenSymbol.d.ts +9 -0
- package/reactjs/components/TokenSelector/components/TokenSymbol.js +26 -0
- package/reactjs/components/TokenSelector/components/TokenSymbol.mjs +25 -0
- package/reactjs/components/TokenSelector/index.d.ts +1 -0
- package/reactjs/components/TokenSelector/index.js +5 -0
- package/reactjs/components/TokenSelector/index.mjs +4 -0
- package/reactjs/components/TransactionToast/TransactionToast.d.ts +9 -0
- package/reactjs/components/TransactionToast/TransactionToast.js +54 -0
- package/reactjs/components/TransactionToast/TransactionToast.mjs +53 -0
- package/reactjs/components/TransactionToast/TransactionToastContainer.d.ts +3 -0
- package/reactjs/components/TransactionToast/TransactionToastContainer.js +21 -0
- package/reactjs/components/TransactionToast/TransactionToastContainer.mjs +20 -0
- package/reactjs/components/TransactionToast/index.d.ts +2 -0
- package/reactjs/components/TransactionToast/index.js +7 -0
- package/reactjs/components/TransactionToast/index.mjs +6 -0
- package/reactjs/components/TrimAddress/TrimAddress.d.ts +8 -0
- package/reactjs/components/TrimAddress/TrimAddress.js +26 -0
- package/reactjs/components/TrimAddress/TrimAddress.mjs +25 -0
- package/reactjs/components/TrimAddress/index.d.ts +1 -0
- package/reactjs/components/TrimAddress/index.js +5 -0
- package/reactjs/components/TrimAddress/index.mjs +4 -0
- package/reactjs/components/base/MxButton/MxButton.d.ts +13 -0
- package/reactjs/components/base/MxButton/MxButton.js +72 -0
- package/reactjs/components/base/MxButton/MxButton.mjs +71 -0
- package/reactjs/components/base/MxButton/index.d.ts +1 -0
- package/reactjs/components/base/MxButton/index.js +5 -0
- package/reactjs/components/base/MxButton/index.mjs +4 -0
- package/reactjs/components/base/MxCard/MxCard.d.ts +10 -0
- package/reactjs/components/base/MxCard/MxCard.js +55 -0
- package/reactjs/components/base/MxCard/MxCard.mjs +54 -0
- package/reactjs/components/base/MxCard/index.d.ts +1 -0
- package/reactjs/components/base/MxCard/index.js +5 -0
- package/reactjs/components/base/MxCard/index.mjs +4 -0
- package/reactjs/components/base/MxLink/MxLink.d.ts +10 -0
- package/reactjs/components/base/MxLink/MxLink.js +71 -0
- package/reactjs/components/base/MxLink/MxLink.mjs +70 -0
- package/reactjs/components/base/MxLink/index.d.ts +1 -0
- package/reactjs/components/base/MxLink/index.js +5 -0
- package/reactjs/components/base/MxLink/index.mjs +4 -0
- package/reactjs/components/base/MxSearch/MxSearch.d.ts +10 -0
- package/reactjs/components/base/MxSearch/MxSearch.js +70 -0
- package/reactjs/components/base/MxSearch/MxSearch.mjs +69 -0
- package/reactjs/components/base/MxSearch/index.d.ts +1 -0
- package/reactjs/components/base/MxSearch/index.js +5 -0
- package/reactjs/components/base/MxSearch/index.mjs +4 -0
- package/reactjs/components/base/MxSlideover/MxSlideover.d.ts +10 -0
- package/reactjs/components/base/MxSlideover/MxSlideover.js +79 -0
- package/reactjs/components/base/MxSlideover/MxSlideover.mjs +78 -0
- package/reactjs/components/base/MxSlideover/index.d.ts +1 -0
- package/reactjs/components/base/MxSlideover/index.js +5 -0
- package/reactjs/components/base/MxSlideover/index.mjs +4 -0
- package/reactjs/components/base/MxTooltip/MxTooltip.d.ts +23 -0
- package/reactjs/components/base/MxTooltip/MxTooltip.js +163 -0
- package/reactjs/components/base/MxTooltip/MxTooltip.mjs +162 -0
- package/reactjs/components/base/MxTooltip/components/TooltipContainer/TooltipContainer.d.ts +11 -0
- package/reactjs/components/base/MxTooltip/components/TooltipContainer/TooltipContainer.js +34 -0
- package/reactjs/components/base/MxTooltip/components/TooltipContainer/TooltipContainer.mjs +33 -0
- package/reactjs/components/base/MxTooltip/components/TooltipContainer/index.d.ts +1 -0
- package/reactjs/components/base/MxTooltip/components/TooltipContainer/index.js +5 -0
- package/reactjs/components/base/MxTooltip/components/TooltipContainer/index.mjs +4 -0
- package/reactjs/components/base/MxTooltip/components/TooltipContent/TooltipContent.d.ts +13 -0
- package/reactjs/components/base/MxTooltip/components/TooltipContent/TooltipContent.js +28 -0
- package/reactjs/components/base/MxTooltip/components/TooltipContent/TooltipContent.mjs +27 -0
- package/reactjs/components/base/MxTooltip/components/TooltipContent/index.d.ts +1 -0
- package/reactjs/components/base/MxTooltip/components/TooltipContent/index.js +5 -0
- package/reactjs/components/base/MxTooltip/components/TooltipContent/index.mjs +4 -0
- package/reactjs/components/base/MxTooltip/components/index.d.ts +2 -0
- package/reactjs/components/base/MxTooltip/components/index.js +7 -0
- package/reactjs/components/base/MxTooltip/components/index.mjs +6 -0
- package/reactjs/components/base/MxTooltip/index.d.ts +1 -0
- package/reactjs/components/base/MxTooltip/index.js +5 -0
- package/reactjs/components/base/MxTooltip/index.mjs +4 -0
- package/reactjs/components/base/index.d.ts +6 -0
- package/reactjs/components/base/index.js +15 -0
- package/reactjs/components/base/index.mjs +14 -0
- package/reactjs/components/index.d.ts +13 -0
- package/reactjs/components/index.js +51 -0
- package/reactjs/components/index.mjs +50 -0
- package/reactjs/constants/chains.d.ts +35 -0
- package/reactjs/constants/chains.js +38 -0
- package/reactjs/constants/chains.mjs +37 -0
- package/reactjs/constants/index.d.ts +3 -0
- package/reactjs/constants/index.js +12 -0
- package/reactjs/constants/index.mjs +11 -0
- package/reactjs/context/Web3AppProvider.d.ts +12 -0
- package/reactjs/context/Web3AppProvider.js +29 -0
- package/reactjs/context/Web3AppProvider.mjs +28 -0
- package/reactjs/context/queryClient.d.ts +3 -0
- package/reactjs/context/queryClient.js +12 -0
- package/reactjs/context/queryClient.mjs +11 -0
- package/reactjs/context/useWeb3App.d.ts +1 -0
- package/reactjs/context/useWeb3App.js +13 -0
- package/reactjs/context/useWeb3App.mjs +12 -0
- package/reactjs/hooks/index.d.ts +11 -0
- package/reactjs/hooks/index.js +32 -0
- package/reactjs/hooks/index.mjs +31 -0
- package/reactjs/hooks/useAccount.d.ts +77 -0
- package/reactjs/hooks/useAccount.js +18 -0
- package/reactjs/hooks/useAccount.mjs +17 -0
- package/reactjs/hooks/useBalances.d.ts +10 -0
- package/reactjs/hooks/useBalances.js +7 -0
- package/reactjs/hooks/useBalances.mjs +6 -0
- package/reactjs/hooks/useBridgeFormik.d.ts +98 -0
- package/reactjs/hooks/useBridgeFormik.js +182 -0
- package/reactjs/hooks/useBridgeFormik.mjs +181 -0
- package/reactjs/hooks/useDebounce.d.ts +1 -0
- package/reactjs/hooks/useDebounce.js +14 -0
- package/reactjs/hooks/useDebounce.mjs +13 -0
- package/reactjs/hooks/useFetchBridgeData.d.ts +45 -0
- package/reactjs/hooks/useFetchBridgeData.js +44 -0
- package/reactjs/hooks/useFetchBridgeData.mjs +43 -0
- package/reactjs/hooks/useFetchTokens.d.ts +42 -0
- package/reactjs/hooks/useFetchTokens.js +105 -0
- package/reactjs/hooks/useFetchTokens.mjs +104 -0
- package/reactjs/hooks/useGetChainId.d.ts +1 -0
- package/reactjs/hooks/useGetChainId.js +12 -0
- package/reactjs/hooks/useGetChainId.mjs +11 -0
- package/reactjs/hooks/useResolveTokenChain.d.ts +9 -0
- package/reactjs/hooks/useResolveTokenChain.js +21 -0
- package/reactjs/hooks/useResolveTokenChain.mjs +20 -0
- package/reactjs/hooks/useSendTransactions.d.ts +3 -0
- package/reactjs/hooks/useSendTransactions.js +19 -0
- package/reactjs/hooks/useSendTransactions.mjs +18 -0
- package/reactjs/hooks/useSignTransaction.d.ts +69 -0
- package/reactjs/hooks/useSignTransaction.js +17 -0
- package/reactjs/hooks/useSignTransaction.mjs +16 -0
- package/reactjs/hooks/validation/index.d.ts +4 -0
- package/reactjs/hooks/validation/index.js +11 -0
- package/reactjs/hooks/validation/index.mjs +10 -0
- package/reactjs/hooks/validation/useAmountSchema.d.ts +2 -0
- package/reactjs/hooks/validation/useAmountSchema.js +31 -0
- package/reactjs/hooks/validation/useAmountSchema.mjs +13 -0
- package/reactjs/hooks/validation/useSecondAmountSchema.d.ts +2 -0
- package/reactjs/hooks/validation/useSecondAmountSchema.js +27 -0
- package/reactjs/hooks/validation/useSecondAmountSchema.mjs +9 -0
- package/reactjs/hooks/validation/useTestHasEnoughFunds.d.ts +3 -0
- package/reactjs/hooks/validation/useTestHasEnoughFunds.js +38 -0
- package/reactjs/hooks/validation/useTestHasEnoughFunds.mjs +37 -0
- package/reactjs/hooks/validation/useTestIsConnected.d.ts +3 -0
- package/reactjs/hooks/validation/useTestIsConnected.js +21 -0
- package/reactjs/hooks/validation/useTestIsConnected.mjs +20 -0
- package/reactjs/index.d.ts +10 -0
- package/reactjs/index.js +153 -0
- package/reactjs/index.mjs +149 -0
- package/reactjs/init/index.d.ts +1 -0
- package/reactjs/init/index.js +5 -0
- package/reactjs/init/index.mjs +4 -0
- package/reactjs/init/init.d.ts +48 -0
- package/reactjs/init/init.js +53 -0
- package/reactjs/init/init.mjs +35 -0
- package/reactjs/init/tests/init.spec.d.ts +1 -0
- package/reactjs/init/tests/init.spec.js +108 -0
- package/reactjs/init/tests/init.spec.mjs +106 -0
- package/reactjs/queries/index.d.ts +7 -0
- package/reactjs/queries/index.js +20 -0
- package/reactjs/queries/index.mjs +19 -0
- package/reactjs/queries/useGetAllTokens.query.d.ts +3 -0
- package/reactjs/queries/useGetAllTokens.query.js +31 -0
- package/reactjs/queries/useGetAllTokens.query.mjs +30 -0
- package/reactjs/queries/useGetChains.query.d.ts +3 -0
- package/reactjs/queries/useGetChains.query.js +31 -0
- package/reactjs/queries/useGetChains.query.mjs +30 -0
- package/reactjs/queries/useGetEvmTokensBalances.query.d.ts +22 -0
- package/reactjs/queries/useGetEvmTokensBalances.query.js +78 -0
- package/reactjs/queries/useGetEvmTokensBalances.query.mjs +77 -0
- package/reactjs/queries/useGetHistory.query.d.ts +4 -0
- package/reactjs/queries/useGetHistory.query.js +47 -0
- package/reactjs/queries/useGetHistory.query.mjs +46 -0
- package/reactjs/queries/useGetMvxTokensBalances.query.d.ts +23 -0
- package/reactjs/queries/useGetMvxTokensBalances.query.js +60 -0
- package/reactjs/queries/useGetMvxTokensBalances.query.mjs +59 -0
- package/reactjs/queries/useGetRate.mutation.d.ts +6 -0
- package/reactjs/queries/useGetRate.mutation.js +19 -0
- package/reactjs/queries/useGetRate.mutation.mjs +18 -0
- package/reactjs/queries/useGetTokens.query.d.ts +3 -0
- package/reactjs/queries/useGetTokens.query.js +34 -0
- package/reactjs/queries/useGetTokens.query.mjs +33 -0
- package/reactjs/reexports.d.ts +6 -0
- package/reactjs/reexports.js +21 -0
- package/reactjs/reexports.mjs +17 -0
- package/reactjs/utils/delay.d.ts +1 -0
- package/reactjs/utils/delay.js +7 -0
- package/reactjs/utils/delay.mjs +6 -0
- package/reactjs/utils/formatAmount.d.ts +7 -0
- package/reactjs/utils/formatAmount.js +24 -0
- package/reactjs/utils/formatAmount.mjs +23 -0
- package/reactjs/utils/getCleanStringAmount.d.ts +4 -0
- package/reactjs/utils/getCleanStringAmount.js +12 -0
- package/reactjs/utils/getCleanStringAmount.mjs +11 -0
- package/reactjs/utils/getCompletePathname.d.ts +1 -0
- package/reactjs/utils/getCompletePathname.js +6 -0
- package/reactjs/utils/getCompletePathname.mjs +5 -0
- package/reactjs/utils/getInitialTokens.d.ts +8 -0
- package/reactjs/utils/getInitialTokens.js +13 -0
- package/reactjs/utils/getInitialTokens.mjs +12 -0
- package/reactjs/utils/hasEnoughFunds.d.ts +5 -0
- package/reactjs/utils/hasEnoughFunds.js +20 -0
- package/reactjs/utils/hasEnoughFunds.mjs +19 -0
- package/reactjs/utils/index.d.ts +12 -0
- package/reactjs/utils/index.js +27 -0
- package/reactjs/utils/index.mjs +26 -0
- package/reactjs/utils/isStringFloat.d.ts +1 -0
- package/reactjs/utils/isStringFloat.js +22 -0
- package/reactjs/utils/isStringFloat.mjs +21 -0
- package/reactjs/utils/mxClsx.d.ts +3 -0
- package/reactjs/utils/mxClsx.js +21 -0
- package/reactjs/utils/mxClsx.mjs +20 -0
- package/reactjs/utils/pipe.d.ts +7 -0
- package/reactjs/utils/pipe.js +26 -0
- package/reactjs/utils/pipe.mjs +25 -0
- package/reactjs/utils/removeCommas.d.ts +1 -0
- package/reactjs/utils/removeCommas.js +7 -0
- package/reactjs/utils/removeCommas.mjs +6 -0
- package/reactjs/utils/roundAmount.d.ts +1 -0
- package/reactjs/utils/roundAmount.js +41 -0
- package/reactjs/utils/roundAmount.mjs +40 -0
- package/reactjs/utils/testNumber.d.ts +1 -0
- package/reactjs/utils/testNumber.js +5 -0
- package/reactjs/utils/testNumber.mjs +4 -0
- package/store/inMemoryStore.d.ts +12 -0
- package/store/inMemoryStore.js +40 -0
- package/store/inMemoryStore.mjs +39 -0
- package/types/batchTransactions.d.ts +6 -0
- package/types/batchTransactions.js +2 -0
- package/types/batchTransactions.mjs +1 -0
- package/types/index.d.ts +4 -0
- package/types/index.js +2 -0
- package/types/index.mjs +1 -0
- package/types/rate.d.ts +11 -0
- package/types/rate.js +2 -0
- package/types/rate.mjs +1 -0
- package/types/token.d.ts +12 -0
- package/types/token.js +2 -0
- package/types/token.mjs +1 -0
- package/types/transaction.d.ts +14 -0
- package/types/transaction.js +2 -0
- package/types/transaction.mjs +1 -0
- package/useBalances-Bxtc4GNK.js +199 -0
- package/useBalances-DA3zEruz.mjs +199 -0
- package/w3m-modal-DCcF1qEB.js +356 -0
- package/w3m-modal-DK3G5GJp.mjs +356 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
const axios = require("axios");
|
|
4
|
+
const api_confirmRate = require("../confirmRate.js");
|
|
5
|
+
jest.mock("axios");
|
|
6
|
+
const mockedAxios = axios;
|
|
7
|
+
describe("confirmRate", () => {
|
|
8
|
+
const url = "https://api.example.com";
|
|
9
|
+
it("POST confirmRate successfully", async () => {
|
|
10
|
+
const body = {
|
|
11
|
+
tokenIn: "tokenIn",
|
|
12
|
+
tokenOut: "tokenOut",
|
|
13
|
+
fee: "100",
|
|
14
|
+
amountIn: "1000",
|
|
15
|
+
amountOut: "900",
|
|
16
|
+
fromChainId: "97",
|
|
17
|
+
toChainId: "44",
|
|
18
|
+
sender: "0x123",
|
|
19
|
+
receiver: "0x456"
|
|
20
|
+
};
|
|
21
|
+
const nativeAuthToken = "ZXJkMXdoOWMwc2pyMnhuOGh6ZjAybHd3Y3I0amsyczg0dGF0OXVkMmthcTZ6cjd4enB2bDlsNXE4YXdtZXg.YUhSMGNITTZMeTlrWlhadVpYUXVkR1Z0Y0d4aGRHVXRaR0Z3Y0M1dGRXeDBhWFpsY25ONExtTnZiUS5lZjc2YjRjNzZlZjZlMTNhNjM5MDc2N2ZjNzhhODhjYTRiYmI1OTE4YTJiOWRkYzQ0OTQyOTI3NjkzNjUwNjUxLjg2NDAwLmV5SjBhVzFsYzNSaGJYQWlPakUzTXpNME9EazBNREI5.04a986df7f0142837f9b1ca1ae4829f7b471e4c3470602ca6a16f2a4d7c6616c4e7628a93b4ce87d9534e95ab9215f893faeb9e0904e1d834007c16e43b12d01";
|
|
22
|
+
const config = {
|
|
23
|
+
baseURL: url,
|
|
24
|
+
headers: {
|
|
25
|
+
Authorization: `Bearer ${nativeAuthToken}`
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const response = [
|
|
29
|
+
{
|
|
30
|
+
from: "0xAlice",
|
|
31
|
+
to: "0xBob",
|
|
32
|
+
type: "eip1559",
|
|
33
|
+
gas: "100000",
|
|
34
|
+
gasPrice: "1000000000",
|
|
35
|
+
chainId: 1,
|
|
36
|
+
hash: "0x1234",
|
|
37
|
+
nonce: 1,
|
|
38
|
+
value: "1000000000000000000"
|
|
39
|
+
}
|
|
40
|
+
];
|
|
41
|
+
mockedAxios.post.mockResolvedValue({ data: response });
|
|
42
|
+
const result = await api_confirmRate.confirmRate({
|
|
43
|
+
url,
|
|
44
|
+
nativeAuthToken,
|
|
45
|
+
body
|
|
46
|
+
});
|
|
47
|
+
expect(mockedAxios.post).toHaveBeenCalledWith(
|
|
48
|
+
"/rate/confirm",
|
|
49
|
+
body,
|
|
50
|
+
config
|
|
51
|
+
);
|
|
52
|
+
expect(result.data).toEqual(response);
|
|
53
|
+
});
|
|
54
|
+
it("POST confirmRate with no nativeAuthToken", async () => {
|
|
55
|
+
const body = {
|
|
56
|
+
tokenIn: "tokenIn",
|
|
57
|
+
tokenOut: "tokenOut",
|
|
58
|
+
fee: "100",
|
|
59
|
+
amountIn: "1000",
|
|
60
|
+
amountOut: "900",
|
|
61
|
+
fromChainId: "97",
|
|
62
|
+
toChainId: "44",
|
|
63
|
+
sender: "0x123",
|
|
64
|
+
receiver: "0x456"
|
|
65
|
+
};
|
|
66
|
+
const nativeAuthToken = "";
|
|
67
|
+
const config = {
|
|
68
|
+
baseURL: url,
|
|
69
|
+
headers: {}
|
|
70
|
+
};
|
|
71
|
+
const response = [
|
|
72
|
+
{
|
|
73
|
+
from: "0xAlice",
|
|
74
|
+
to: "0xBob",
|
|
75
|
+
type: "eip1559",
|
|
76
|
+
gas: "100000",
|
|
77
|
+
gasPrice: "1000000000",
|
|
78
|
+
chainId: 1,
|
|
79
|
+
hash: "0x1234",
|
|
80
|
+
nonce: 1,
|
|
81
|
+
value: "1000000000000000000"
|
|
82
|
+
}
|
|
83
|
+
];
|
|
84
|
+
mockedAxios.post.mockResolvedValue({ data: response });
|
|
85
|
+
const result = await api_confirmRate.confirmRate({
|
|
86
|
+
url,
|
|
87
|
+
nativeAuthToken,
|
|
88
|
+
body
|
|
89
|
+
});
|
|
90
|
+
expect(mockedAxios.post).toHaveBeenCalledWith(
|
|
91
|
+
"/rate/confirm",
|
|
92
|
+
body,
|
|
93
|
+
config
|
|
94
|
+
);
|
|
95
|
+
expect(result.data).toEqual(response);
|
|
96
|
+
});
|
|
97
|
+
it("POST confirmRate should throw an error", async () => {
|
|
98
|
+
const body = {
|
|
99
|
+
tokenIn: "tokenIn",
|
|
100
|
+
tokenOut: "tokenOut",
|
|
101
|
+
fee: "100",
|
|
102
|
+
amountIn: "1000",
|
|
103
|
+
amountOut: "900",
|
|
104
|
+
fromChainId: "97",
|
|
105
|
+
toChainId: "44",
|
|
106
|
+
sender: "0x123",
|
|
107
|
+
receiver: "0x456"
|
|
108
|
+
};
|
|
109
|
+
const nativeAuthToken = "";
|
|
110
|
+
const config = {
|
|
111
|
+
baseURL: url,
|
|
112
|
+
headers: {}
|
|
113
|
+
};
|
|
114
|
+
mockedAxios.post.mockRejectedValue(new Error("error"));
|
|
115
|
+
await expect(api_confirmRate.confirmRate({ url, nativeAuthToken, body })).rejects.toThrow(
|
|
116
|
+
"error"
|
|
117
|
+
);
|
|
118
|
+
expect(mockedAxios.post).toHaveBeenCalledWith(
|
|
119
|
+
"/rate/confirm",
|
|
120
|
+
body,
|
|
121
|
+
config
|
|
122
|
+
);
|
|
123
|
+
});
|
|
124
|
+
});
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
import { confirmRate } from "../confirmRate.mjs";
|
|
3
|
+
jest.mock("axios");
|
|
4
|
+
const mockedAxios = axios;
|
|
5
|
+
describe("confirmRate", () => {
|
|
6
|
+
const url = "https://api.example.com";
|
|
7
|
+
it("POST confirmRate successfully", async () => {
|
|
8
|
+
const body = {
|
|
9
|
+
tokenIn: "tokenIn",
|
|
10
|
+
tokenOut: "tokenOut",
|
|
11
|
+
fee: "100",
|
|
12
|
+
amountIn: "1000",
|
|
13
|
+
amountOut: "900",
|
|
14
|
+
fromChainId: "97",
|
|
15
|
+
toChainId: "44",
|
|
16
|
+
sender: "0x123",
|
|
17
|
+
receiver: "0x456"
|
|
18
|
+
};
|
|
19
|
+
const nativeAuthToken = "ZXJkMXdoOWMwc2pyMnhuOGh6ZjAybHd3Y3I0amsyczg0dGF0OXVkMmthcTZ6cjd4enB2bDlsNXE4YXdtZXg.YUhSMGNITTZMeTlrWlhadVpYUXVkR1Z0Y0d4aGRHVXRaR0Z3Y0M1dGRXeDBhWFpsY25ONExtTnZiUS5lZjc2YjRjNzZlZjZlMTNhNjM5MDc2N2ZjNzhhODhjYTRiYmI1OTE4YTJiOWRkYzQ0OTQyOTI3NjkzNjUwNjUxLjg2NDAwLmV5SjBhVzFsYzNSaGJYQWlPakUzTXpNME9EazBNREI5.04a986df7f0142837f9b1ca1ae4829f7b471e4c3470602ca6a16f2a4d7c6616c4e7628a93b4ce87d9534e95ab9215f893faeb9e0904e1d834007c16e43b12d01";
|
|
20
|
+
const config = {
|
|
21
|
+
baseURL: url,
|
|
22
|
+
headers: {
|
|
23
|
+
Authorization: `Bearer ${nativeAuthToken}`
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const response = [
|
|
27
|
+
{
|
|
28
|
+
from: "0xAlice",
|
|
29
|
+
to: "0xBob",
|
|
30
|
+
type: "eip1559",
|
|
31
|
+
gas: "100000",
|
|
32
|
+
gasPrice: "1000000000",
|
|
33
|
+
chainId: 1,
|
|
34
|
+
hash: "0x1234",
|
|
35
|
+
nonce: 1,
|
|
36
|
+
value: "1000000000000000000"
|
|
37
|
+
}
|
|
38
|
+
];
|
|
39
|
+
mockedAxios.post.mockResolvedValue({ data: response });
|
|
40
|
+
const result = await confirmRate({
|
|
41
|
+
url,
|
|
42
|
+
nativeAuthToken,
|
|
43
|
+
body
|
|
44
|
+
});
|
|
45
|
+
expect(mockedAxios.post).toHaveBeenCalledWith(
|
|
46
|
+
"/rate/confirm",
|
|
47
|
+
body,
|
|
48
|
+
config
|
|
49
|
+
);
|
|
50
|
+
expect(result.data).toEqual(response);
|
|
51
|
+
});
|
|
52
|
+
it("POST confirmRate with no nativeAuthToken", async () => {
|
|
53
|
+
const body = {
|
|
54
|
+
tokenIn: "tokenIn",
|
|
55
|
+
tokenOut: "tokenOut",
|
|
56
|
+
fee: "100",
|
|
57
|
+
amountIn: "1000",
|
|
58
|
+
amountOut: "900",
|
|
59
|
+
fromChainId: "97",
|
|
60
|
+
toChainId: "44",
|
|
61
|
+
sender: "0x123",
|
|
62
|
+
receiver: "0x456"
|
|
63
|
+
};
|
|
64
|
+
const nativeAuthToken = "";
|
|
65
|
+
const config = {
|
|
66
|
+
baseURL: url,
|
|
67
|
+
headers: {}
|
|
68
|
+
};
|
|
69
|
+
const response = [
|
|
70
|
+
{
|
|
71
|
+
from: "0xAlice",
|
|
72
|
+
to: "0xBob",
|
|
73
|
+
type: "eip1559",
|
|
74
|
+
gas: "100000",
|
|
75
|
+
gasPrice: "1000000000",
|
|
76
|
+
chainId: 1,
|
|
77
|
+
hash: "0x1234",
|
|
78
|
+
nonce: 1,
|
|
79
|
+
value: "1000000000000000000"
|
|
80
|
+
}
|
|
81
|
+
];
|
|
82
|
+
mockedAxios.post.mockResolvedValue({ data: response });
|
|
83
|
+
const result = await confirmRate({
|
|
84
|
+
url,
|
|
85
|
+
nativeAuthToken,
|
|
86
|
+
body
|
|
87
|
+
});
|
|
88
|
+
expect(mockedAxios.post).toHaveBeenCalledWith(
|
|
89
|
+
"/rate/confirm",
|
|
90
|
+
body,
|
|
91
|
+
config
|
|
92
|
+
);
|
|
93
|
+
expect(result.data).toEqual(response);
|
|
94
|
+
});
|
|
95
|
+
it("POST confirmRate should throw an error", async () => {
|
|
96
|
+
const body = {
|
|
97
|
+
tokenIn: "tokenIn",
|
|
98
|
+
tokenOut: "tokenOut",
|
|
99
|
+
fee: "100",
|
|
100
|
+
amountIn: "1000",
|
|
101
|
+
amountOut: "900",
|
|
102
|
+
fromChainId: "97",
|
|
103
|
+
toChainId: "44",
|
|
104
|
+
sender: "0x123",
|
|
105
|
+
receiver: "0x456"
|
|
106
|
+
};
|
|
107
|
+
const nativeAuthToken = "";
|
|
108
|
+
const config = {
|
|
109
|
+
baseURL: url,
|
|
110
|
+
headers: {}
|
|
111
|
+
};
|
|
112
|
+
mockedAxios.post.mockRejectedValue(new Error("error"));
|
|
113
|
+
await expect(confirmRate({ url, nativeAuthToken, body })).rejects.toThrow(
|
|
114
|
+
"error"
|
|
115
|
+
);
|
|
116
|
+
expect(mockedAxios.post).toHaveBeenCalledWith(
|
|
117
|
+
"/rate/confirm",
|
|
118
|
+
body,
|
|
119
|
+
config
|
|
120
|
+
);
|
|
121
|
+
});
|
|
122
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
const axios = require("axios");
|
|
4
|
+
const api_getChains = require("../getChains.js");
|
|
5
|
+
jest.mock("axios");
|
|
6
|
+
const mockedAxios = axios;
|
|
7
|
+
describe("getChains", () => {
|
|
8
|
+
const url = "https://api.example.com";
|
|
9
|
+
it("fetches chains successfully", async () => {
|
|
10
|
+
const response = [
|
|
11
|
+
{
|
|
12
|
+
chainId: 1,
|
|
13
|
+
chainName: "msx",
|
|
14
|
+
pngUrl: "https://devnet-tools.multiversx.com/liquidity-sdk/ethereum/icon.png",
|
|
15
|
+
svgUrl: "https://devnet-tools.multiversx.com/liquidity-sdk/ethereum/icon.svg",
|
|
16
|
+
chainType: "type1",
|
|
17
|
+
rpc: "rpc1",
|
|
18
|
+
blockExplorerUrls: ["explorer1"],
|
|
19
|
+
nativeCurrency: {
|
|
20
|
+
name: "Currency One",
|
|
21
|
+
symbol: "CUR1",
|
|
22
|
+
decimals: 18,
|
|
23
|
+
icon: "icon1"
|
|
24
|
+
},
|
|
25
|
+
networkName: "Network One"
|
|
26
|
+
}
|
|
27
|
+
];
|
|
28
|
+
mockedAxios.get.mockResolvedValue({ data: response });
|
|
29
|
+
const result = await api_getChains.getChains({ url });
|
|
30
|
+
expect(mockedAxios.get).toHaveBeenCalledWith("/chains", { baseURL: url });
|
|
31
|
+
expect(result.data).toEqual(response);
|
|
32
|
+
});
|
|
33
|
+
it("handles error when fetching chains", async () => {
|
|
34
|
+
mockedAxios.get.mockRejectedValue(new Error("Network Error"));
|
|
35
|
+
await expect(api_getChains.getChains({ url })).rejects.toThrow("Network Error");
|
|
36
|
+
});
|
|
37
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
import { getChains } from "../getChains.mjs";
|
|
3
|
+
jest.mock("axios");
|
|
4
|
+
const mockedAxios = axios;
|
|
5
|
+
describe("getChains", () => {
|
|
6
|
+
const url = "https://api.example.com";
|
|
7
|
+
it("fetches chains successfully", async () => {
|
|
8
|
+
const response = [
|
|
9
|
+
{
|
|
10
|
+
chainId: 1,
|
|
11
|
+
chainName: "msx",
|
|
12
|
+
pngUrl: "https://devnet-tools.multiversx.com/liquidity-sdk/ethereum/icon.png",
|
|
13
|
+
svgUrl: "https://devnet-tools.multiversx.com/liquidity-sdk/ethereum/icon.svg",
|
|
14
|
+
chainType: "type1",
|
|
15
|
+
rpc: "rpc1",
|
|
16
|
+
blockExplorerUrls: ["explorer1"],
|
|
17
|
+
nativeCurrency: {
|
|
18
|
+
name: "Currency One",
|
|
19
|
+
symbol: "CUR1",
|
|
20
|
+
decimals: 18,
|
|
21
|
+
icon: "icon1"
|
|
22
|
+
},
|
|
23
|
+
networkName: "Network One"
|
|
24
|
+
}
|
|
25
|
+
];
|
|
26
|
+
mockedAxios.get.mockResolvedValue({ data: response });
|
|
27
|
+
const result = await getChains({ url });
|
|
28
|
+
expect(mockedAxios.get).toHaveBeenCalledWith("/chains", { baseURL: url });
|
|
29
|
+
expect(result.data).toEqual(response);
|
|
30
|
+
});
|
|
31
|
+
it("handles error when fetching chains", async () => {
|
|
32
|
+
mockedAxios.get.mockRejectedValue(new Error("Network Error"));
|
|
33
|
+
await expect(getChains({ url })).rejects.toThrow("Network Error");
|
|
34
|
+
});
|
|
35
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
const axios = require("axios");
|
|
4
|
+
const api_getRate = require("../getRate.js");
|
|
5
|
+
jest.mock("axios");
|
|
6
|
+
const mockedAxios = axios;
|
|
7
|
+
describe("getRate", () => {
|
|
8
|
+
const url = "https://api.example.com";
|
|
9
|
+
it("POST rate successfully", async () => {
|
|
10
|
+
const body = {
|
|
11
|
+
tokenIn: "wUSDC",
|
|
12
|
+
tokenOut: "wETH",
|
|
13
|
+
fromChainId: "97",
|
|
14
|
+
toChainId: "44",
|
|
15
|
+
amountIn: "1000000000000000000"
|
|
16
|
+
};
|
|
17
|
+
const nativeAuthToken = "ZXJkMXdoOWMwc2pyMnhuOGh6ZjAybHd3Y3I0amsyczg0dGF0OXVkMmthcTZ6cjd4enB2bDlsNXE4YXdtZXg.YUhSMGNITTZMeTlrWlhadVpYUXVkR1Z0Y0d4aGRHVXRaR0Z3Y0M1dGRXeDBhWFpsY25ONExtTnZiUS5lZjc2YjRjNzZlZjZlMTNhNjM5MDc2N2ZjNzhhODhjYTRiYmI1OTE4YTJiOWRkYzQ0OTQyOTI3NjkzNjUwNjUxLjg2NDAwLmV5SjBhVzFsYzNSaGJYQWlPakUzTXpNME9EazBNREI5.04a986df7f0142837f9b1ca1ae4829f7b471e4c3470602ca6a16f2a4d7c6616c4e7628a93b4ce87d9534e95ab9215f893faeb9e0904e1d834007c16e43b12d01";
|
|
18
|
+
const config = {
|
|
19
|
+
baseURL: url,
|
|
20
|
+
headers: {
|
|
21
|
+
Authorization: `Bearer ${nativeAuthToken}`,
|
|
22
|
+
origin: "https://devnet.template-dapp.multiversx.com"
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const response = {
|
|
26
|
+
fee: "5",
|
|
27
|
+
amountOut: "100"
|
|
28
|
+
};
|
|
29
|
+
mockedAxios.post.mockResolvedValue({ data: response });
|
|
30
|
+
const result = await api_getRate.getRate({
|
|
31
|
+
url,
|
|
32
|
+
nativeAuthToken,
|
|
33
|
+
body
|
|
34
|
+
});
|
|
35
|
+
expect(mockedAxios.post).toHaveBeenCalledWith("/rate", body, config);
|
|
36
|
+
expect(result.data).toBe(response);
|
|
37
|
+
});
|
|
38
|
+
it("POST rate with no nativeAuthToken", async () => {
|
|
39
|
+
const body = {
|
|
40
|
+
tokenIn: "wUSDC",
|
|
41
|
+
tokenOut: "wETH",
|
|
42
|
+
fromChainId: "97",
|
|
43
|
+
toChainId: "44",
|
|
44
|
+
amountIn: "1000000000000000000"
|
|
45
|
+
};
|
|
46
|
+
const nativeAuthToken = "";
|
|
47
|
+
const config = {
|
|
48
|
+
baseURL: url,
|
|
49
|
+
headers: {}
|
|
50
|
+
};
|
|
51
|
+
const response = {
|
|
52
|
+
fee: "5",
|
|
53
|
+
amountOut: "100"
|
|
54
|
+
};
|
|
55
|
+
mockedAxios.post.mockResolvedValue({ data: response });
|
|
56
|
+
const result = await api_getRate.getRate({
|
|
57
|
+
url,
|
|
58
|
+
nativeAuthToken,
|
|
59
|
+
body
|
|
60
|
+
});
|
|
61
|
+
expect(mockedAxios.post).toHaveBeenCalledWith("/rate", body, config);
|
|
62
|
+
expect(result.data).toBe(response);
|
|
63
|
+
});
|
|
64
|
+
it("POST rate should throw an error", async () => {
|
|
65
|
+
const body = {
|
|
66
|
+
tokenIn: "wUSDC",
|
|
67
|
+
tokenOut: "wETH",
|
|
68
|
+
fromChainId: "97",
|
|
69
|
+
toChainId: "44",
|
|
70
|
+
amountIn: "1000000000000000000"
|
|
71
|
+
};
|
|
72
|
+
const nativeAuthToken = "";
|
|
73
|
+
const config = {
|
|
74
|
+
baseURL: url,
|
|
75
|
+
headers: {}
|
|
76
|
+
};
|
|
77
|
+
mockedAxios.post.mockRejectedValue(new Error("error"));
|
|
78
|
+
await expect(api_getRate.getRate({ url, nativeAuthToken, body })).rejects.toThrow(
|
|
79
|
+
"error"
|
|
80
|
+
);
|
|
81
|
+
expect(mockedAxios.post).toHaveBeenCalledWith("/rate", body, config);
|
|
82
|
+
});
|
|
83
|
+
});
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
import { getRate } from "../getRate.mjs";
|
|
3
|
+
jest.mock("axios");
|
|
4
|
+
const mockedAxios = axios;
|
|
5
|
+
describe("getRate", () => {
|
|
6
|
+
const url = "https://api.example.com";
|
|
7
|
+
it("POST rate successfully", async () => {
|
|
8
|
+
const body = {
|
|
9
|
+
tokenIn: "wUSDC",
|
|
10
|
+
tokenOut: "wETH",
|
|
11
|
+
fromChainId: "97",
|
|
12
|
+
toChainId: "44",
|
|
13
|
+
amountIn: "1000000000000000000"
|
|
14
|
+
};
|
|
15
|
+
const nativeAuthToken = "ZXJkMXdoOWMwc2pyMnhuOGh6ZjAybHd3Y3I0amsyczg0dGF0OXVkMmthcTZ6cjd4enB2bDlsNXE4YXdtZXg.YUhSMGNITTZMeTlrWlhadVpYUXVkR1Z0Y0d4aGRHVXRaR0Z3Y0M1dGRXeDBhWFpsY25ONExtTnZiUS5lZjc2YjRjNzZlZjZlMTNhNjM5MDc2N2ZjNzhhODhjYTRiYmI1OTE4YTJiOWRkYzQ0OTQyOTI3NjkzNjUwNjUxLjg2NDAwLmV5SjBhVzFsYzNSaGJYQWlPakUzTXpNME9EazBNREI5.04a986df7f0142837f9b1ca1ae4829f7b471e4c3470602ca6a16f2a4d7c6616c4e7628a93b4ce87d9534e95ab9215f893faeb9e0904e1d834007c16e43b12d01";
|
|
16
|
+
const config = {
|
|
17
|
+
baseURL: url,
|
|
18
|
+
headers: {
|
|
19
|
+
Authorization: `Bearer ${nativeAuthToken}`,
|
|
20
|
+
origin: "https://devnet.template-dapp.multiversx.com"
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const response = {
|
|
24
|
+
fee: "5",
|
|
25
|
+
amountOut: "100"
|
|
26
|
+
};
|
|
27
|
+
mockedAxios.post.mockResolvedValue({ data: response });
|
|
28
|
+
const result = await getRate({
|
|
29
|
+
url,
|
|
30
|
+
nativeAuthToken,
|
|
31
|
+
body
|
|
32
|
+
});
|
|
33
|
+
expect(mockedAxios.post).toHaveBeenCalledWith("/rate", body, config);
|
|
34
|
+
expect(result.data).toBe(response);
|
|
35
|
+
});
|
|
36
|
+
it("POST rate with no nativeAuthToken", async () => {
|
|
37
|
+
const body = {
|
|
38
|
+
tokenIn: "wUSDC",
|
|
39
|
+
tokenOut: "wETH",
|
|
40
|
+
fromChainId: "97",
|
|
41
|
+
toChainId: "44",
|
|
42
|
+
amountIn: "1000000000000000000"
|
|
43
|
+
};
|
|
44
|
+
const nativeAuthToken = "";
|
|
45
|
+
const config = {
|
|
46
|
+
baseURL: url,
|
|
47
|
+
headers: {}
|
|
48
|
+
};
|
|
49
|
+
const response = {
|
|
50
|
+
fee: "5",
|
|
51
|
+
amountOut: "100"
|
|
52
|
+
};
|
|
53
|
+
mockedAxios.post.mockResolvedValue({ data: response });
|
|
54
|
+
const result = await getRate({
|
|
55
|
+
url,
|
|
56
|
+
nativeAuthToken,
|
|
57
|
+
body
|
|
58
|
+
});
|
|
59
|
+
expect(mockedAxios.post).toHaveBeenCalledWith("/rate", body, config);
|
|
60
|
+
expect(result.data).toBe(response);
|
|
61
|
+
});
|
|
62
|
+
it("POST rate should throw an error", async () => {
|
|
63
|
+
const body = {
|
|
64
|
+
tokenIn: "wUSDC",
|
|
65
|
+
tokenOut: "wETH",
|
|
66
|
+
fromChainId: "97",
|
|
67
|
+
toChainId: "44",
|
|
68
|
+
amountIn: "1000000000000000000"
|
|
69
|
+
};
|
|
70
|
+
const nativeAuthToken = "";
|
|
71
|
+
const config = {
|
|
72
|
+
baseURL: url,
|
|
73
|
+
headers: {}
|
|
74
|
+
};
|
|
75
|
+
mockedAxios.post.mockRejectedValue(new Error("error"));
|
|
76
|
+
await expect(getRate({ url, nativeAuthToken, body })).rejects.toThrow(
|
|
77
|
+
"error"
|
|
78
|
+
);
|
|
79
|
+
expect(mockedAxios.post).toHaveBeenCalledWith("/rate", body, config);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
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({ url });
|
|
28
|
+
expect(mockedAxios.get).toHaveBeenCalledWith("/tokens", { baseURL: url });
|
|
29
|
+
expect(result.data).toEqual(response);
|
|
30
|
+
});
|
|
31
|
+
it("fetches tokens successfully with chainId", async () => {
|
|
32
|
+
const chainId = 1;
|
|
33
|
+
const response = [
|
|
34
|
+
{
|
|
35
|
+
chainId: 1,
|
|
36
|
+
address: "0x123",
|
|
37
|
+
name: "Token One",
|
|
38
|
+
symbol: "T1",
|
|
39
|
+
decimals: 18,
|
|
40
|
+
crosschain: true,
|
|
41
|
+
pngUrl: "https://example.com/logo.png",
|
|
42
|
+
svgUrl: "https://example.com/logo.svg",
|
|
43
|
+
metadata: {
|
|
44
|
+
minBridgeAmount: "1",
|
|
45
|
+
maxBridgeAmount: "100"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
];
|
|
49
|
+
mockedAxios.get.mockResolvedValue({ data: response });
|
|
50
|
+
const result = await api_getTokens.getTokens({ url, chainId });
|
|
51
|
+
expect(mockedAxios.get).toHaveBeenCalledWith(`/tokens/${chainId}`, {
|
|
52
|
+
baseURL: url
|
|
53
|
+
});
|
|
54
|
+
expect(result.data).toEqual(response);
|
|
55
|
+
});
|
|
56
|
+
it("handles error when fetching tokens", async () => {
|
|
57
|
+
mockedAxios.get.mockRejectedValue(new Error("Network Error"));
|
|
58
|
+
await expect(api_getTokens.getTokens({ url })).rejects.toThrow("Network Error");
|
|
59
|
+
});
|
|
60
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
import { getTokens } from "../getTokens.mjs";
|
|
3
|
+
jest.mock("axios");
|
|
4
|
+
const mockedAxios = axios;
|
|
5
|
+
describe("getTokens", () => {
|
|
6
|
+
const url = "https://api.example.com";
|
|
7
|
+
it("fetches tokens successfully without chainId", async () => {
|
|
8
|
+
const response = [
|
|
9
|
+
{
|
|
10
|
+
chainId: 1,
|
|
11
|
+
address: "0x123",
|
|
12
|
+
name: "Token One",
|
|
13
|
+
symbol: "T1",
|
|
14
|
+
decimals: 18,
|
|
15
|
+
crosschain: true,
|
|
16
|
+
pngUrl: "https://example.com/logo.png",
|
|
17
|
+
svgUrl: "https://example.com/logo.svg",
|
|
18
|
+
metadata: {
|
|
19
|
+
minBridgeAmount: "1",
|
|
20
|
+
maxBridgeAmount: "100"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
];
|
|
24
|
+
mockedAxios.get.mockResolvedValue({ data: response });
|
|
25
|
+
const result = await getTokens({ url });
|
|
26
|
+
expect(mockedAxios.get).toHaveBeenCalledWith("/tokens", { baseURL: url });
|
|
27
|
+
expect(result.data).toEqual(response);
|
|
28
|
+
});
|
|
29
|
+
it("fetches tokens successfully with chainId", async () => {
|
|
30
|
+
const chainId = 1;
|
|
31
|
+
const response = [
|
|
32
|
+
{
|
|
33
|
+
chainId: 1,
|
|
34
|
+
address: "0x123",
|
|
35
|
+
name: "Token One",
|
|
36
|
+
symbol: "T1",
|
|
37
|
+
decimals: 18,
|
|
38
|
+
crosschain: true,
|
|
39
|
+
pngUrl: "https://example.com/logo.png",
|
|
40
|
+
svgUrl: "https://example.com/logo.svg",
|
|
41
|
+
metadata: {
|
|
42
|
+
minBridgeAmount: "1",
|
|
43
|
+
maxBridgeAmount: "100"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
];
|
|
47
|
+
mockedAxios.get.mockResolvedValue({ data: response });
|
|
48
|
+
const result = await getTokens({ url, chainId });
|
|
49
|
+
expect(mockedAxios.get).toHaveBeenCalledWith(`/tokens/${chainId}`, {
|
|
50
|
+
baseURL: url
|
|
51
|
+
});
|
|
52
|
+
expect(result.data).toEqual(response);
|
|
53
|
+
});
|
|
54
|
+
it("handles error when fetching tokens", async () => {
|
|
55
|
+
mockedAxios.get.mockRejectedValue(new Error("Network Error"));
|
|
56
|
+
await expect(getTokens({ url })).rejects.toThrow("Network Error");
|
|
57
|
+
});
|
|
58
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|