@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
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ServerTransaction } from '../types/transaction';
|
|
2
|
+
|
|
3
|
+
interface ConfirmIntent {
|
|
4
|
+
fromChainId: string;
|
|
5
|
+
sender: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function assertRateConfirmationMatchesIntent(intent: ConfirmIntent, transactions: ServerTransaction[]): void;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../types/errors.js");function a(r,n){for(const o of n){if(o.fromChainId!==void 0&&String(o.fromChainId)!==String(r.fromChainId))throw new e.RateConfirmationMismatchError(`Transaction fromChainId ${o.fromChainId} does not match approved fromChainId ${r.fromChainId}`);if(o.account!==void 0&&o.account!==""&&r.sender!==""&&o.account.toLowerCase()!==r.sender.toLowerCase())throw new e.RateConfirmationMismatchError(`Transaction account ${o.account} does not match approved sender ${r.sender}`);if(o.sender!==void 0&&o.sender!==""&&r.sender!==""&&o.sender.toLowerCase()!==r.sender.toLowerCase())throw new e.RateConfirmationMismatchError(`Transaction sender ${o.sender} does not match approved sender ${r.sender}`)}}exports.assertRateConfirmationMatchesIntent=a;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { RateConfirmationMismatchError as e } from "../types/errors.mjs";
|
|
2
|
+
function d(r, a) {
|
|
3
|
+
for (const o of a) {
|
|
4
|
+
if (o.fromChainId !== void 0 && String(o.fromChainId) !== String(r.fromChainId))
|
|
5
|
+
throw new e(
|
|
6
|
+
`Transaction fromChainId ${o.fromChainId} does not match approved fromChainId ${r.fromChainId}`
|
|
7
|
+
);
|
|
8
|
+
if (o.account !== void 0 && o.account !== "" && r.sender !== "" && o.account.toLowerCase() !== r.sender.toLowerCase())
|
|
9
|
+
throw new e(
|
|
10
|
+
`Transaction account ${o.account} does not match approved sender ${r.sender}`
|
|
11
|
+
);
|
|
12
|
+
if (o.sender !== void 0 && o.sender !== "" && r.sender !== "" && o.sender.toLowerCase() !== r.sender.toLowerCase())
|
|
13
|
+
throw new e(
|
|
14
|
+
`Transaction sender ${o.sender} does not match approved sender ${r.sender}`
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
d as assertRateConfirmationMatchesIntent
|
|
20
|
+
};
|
package/helpers/base64Utils.js
CHANGED
|
@@ -1,32 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
function isStringBase64(str) {
|
|
5
|
-
try {
|
|
6
|
-
const atobDecoded = atob(str);
|
|
7
|
-
const btoaEncoded = btoa(atobDecoded);
|
|
8
|
-
const bufferFromDecoded = Buffer.from(str, "base64").toString();
|
|
9
|
-
const bufferFromEncoded = Buffer.from(bufferFromDecoded).toString("base64");
|
|
10
|
-
const isBtoaEqual = str === btoaEncoded || btoaEncoded.startsWith(str);
|
|
11
|
-
const isBufferFromBase64Equal = str === bufferFromEncoded || bufferFromEncoded.startsWith(str);
|
|
12
|
-
const isEqualToInitialString = isBtoaEqual && isBufferFromBase64Equal;
|
|
13
|
-
if (isEqualToInitialString) {
|
|
14
|
-
return true;
|
|
15
|
-
}
|
|
16
|
-
} catch (e) {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
function encodeToBase64(string) {
|
|
22
|
-
return btoa(string);
|
|
23
|
-
}
|
|
24
|
-
function decodeBase64(string) {
|
|
25
|
-
if (!isStringBase64(string)) {
|
|
26
|
-
return string;
|
|
27
|
-
}
|
|
28
|
-
return atob(string);
|
|
29
|
-
}
|
|
30
|
-
exports.decodeBase64 = decodeBase64;
|
|
31
|
-
exports.encodeToBase64 = encodeToBase64;
|
|
32
|
-
exports.isStringBase64 = isStringBase64;
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function r(e){try{const o=atob(e),t=btoa(o),a=Buffer.from(e,"base64").toString(),n=Buffer.from(a).toString("base64"),i=e===t||t.startsWith(e),s=e===n||n.startsWith(e);if(i&&s)return!0}catch{return!1}return!1}function u(e){return btoa(e)}function c(e){return r(e)?atob(e):e}exports.decodeBase64=c;exports.encodeToBase64=u;exports.isStringBase64=r;
|
package/helpers/base64Utils.mjs
CHANGED
|
@@ -1,31 +1,21 @@
|
|
|
1
|
-
function
|
|
1
|
+
function i(t) {
|
|
2
2
|
try {
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const isBufferFromBase64Equal = str === bufferFromEncoded || bufferFromEncoded.startsWith(str);
|
|
9
|
-
const isEqualToInitialString = isBtoaEqual && isBufferFromBase64Equal;
|
|
10
|
-
if (isEqualToInitialString) {
|
|
11
|
-
return true;
|
|
12
|
-
}
|
|
13
|
-
} catch (e) {
|
|
14
|
-
return false;
|
|
3
|
+
const o = atob(t), e = btoa(o), r = Buffer.from(t, "base64").toString(), n = Buffer.from(r).toString("base64"), a = t === e || e.startsWith(t), f = t === n || n.startsWith(t);
|
|
4
|
+
if (a && f)
|
|
5
|
+
return !0;
|
|
6
|
+
} catch {
|
|
7
|
+
return !1;
|
|
15
8
|
}
|
|
16
|
-
return
|
|
9
|
+
return !1;
|
|
17
10
|
}
|
|
18
|
-
function
|
|
19
|
-
return btoa(
|
|
11
|
+
function c(t) {
|
|
12
|
+
return btoa(t);
|
|
20
13
|
}
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
return string;
|
|
24
|
-
}
|
|
25
|
-
return atob(string);
|
|
14
|
+
function s(t) {
|
|
15
|
+
return i(t) ? atob(t) : t;
|
|
26
16
|
}
|
|
27
17
|
export {
|
|
28
|
-
decodeBase64,
|
|
29
|
-
encodeToBase64,
|
|
30
|
-
isStringBase64
|
|
18
|
+
s as decodeBase64,
|
|
19
|
+
c as encodeToBase64,
|
|
20
|
+
i as isStringBase64
|
|
31
21
|
};
|
|
@@ -1,28 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const helpers_base64Utils = require("./base64Utils.js");
|
|
5
|
-
function decodeLoginToken(loginToken) {
|
|
6
|
-
if (!loginToken) {
|
|
7
|
-
return null;
|
|
8
|
-
}
|
|
9
|
-
const parts = loginToken.split(".");
|
|
10
|
-
if (parts.length !== 4) {
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
try {
|
|
14
|
-
const [origin, blockHash, ttl, extraInfo] = parts;
|
|
15
|
-
const parsedExtraInfo = JSON.parse(helpers_base64Utils.decodeBase64(extraInfo));
|
|
16
|
-
const parsedOrigin = helpers_base64Utils.decodeBase64(origin);
|
|
17
|
-
return {
|
|
18
|
-
ttl: Number(ttl),
|
|
19
|
-
extraInfo: parsedExtraInfo,
|
|
20
|
-
origin: parsedOrigin,
|
|
21
|
-
blockHash
|
|
22
|
-
};
|
|
23
|
-
} catch (e) {
|
|
24
|
-
console.error(`Error trying to decode ${loginToken}:`, e);
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
exports.decodeLoginToken = decodeLoginToken;
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./base64Utils.js");function l(e){if(!e)return null;const t=e.split(".");if(t.length!==4)return null;try{const[r,o,s,c]=t,i=JSON.parse(n.decodeBase64(c)),d=n.decodeBase64(r);return{ttl:Number(s),extraInfo:i,origin:d,blockHash:o}}catch(r){return console.error(`Error trying to decode ${e}:`,r),null}}exports.decodeLoginToken=l;
|
|
@@ -1,27 +1,22 @@
|
|
|
1
|
-
import { decodeBase64 } from "./base64Utils.mjs";
|
|
2
|
-
function
|
|
3
|
-
if (!
|
|
1
|
+
import { decodeBase64 as n } from "./base64Utils.mjs";
|
|
2
|
+
function u(r) {
|
|
3
|
+
if (!r)
|
|
4
4
|
return null;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
if (parts.length !== 4) {
|
|
5
|
+
const e = r.split(".");
|
|
6
|
+
if (e.length !== 4)
|
|
8
7
|
return null;
|
|
9
|
-
}
|
|
10
8
|
try {
|
|
11
|
-
const [
|
|
12
|
-
const parsedExtraInfo = JSON.parse(decodeBase64(extraInfo));
|
|
13
|
-
const parsedOrigin = decodeBase64(origin);
|
|
9
|
+
const [t, o, c, s] = e, i = JSON.parse(n(s)), a = n(t);
|
|
14
10
|
return {
|
|
15
|
-
ttl: Number(
|
|
16
|
-
extraInfo:
|
|
17
|
-
origin:
|
|
18
|
-
blockHash
|
|
11
|
+
ttl: Number(c),
|
|
12
|
+
extraInfo: i,
|
|
13
|
+
origin: a,
|
|
14
|
+
blockHash: o
|
|
19
15
|
};
|
|
20
|
-
} catch (
|
|
21
|
-
console.error(`Error trying to decode ${
|
|
22
|
-
return null;
|
|
16
|
+
} catch (t) {
|
|
17
|
+
return console.error(`Error trying to decode ${r}:`, t), null;
|
|
23
18
|
}
|
|
24
19
|
}
|
|
25
20
|
export {
|
|
26
|
-
decodeLoginToken
|
|
21
|
+
u as decodeLoginToken
|
|
27
22
|
};
|
package/helpers/decodeToken.js
CHANGED
|
@@ -1,40 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const helpers_base64Utils = require("./base64Utils.js");
|
|
5
|
-
const helpers_decodeLoginToken = require("./decodeLoginToken.js");
|
|
6
|
-
function decodeToken(token) {
|
|
7
|
-
var _a;
|
|
8
|
-
if (!token) {
|
|
9
|
-
return null;
|
|
10
|
-
}
|
|
11
|
-
const parts = token.split(".");
|
|
12
|
-
if (parts.length !== 3) {
|
|
13
|
-
console.error("Invalid nativeAuthToken. Token must have 3 parts.");
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
try {
|
|
17
|
-
const [address, body, signature] = parts;
|
|
18
|
-
const parsedAddress = helpers_base64Utils.decodeBase64(address);
|
|
19
|
-
const parsedBody = helpers_base64Utils.decodeBase64(body);
|
|
20
|
-
const parsedInitToken = helpers_decodeLoginToken.decodeLoginToken(parsedBody);
|
|
21
|
-
if (!parsedInitToken) {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
const result = {
|
|
25
|
-
...parsedInitToken,
|
|
26
|
-
address: parsedAddress,
|
|
27
|
-
body: parsedBody,
|
|
28
|
-
signature
|
|
29
|
-
};
|
|
30
|
-
if (!((_a = parsedInitToken.extraInfo) == null ? void 0 : _a.timestamp)) {
|
|
31
|
-
delete result.extraInfo;
|
|
32
|
-
}
|
|
33
|
-
return result;
|
|
34
|
-
} catch (error) {
|
|
35
|
-
if (error instanceof Error) {
|
|
36
|
-
throw new Error(error.message);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
exports.decodeToken = decodeToken;
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./base64Utils.js"),u=require("./decodeLoginToken.js");function f(n){var t;if(!n)return null;const o=n.split(".");if(o.length!==3)return console.error("Invalid nativeAuthToken. Token must have 3 parts."),null;try{const[e,i,c]=o,l=a.decodeBase64(e),s=a.decodeBase64(i),r=u.decodeLoginToken(s);if(!r)return null;const d={...r,address:l,body:s,signature:c};return(t=r.extraInfo)!=null&&t.timestamp||delete d.extraInfo,d}catch(e){if(e instanceof Error)throw new Error(e.message)}}exports.decodeToken=f;
|
package/helpers/decodeToken.mjs
CHANGED
|
@@ -1,39 +1,28 @@
|
|
|
1
|
-
import { decodeBase64 } from "./base64Utils.mjs";
|
|
2
|
-
import { decodeLoginToken } from "./decodeLoginToken.mjs";
|
|
3
|
-
function
|
|
4
|
-
var
|
|
5
|
-
if (!
|
|
1
|
+
import { decodeBase64 as a } from "./base64Utils.mjs";
|
|
2
|
+
import { decodeLoginToken as u } from "./decodeLoginToken.mjs";
|
|
3
|
+
function m(o) {
|
|
4
|
+
var n;
|
|
5
|
+
if (!o)
|
|
6
6
|
return null;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
console.error("Invalid nativeAuthToken. Token must have 3 parts.");
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
7
|
+
const t = o.split(".");
|
|
8
|
+
if (t.length !== 3)
|
|
9
|
+
return console.error("Invalid nativeAuthToken. Token must have 3 parts."), null;
|
|
13
10
|
try {
|
|
14
|
-
const [
|
|
15
|
-
|
|
16
|
-
const parsedBody = decodeBase64(body);
|
|
17
|
-
const parsedInitToken = decodeLoginToken(parsedBody);
|
|
18
|
-
if (!parsedInitToken) {
|
|
11
|
+
const [e, i, c] = t, l = a(e), s = a(i), r = u(s);
|
|
12
|
+
if (!r)
|
|
19
13
|
return null;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
signature
|
|
14
|
+
const d = {
|
|
15
|
+
...r,
|
|
16
|
+
address: l,
|
|
17
|
+
body: s,
|
|
18
|
+
signature: c
|
|
26
19
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
} catch (error) {
|
|
32
|
-
if (error instanceof Error) {
|
|
33
|
-
throw new Error(error.message);
|
|
34
|
-
}
|
|
20
|
+
return (n = r.extraInfo) != null && n.timestamp || delete d.extraInfo, d;
|
|
21
|
+
} catch (e) {
|
|
22
|
+
if (e instanceof Error)
|
|
23
|
+
throw new Error(e.message);
|
|
35
24
|
}
|
|
36
25
|
}
|
|
37
26
|
export {
|
|
38
|
-
decodeToken
|
|
27
|
+
m as decodeToken
|
|
39
28
|
};
|
package/helpers/getApiURL.js
CHANGED
|
@@ -1,8 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const store_inMemoryStore = require("../store/inMemoryStore.js");
|
|
5
|
-
const getApiURL = () => {
|
|
6
|
-
return store_inMemoryStore.InMemoryStore.getInstance().getItem("apiURL") ?? "";
|
|
7
|
-
};
|
|
8
|
-
exports.getApiURL = getApiURL;
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../store/inMemoryStore.js"),t=()=>e.InMemoryStore.getInstance().getItem("apiURL")??"";exports.getApiURL=t;
|
package/helpers/getApiURL.mjs
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { InMemoryStore } from "../store/inMemoryStore.mjs";
|
|
2
|
-
const
|
|
3
|
-
return InMemoryStore.getInstance().getItem("apiURL") ?? "";
|
|
4
|
-
};
|
|
1
|
+
import { InMemoryStore as t } from "../store/inMemoryStore.mjs";
|
|
2
|
+
const r = () => t.getInstance().getItem("apiURL") ?? "";
|
|
5
3
|
export {
|
|
6
|
-
getApiURL
|
|
4
|
+
r as getApiURL
|
|
7
5
|
};
|
package/helpers/getBridgeURL.js
CHANGED
|
@@ -1,8 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const store_inMemoryStore = require("../store/inMemoryStore.js");
|
|
5
|
-
const getBridgeURL = () => {
|
|
6
|
-
return store_inMemoryStore.InMemoryStore.getInstance().getItem("bridgeURL") ?? "";
|
|
7
|
-
};
|
|
8
|
-
exports.getBridgeURL = getBridgeURL;
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../store/inMemoryStore.js"),t=()=>e.InMemoryStore.getInstance().getItem("bridgeURL")??"";exports.getBridgeURL=t;
|
package/helpers/getBridgeURL.mjs
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { InMemoryStore } from "../store/inMemoryStore.mjs";
|
|
2
|
-
const
|
|
3
|
-
return InMemoryStore.getInstance().getItem("bridgeURL") ?? "";
|
|
4
|
-
};
|
|
1
|
+
import { InMemoryStore as e } from "../store/inMemoryStore.mjs";
|
|
2
|
+
const r = () => e.getInstance().getItem("bridgeURL") ?? "";
|
|
5
3
|
export {
|
|
6
|
-
getBridgeURL
|
|
4
|
+
r as getBridgeURL
|
|
7
5
|
};
|
|
@@ -1,12 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
require("../reactjs/constants/index.js");
|
|
5
|
-
const reactjs_constants_chains = require("../reactjs/constants/chains.js");
|
|
6
|
-
const getDisplayName = (chain) => {
|
|
7
|
-
if (!(chain == null ? void 0 : chain.chainName)) {
|
|
8
|
-
return (chain == null ? void 0 : chain.networkName) || "";
|
|
9
|
-
}
|
|
10
|
-
return reactjs_constants_chains.ChainName[chain.chainName] || chain.networkName;
|
|
11
|
-
};
|
|
12
|
-
exports.getDisplayName = getDisplayName;
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../reactjs/constants/index.js");const t=require("../reactjs/constants/chains.js"),r=e=>e!=null&&e.chainName?t.ChainName[e.chainName]||e.networkName:(e==null?void 0:e.networkName)||"";exports.getDisplayName=r;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import "../reactjs/constants/index.mjs";
|
|
2
|
-
import { ChainName } from "../reactjs/constants/chains.mjs";
|
|
3
|
-
const
|
|
4
|
-
if (!(chain == null ? void 0 : chain.chainName)) {
|
|
5
|
-
return (chain == null ? void 0 : chain.networkName) || "";
|
|
6
|
-
}
|
|
7
|
-
return ChainName[chain.chainName] || chain.networkName;
|
|
8
|
-
};
|
|
2
|
+
import { ChainName as r } from "../reactjs/constants/chains.mjs";
|
|
3
|
+
const o = (e) => e != null && e.chainName ? r[e.chainName] || e.networkName : (e == null ? void 0 : e.networkName) || "";
|
|
9
4
|
export {
|
|
10
|
-
getDisplayName
|
|
5
|
+
o as getDisplayName
|
|
11
6
|
};
|
package/helpers/getMvxApiURL.js
CHANGED
|
@@ -1,8 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const store_inMemoryStore = require("../store/inMemoryStore.js");
|
|
5
|
-
const getMvxApiURL = () => {
|
|
6
|
-
return store_inMemoryStore.InMemoryStore.getInstance().getItem("mvxApiURL") ?? "";
|
|
7
|
-
};
|
|
8
|
-
exports.getMvxApiURL = getMvxApiURL;
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../store/inMemoryStore.js"),t=()=>e.InMemoryStore.getInstance().getItem("mvxApiURL")??"";exports.getMvxApiURL=t;
|
package/helpers/getMvxApiURL.mjs
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { InMemoryStore } from "../store/inMemoryStore.mjs";
|
|
2
|
-
const
|
|
3
|
-
return InMemoryStore.getInstance().getItem("mvxApiURL") ?? "";
|
|
4
|
-
};
|
|
1
|
+
import { InMemoryStore as t } from "../store/inMemoryStore.mjs";
|
|
2
|
+
const r = () => t.getInstance().getItem("mvxApiURL") ?? "";
|
|
5
3
|
export {
|
|
6
|
-
getMvxApiURL
|
|
4
|
+
r as getMvxApiURL
|
|
7
5
|
};
|
package/helpers/getMvxChainId.js
CHANGED
|
@@ -1,8 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const store_inMemoryStore = require("../store/inMemoryStore.js");
|
|
5
|
-
const getMvxChainId = () => {
|
|
6
|
-
return store_inMemoryStore.InMemoryStore.getInstance().getItem("mvxChainId") ?? "";
|
|
7
|
-
};
|
|
8
|
-
exports.getMvxChainId = getMvxChainId;
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../store/inMemoryStore.js"),t=()=>e.InMemoryStore.getInstance().getItem("mvxChainId")??"";exports.getMvxChainId=t;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { InMemoryStore } from "../store/inMemoryStore.mjs";
|
|
2
|
-
const
|
|
3
|
-
return InMemoryStore.getInstance().getItem("mvxChainId") ?? "";
|
|
4
|
-
};
|
|
1
|
+
import { InMemoryStore as t } from "../store/inMemoryStore.mjs";
|
|
2
|
+
const n = () => t.getInstance().getItem("mvxChainId") ?? "";
|
|
5
3
|
export {
|
|
6
|
-
getMvxChainId
|
|
4
|
+
n as getMvxChainId
|
|
7
5
|
};
|
|
@@ -1,8 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const store_inMemoryStore = require("../store/inMemoryStore.js");
|
|
5
|
-
const getMvxExplorerAddress = () => {
|
|
6
|
-
return store_inMemoryStore.InMemoryStore.getInstance().getItem("mvxExplorerAddress") ?? "";
|
|
7
|
-
};
|
|
8
|
-
exports.getMvxExplorerAddress = getMvxExplorerAddress;
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../store/inMemoryStore.js"),r=()=>e.InMemoryStore.getInstance().getItem("mvxExplorerAddress")??"";exports.getMvxExplorerAddress=r;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { InMemoryStore } from "../store/inMemoryStore.mjs";
|
|
2
|
-
const
|
|
3
|
-
return InMemoryStore.getInstance().getItem("mvxExplorerAddress") ?? "";
|
|
4
|
-
};
|
|
1
|
+
import { InMemoryStore as e } from "../store/inMemoryStore.mjs";
|
|
2
|
+
const t = () => e.getInstance().getItem("mvxExplorerAddress") ?? "";
|
|
5
3
|
export {
|
|
6
|
-
getMvxExplorerAddress
|
|
4
|
+
t as getMvxExplorerAddress
|
|
7
5
|
};
|
package/helpers/index.d.ts
CHANGED
|
@@ -3,7 +3,9 @@ export * from './decodeLoginToken';
|
|
|
3
3
|
export * from './decodeToken';
|
|
4
4
|
export * from './getApiURL';
|
|
5
5
|
export * from './getBridgeURL';
|
|
6
|
+
export * from './getDisplayName';
|
|
6
7
|
export * from './getMvxApiURL';
|
|
7
8
|
export * from './getMvxChainId';
|
|
8
9
|
export * from './getMvxExplorerAddress';
|
|
10
|
+
export * from './safeImageUrl';
|
|
9
11
|
export * from './serializeTransaction';
|
package/helpers/index.js
CHANGED
|
@@ -1,23 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const helpers_base64Utils = require("./base64Utils.js");
|
|
5
|
-
const helpers_decodeLoginToken = require("./decodeLoginToken.js");
|
|
6
|
-
const helpers_decodeToken = require("./decodeToken.js");
|
|
7
|
-
const helpers_getApiURL = require("./getApiURL.js");
|
|
8
|
-
const helpers_getBridgeURL = require("./getBridgeURL.js");
|
|
9
|
-
const helpers_getMvxApiURL = require("./getMvxApiURL.js");
|
|
10
|
-
const helpers_getMvxChainId = require("./getMvxChainId.js");
|
|
11
|
-
const helpers_getMvxExplorerAddress = require("./getMvxExplorerAddress.js");
|
|
12
|
-
const helpers_serializeTransaction = require("./serializeTransaction.js");
|
|
13
|
-
exports.decodeBase64 = helpers_base64Utils.decodeBase64;
|
|
14
|
-
exports.encodeToBase64 = helpers_base64Utils.encodeToBase64;
|
|
15
|
-
exports.isStringBase64 = helpers_base64Utils.isStringBase64;
|
|
16
|
-
exports.decodeLoginToken = helpers_decodeLoginToken.decodeLoginToken;
|
|
17
|
-
exports.decodeToken = helpers_decodeToken.decodeToken;
|
|
18
|
-
exports.getApiURL = helpers_getApiURL.getApiURL;
|
|
19
|
-
exports.getBridgeURL = helpers_getBridgeURL.getBridgeURL;
|
|
20
|
-
exports.getMvxApiURL = helpers_getMvxApiURL.getMvxApiURL;
|
|
21
|
-
exports.getMvxChainId = helpers_getMvxChainId.getMvxChainId;
|
|
22
|
-
exports.getMvxExplorerAddress = helpers_getMvxExplorerAddress.getMvxExplorerAddress;
|
|
23
|
-
exports.serializeTransaction = helpers_serializeTransaction.serializeTransaction;
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./base64Utils.js"),r=require("./decodeLoginToken.js"),s=require("./decodeToken.js"),i=require("./getApiURL.js"),o=require("./getBridgeURL.js"),t=require("./getDisplayName.js"),n=require("./getMvxApiURL.js"),a=require("./getMvxChainId.js"),d=require("./getMvxExplorerAddress.js"),g=require("./safeImageUrl.js"),l=require("./serializeTransaction.js");exports.decodeBase64=e.decodeBase64;exports.encodeToBase64=e.encodeToBase64;exports.isStringBase64=e.isStringBase64;exports.decodeLoginToken=r.decodeLoginToken;exports.decodeToken=s.decodeToken;exports.getApiURL=i.getApiURL;exports.getBridgeURL=o.getBridgeURL;exports.getDisplayName=t.getDisplayName;exports.getMvxApiURL=n.getMvxApiURL;exports.getMvxChainId=a.getMvxChainId;exports.getMvxExplorerAddress=d.getMvxExplorerAddress;exports.safeImageUrl=g.safeImageUrl;exports.serializeTransaction=l.serializeTransaction;
|
package/helpers/index.mjs
CHANGED
|
@@ -1,22 +1,26 @@
|
|
|
1
|
-
import { decodeBase64, encodeToBase64, isStringBase64 } from "./base64Utils.mjs";
|
|
2
|
-
import { decodeLoginToken } from "./decodeLoginToken.mjs";
|
|
3
|
-
import { decodeToken } from "./decodeToken.mjs";
|
|
4
|
-
import { getApiURL } from "./getApiURL.mjs";
|
|
5
|
-
import { getBridgeURL } from "./getBridgeURL.mjs";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
1
|
+
import { decodeBase64 as r, encodeToBase64 as t, isStringBase64 as p } from "./base64Utils.mjs";
|
|
2
|
+
import { decodeLoginToken as m } from "./decodeLoginToken.mjs";
|
|
3
|
+
import { decodeToken as a } from "./decodeToken.mjs";
|
|
4
|
+
import { getApiURL as i } from "./getApiURL.mjs";
|
|
5
|
+
import { getBridgeURL as s } from "./getBridgeURL.mjs";
|
|
6
|
+
import { getDisplayName as c } from "./getDisplayName.mjs";
|
|
7
|
+
import { getMvxApiURL as B } from "./getMvxApiURL.mjs";
|
|
8
|
+
import { getMvxChainId as T } from "./getMvxChainId.mjs";
|
|
9
|
+
import { getMvxExplorerAddress as v } from "./getMvxExplorerAddress.mjs";
|
|
10
|
+
import { safeImageUrl as M } from "./safeImageUrl.mjs";
|
|
11
|
+
import { serializeTransaction as k } from "./serializeTransaction.mjs";
|
|
10
12
|
export {
|
|
11
|
-
decodeBase64,
|
|
12
|
-
decodeLoginToken,
|
|
13
|
-
decodeToken,
|
|
14
|
-
encodeToBase64,
|
|
15
|
-
getApiURL,
|
|
16
|
-
getBridgeURL,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
r as decodeBase64,
|
|
14
|
+
m as decodeLoginToken,
|
|
15
|
+
a as decodeToken,
|
|
16
|
+
t as encodeToBase64,
|
|
17
|
+
i as getApiURL,
|
|
18
|
+
s as getBridgeURL,
|
|
19
|
+
c as getDisplayName,
|
|
20
|
+
B as getMvxApiURL,
|
|
21
|
+
T as getMvxChainId,
|
|
22
|
+
v as getMvxExplorerAddress,
|
|
23
|
+
p as isStringBase64,
|
|
24
|
+
M as safeImageUrl,
|
|
25
|
+
k as serializeTransaction
|
|
22
26
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function safeImageUrl(url: string | undefined, fallback?: string): string;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=["data:","javascript:","file:","blob:"],s=2048;function i(t,e=""){if(!t||typeof t!="string"||t.length===0||t.length>s)return e;const r=t.toLowerCase();for(const n of o)if(r.startsWith(n))return e;return r.startsWith("https://")?t:e}exports.safeImageUrl=i;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const o = ["data:", "javascript:", "file:", "blob:"];
|
|
2
|
+
function s(t, e = "") {
|
|
3
|
+
if (!t || typeof t != "string" || t.length === 0 || t.length > 2048)
|
|
4
|
+
return e;
|
|
5
|
+
const r = t.toLowerCase();
|
|
6
|
+
for (const n of o)
|
|
7
|
+
if (r.startsWith(n))
|
|
8
|
+
return e;
|
|
9
|
+
return r.startsWith("https://") ? t : e;
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
s as safeImageUrl
|
|
13
|
+
};
|
|
@@ -1,9 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
function serializeTransaction(transaction) {
|
|
5
|
-
return JSON.stringify(transaction, (_key, value) => {
|
|
6
|
-
return typeof value === "bigint" ? Number(value).toString() : value;
|
|
7
|
-
});
|
|
8
|
-
}
|
|
9
|
-
exports.serializeTransaction = serializeTransaction;
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function t(n){return JSON.stringify(n,(e,i)=>typeof i=="bigint"?i.toString():i)}exports.serializeTransaction=t;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
function
|
|
2
|
-
return JSON.stringify(
|
|
3
|
-
return typeof value === "bigint" ? Number(value).toString() : value;
|
|
4
|
-
});
|
|
1
|
+
function r(i) {
|
|
2
|
+
return JSON.stringify(i, (n, t) => typeof t == "bigint" ? t.toString() : t);
|
|
5
3
|
}
|
|
6
4
|
export {
|
|
7
|
-
serializeTransaction
|
|
5
|
+
r as serializeTransaction
|
|
8
6
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";const r=require("../../types/errors.js"),e=require("../assertRateConfirmationMatchesIntent.js"),o=(n={})=>({to:"0xdeadbeef",data:"0x",gasLimit:BigInt(21e3),value:BigInt(0),account:"0xSender",txHash:"",...n});describe("assertRateConfirmationMatchesIntent",()=>{const n={fromChainId:"1",sender:"0xSender"};it("does not throw for an empty transactions array",()=>{expect(()=>e.assertRateConfirmationMatchesIntent(n,[])).not.toThrow()}),it("does not throw when chainID and account match",()=>{const t=o({chainID:"1",account:"0xSender"});expect(()=>e.assertRateConfirmationMatchesIntent(n,[t])).not.toThrow()}),it("does not throw when chainID is undefined (field absent)",()=>{const t=o({account:"0xSender"});expect(()=>e.assertRateConfirmationMatchesIntent(n,[t])).not.toThrow()}),it("throws RateConfirmationMismatchError when chainID does not match fromChainId",()=>{const t=o({chainID:"999",account:"0xSender"});expect(()=>e.assertRateConfirmationMatchesIntent(n,[t])).toThrow(r.RateConfirmationMismatchError)}),it("throws RateConfirmationMismatchError when account does not match sender (case-insensitive)",()=>{const t=o({account:"0xAttacker"});expect(()=>e.assertRateConfirmationMatchesIntent(n,[t])).toThrow(r.RateConfirmationMismatchError)}),it("does not throw when account matches sender case-insensitively",()=>{const t=o({account:"0xsender"}),a={fromChainId:"1",sender:"0xSENDER"};expect(()=>e.assertRateConfirmationMatchesIntent(a,[t])).not.toThrow()}),it("throws RateConfirmationMismatchError when MvX sender field does not match",()=>{const t=o({account:"0xSender",sender:"erd1attacker"}),a={fromChainId:"1",sender:"erd1legit"};expect(()=>e.assertRateConfirmationMatchesIntent(a,[t])).toThrow(r.RateConfirmationMismatchError)}),it("throws on the bad transaction when mixed valid and invalid transactions are present",()=>{const t=o({chainID:"1",account:"0xSender"}),a=o({chainID:"999",account:"0xSender"});expect(()=>e.assertRateConfirmationMatchesIntent(n,[t,a])).toThrow(r.RateConfirmationMismatchError)})});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { RateConfirmationMismatchError as r } from "../../types/errors.mjs";
|
|
2
|
+
import { assertRateConfirmationMatchesIntent as e } from "../assertRateConfirmationMatchesIntent.mjs";
|
|
3
|
+
const o = (n = {}) => ({
|
|
4
|
+
to: "0xdeadbeef",
|
|
5
|
+
data: "0x",
|
|
6
|
+
gasLimit: BigInt(21e3),
|
|
7
|
+
value: BigInt(0),
|
|
8
|
+
account: "0xSender",
|
|
9
|
+
txHash: "",
|
|
10
|
+
...n
|
|
11
|
+
});
|
|
12
|
+
describe("assertRateConfirmationMatchesIntent", () => {
|
|
13
|
+
const n = { fromChainId: "1", sender: "0xSender" };
|
|
14
|
+
it("does not throw for an empty transactions array", () => {
|
|
15
|
+
expect(() => e(n, [])).not.toThrow();
|
|
16
|
+
}), it("does not throw when chainID and account match", () => {
|
|
17
|
+
const t = o({ chainID: "1", account: "0xSender" });
|
|
18
|
+
expect(
|
|
19
|
+
() => e(n, [t])
|
|
20
|
+
).not.toThrow();
|
|
21
|
+
}), it("does not throw when chainID is undefined (field absent)", () => {
|
|
22
|
+
const t = o({ account: "0xSender" });
|
|
23
|
+
expect(
|
|
24
|
+
() => e(n, [t])
|
|
25
|
+
).not.toThrow();
|
|
26
|
+
}), it("throws RateConfirmationMismatchError when chainID does not match fromChainId", () => {
|
|
27
|
+
const t = o({ chainID: "999", account: "0xSender" });
|
|
28
|
+
expect(() => e(n, [t])).toThrow(
|
|
29
|
+
r
|
|
30
|
+
);
|
|
31
|
+
}), it("throws RateConfirmationMismatchError when account does not match sender (case-insensitive)", () => {
|
|
32
|
+
const t = o({ account: "0xAttacker" });
|
|
33
|
+
expect(() => e(n, [t])).toThrow(
|
|
34
|
+
r
|
|
35
|
+
);
|
|
36
|
+
}), it("does not throw when account matches sender case-insensitively", () => {
|
|
37
|
+
const t = o({ account: "0xsender" }), a = { fromChainId: "1", sender: "0xSENDER" };
|
|
38
|
+
expect(
|
|
39
|
+
() => e(a, [t])
|
|
40
|
+
).not.toThrow();
|
|
41
|
+
}), it("throws RateConfirmationMismatchError when MvX sender field does not match", () => {
|
|
42
|
+
const t = o({ account: "0xSender", sender: "erd1attacker" }), a = { fromChainId: "1", sender: "erd1legit" };
|
|
43
|
+
expect(() => e(a, [t])).toThrow(
|
|
44
|
+
r
|
|
45
|
+
);
|
|
46
|
+
}), it("throws on the bad transaction when mixed valid and invalid transactions are present", () => {
|
|
47
|
+
const t = o({ chainID: "1", account: "0xSender" }), a = o({ chainID: "999", account: "0xSender" });
|
|
48
|
+
expect(
|
|
49
|
+
() => e(n, [t, a])
|
|
50
|
+
).toThrow(r);
|
|
51
|
+
});
|
|
52
|
+
});
|