@multiversx/sdk-dapp-liquidity 2.0.0 → 2.1.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/all-networks--dfVLHLJ.js +2 -0
- package/all-networks-Czd8zS1n.mjs +4 -0
- package/api/checkAccount.js +1 -21
- package/api/checkAccount.mjs +13 -13
- package/api/confirmRate.js +1 -29
- package/api/confirmRate.mjs +17 -22
- package/api/getChains.js +1 -17
- package/api/getChains.mjs +10 -10
- package/api/getRate.js +1 -27
- package/api/getRate.mjs +17 -20
- package/api/getTokens.js +1 -22
- package/api/getTokens.mjs +14 -15
- package/api/getTokensBalances.js +1 -21
- package/api/getTokensBalances.mjs +13 -13
- package/api/getTransactions.js +1 -38
- package/api/getTransactions.mjs +25 -31
- package/api/index.js +1 -18
- package/api/index.mjs +16 -16
- package/api/sendTransactions.js +1 -32
- package/api/sendTransactions.mjs +19 -19
- package/api/tests/confirmRate.spec.js +1 -130
- package/api/tests/confirmRate.spec.mjs +44 -58
- package/api/tests/getChains.spec.js +1 -43
- package/api/tests/getChains.spec.mjs +15 -18
- package/api/tests/getRate.spec.js +1 -87
- package/api/tests/getRate.spec.mjs +35 -49
- package/api/tests/getTokens.spec.js +1 -68
- package/api/tests/getTokens.spec.mjs +23 -29
- package/api/tests/getTransactions.spec.js +1 -94
- package/api/tests/getTransactions.spec.mjs +35 -51
- package/api/tests/sendTransactions.spec.js +1 -96
- package/api/tests/sendTransactions.spec.mjs +44 -52
- package/constants/index.js +1 -4
- package/constants/index.mjs +2 -2
- package/default-D0Jk5ROI.mjs +4 -0
- package/default-DbU6vPaB.js +2 -0
- package/helpers/assertRateConfirmationMatchesIntent.d.ts +8 -0
- package/helpers/assertRateConfirmationMatchesIntent.js +2 -0
- package/helpers/assertRateConfirmationMatchesIntent.mjs +20 -0
- package/helpers/base64Utils.js +1 -31
- package/helpers/base64Utils.mjs +14 -24
- package/helpers/decodeLoginToken.js +1 -27
- package/helpers/decodeLoginToken.mjs +13 -18
- package/helpers/decodeToken.js +1 -39
- package/helpers/decodeToken.mjs +20 -31
- package/helpers/getApiURL.js +1 -7
- package/helpers/getApiURL.mjs +3 -5
- package/helpers/getBridgeURL.js +1 -7
- package/helpers/getBridgeURL.mjs +3 -5
- package/helpers/getDisplayName.js +1 -11
- package/helpers/getDisplayName.mjs +3 -8
- package/helpers/getMvxApiURL.js +1 -7
- package/helpers/getMvxApiURL.mjs +3 -5
- package/helpers/getMvxChainId.js +1 -7
- package/helpers/getMvxChainId.mjs +3 -5
- package/helpers/getMvxExplorerAddress.js +1 -7
- package/helpers/getMvxExplorerAddress.mjs +3 -5
- package/helpers/index.d.ts +2 -0
- package/helpers/index.js +1 -22
- package/helpers/index.mjs +24 -20
- package/helpers/safeImageUrl.d.ts +1 -0
- package/helpers/safeImageUrl.js +2 -0
- package/helpers/safeImageUrl.mjs +13 -0
- package/helpers/serializeTransaction.js +1 -8
- package/helpers/serializeTransaction.mjs +3 -5
- package/helpers/tests/assertRateConfirmationMatchesIntent.spec.d.ts +1 -0
- package/helpers/tests/assertRateConfirmationMatchesIntent.spec.js +2 -0
- package/helpers/tests/assertRateConfirmationMatchesIntent.spec.mjs +52 -0
- package/helpers/tests/base64Utils.spec.js +1 -29
- package/helpers/tests/base64Utils.spec.mjs +11 -24
- package/helpers/tests/decodeLoginToken.spec.js +1 -34
- package/helpers/tests/decodeLoginToken.spec.mjs +13 -24
- package/helpers/tests/decodeToken.spec.js +1 -27
- package/helpers/tests/decodeToken.spec.mjs +7 -12
- package/helpers/tests/safeImageUrl.spec.d.ts +1 -0
- package/helpers/tests/safeImageUrl.spec.js +2 -0
- package/helpers/tests/safeImageUrl.spec.mjs +32 -0
- package/helpers/tests/serializeTransaction.spec.d.ts +1 -0
- package/helpers/tests/serializeTransaction.spec.js +2 -0
- package/helpers/tests/serializeTransaction.spec.mjs +24 -0
- package/index.js +1 -228
- package/index.mjs +196 -192
- package/package.json +14 -9
- package/react.esm-B0AMOHxa.js +73 -0
- package/react.esm-BxvJJ86Q.mjs +9949 -0
- package/reactjs/adapters/SuiAdapter.d.ts +14 -0
- package/reactjs/adapters/SuiAdapter.js +1 -349
- package/reactjs/adapters/SuiAdapter.mjs +171 -199
- package/reactjs/components/AccountAddress/AccountAddress.js +1 -31
- package/reactjs/components/AccountAddress/AccountAddress.mjs +16 -16
- package/reactjs/components/AccountAddress/index.js +1 -4
- package/reactjs/components/AccountAddress/index.mjs +2 -2
- package/reactjs/components/AmountCard/AmountCard.js +1 -33
- package/reactjs/components/AmountCard/AmountCard.mjs +19 -21
- package/reactjs/components/AmountCard/index.js +1 -4
- package/reactjs/components/AmountCard/index.mjs +2 -2
- package/reactjs/components/AmountInput/AmountInput.js +1 -71
- package/reactjs/components/AmountInput/AmountInput.mjs +42 -46
- package/reactjs/components/AmountInput/index.js +1 -4
- package/reactjs/components/AmountInput/index.mjs +2 -2
- package/reactjs/components/BridgeForm/BridgeForm.d.ts +9 -0
- package/reactjs/components/BridgeForm/BridgeForm.js +1 -89
- package/reactjs/components/BridgeForm/BridgeForm.mjs +72 -79
- package/reactjs/components/BridgeForm/Deposit.js +1 -673
- package/reactjs/components/BridgeForm/Deposit.mjs +381 -503
- package/reactjs/components/BridgeForm/Transfer.js +1 -559
- package/reactjs/components/BridgeForm/Transfer.mjs +316 -427
- package/reactjs/components/BridgeForm/hooks/useBridgeAmounts.js +1 -78
- package/reactjs/components/BridgeForm/hooks/useBridgeAmounts.mjs +47 -70
- package/reactjs/components/BridgeForm/hooks/useBridgeRateFetching.js +1 -58
- package/reactjs/components/BridgeForm/hooks/useBridgeRateFetching.mjs +36 -47
- package/reactjs/components/BridgeForm/hooks/useBridgeTokenSelection.js +1 -266
- package/reactjs/components/BridgeForm/hooks/useBridgeTokenSelection.mjs +163 -231
- package/reactjs/components/BridgeForm/index.js +1 -4
- package/reactjs/components/BridgeForm/index.mjs +2 -2
- package/reactjs/components/BridgeForm/utils/bridgeFormHelpers.js +1 -76
- package/reactjs/components/BridgeForm/utils/bridgeFormHelpers.mjs +35 -65
- package/reactjs/components/BridgeHistory/BridgeHistory.js +1 -367
- package/reactjs/components/BridgeHistory/BridgeHistory.mjs +177 -193
- package/reactjs/components/BridgeHistory/index.js +1 -4
- package/reactjs/components/BridgeHistory/index.mjs +2 -2
- package/reactjs/components/Connect/BridgeAccountDisplay.js +1 -150
- package/reactjs/components/Connect/BridgeAccountDisplay.mjs +99 -115
- package/reactjs/components/Connect/BridgeConnectButton.js +1 -34
- package/reactjs/components/Connect/BridgeConnectButton.mjs +20 -19
- package/reactjs/components/Connect/ChainSelectConnect.js +1 -144
- package/reactjs/components/Connect/ChainSelectConnect.mjs +70 -83
- package/reactjs/components/Connect/CustomConnectButton.js +1 -40
- package/reactjs/components/Connect/CustomConnectButton.mjs +24 -30
- package/reactjs/components/Connect/MvxAccountDisplay.js +1 -97
- package/reactjs/components/Connect/MvxAccountDisplay.mjs +47 -50
- package/reactjs/components/Connect/MvxConnectButton.js +1 -43
- package/reactjs/components/Connect/MvxConnectButton.mjs +35 -40
- package/reactjs/components/Connect/SwitchChainButton.js +1 -29
- package/reactjs/components/Connect/SwitchChainButton.mjs +15 -18
- package/reactjs/components/Connect/index.js +1 -16
- package/reactjs/components/Connect/index.mjs +14 -14
- package/reactjs/components/CopyButton/CopyButton.js +1 -46
- package/reactjs/components/CopyButton/CopyButton.mjs +33 -36
- package/reactjs/components/CopyButton/index.js +1 -4
- package/reactjs/components/CopyButton/index.mjs +2 -2
- package/reactjs/components/CopyButton/utils/copyToClipboard.js +1 -38
- package/reactjs/components/CopyButton/utils/copyToClipboard.mjs +20 -32
- package/reactjs/components/CopyButton/utils/index.js +1 -4
- package/reactjs/components/CopyButton/utils/index.mjs +2 -2
- package/reactjs/components/DisplayAmount/DisplayAmount.js +1 -90
- package/reactjs/components/DisplayAmount/DisplayAmount.mjs +68 -75
- package/reactjs/components/DisplayAmount/components/AnimateNumber/AnimateNumber.js +1 -39
- package/reactjs/components/DisplayAmount/components/AnimateNumber/AnimateNumber.mjs +26 -33
- package/reactjs/components/DisplayAmount/components/PrecisedAmount/PrecisedAmount.js +1 -61
- package/reactjs/components/DisplayAmount/components/PrecisedAmount/PrecisedAmount.mjs +38 -46
- package/reactjs/components/DisplayAmount/index.js +1 -4
- package/reactjs/components/DisplayAmount/index.mjs +2 -2
- package/reactjs/components/DisplayAmount/utils/index.js +1 -4
- package/reactjs/components/DisplayAmount/utils/index.mjs +2 -2
- package/reactjs/components/DisplayAmount/utils/truncateAmount.js +1 -21
- package/reactjs/components/DisplayAmount/utils/truncateAmount.mjs +9 -13
- package/reactjs/components/Error/Error.js +1 -66
- package/reactjs/components/Error/Error.mjs +29 -29
- package/reactjs/components/Error/index.js +1 -4
- package/reactjs/components/Error/index.mjs +2 -2
- package/reactjs/components/SmallLoader/SmallLoader.js +1 -21
- package/reactjs/components/SmallLoader/SmallLoader.mjs +13 -18
- package/reactjs/components/SmallLoader/index.js +1 -4
- package/reactjs/components/SmallLoader/index.mjs +2 -2
- package/reactjs/components/ToggleDirection/ToggleDirection.js +1 -30
- package/reactjs/components/ToggleDirection/ToggleDirection.mjs +22 -28
- package/reactjs/components/TokenSelector/TokenSelector.js +1 -172
- package/reactjs/components/TokenSelector/TokenSelector.mjs +98 -118
- package/reactjs/components/TokenSelector/components/ChainSelect/ChainSelect.js +1 -94
- package/reactjs/components/TokenSelector/components/ChainSelect/ChainSelect.mjs +48 -57
- package/reactjs/components/TokenSelector/components/ChainSelect/components/ChainOptionLabel.js +1 -51
- package/reactjs/components/TokenSelector/components/ChainSelect/components/ChainOptionLabel.mjs +45 -44
- package/reactjs/components/TokenSelector/components/ChainSelect/components/FormatChainOptionLabel.js +1 -18
- package/reactjs/components/TokenSelector/components/ChainSelect/components/FormatChainOptionLabel.mjs +9 -14
- package/reactjs/components/TokenSelector/components/ChainSelect/components/IndicatorSeparator.js +1 -6
- package/reactjs/components/TokenSelector/components/ChainSelect/components/IndicatorSeparator.mjs +2 -4
- package/reactjs/components/TokenSelector/components/ChainSelect/components/SelectedChainOption.js +1 -39
- package/reactjs/components/TokenSelector/components/ChainSelect/components/SelectedChainOption.mjs +22 -18
- package/reactjs/components/TokenSelector/components/SelectContainer.js +1 -40
- package/reactjs/components/TokenSelector/components/SelectContainer.mjs +36 -38
- package/reactjs/components/TokenSelector/components/SelectContent.js +1 -136
- package/reactjs/components/TokenSelector/components/SelectContent.mjs +79 -103
- package/reactjs/components/TokenSelector/components/SelectedOption.js +1 -28
- package/reactjs/components/TokenSelector/components/SelectedOption.mjs +22 -24
- package/reactjs/components/TokenSelector/components/TokenIcon.js +1 -81
- package/reactjs/components/TokenSelector/components/TokenIcon.mjs +52 -57
- package/reactjs/components/TokenSelector/components/TokenItem.js +1 -80
- package/reactjs/components/TokenSelector/components/TokenItem.mjs +41 -54
- package/reactjs/components/TokenSelector/components/TokenList.js +1 -23
- package/reactjs/components/TokenSelector/components/TokenList.mjs +19 -21
- package/reactjs/components/TokenSelector/components/TokenSymbol.js +1 -25
- package/reactjs/components/TokenSelector/components/TokenSymbol.mjs +14 -15
- package/reactjs/components/TokenSelector/index.js +1 -4
- package/reactjs/components/TokenSelector/index.mjs +2 -2
- package/reactjs/components/TransactionToast/TransactionToast.js +1 -53
- package/reactjs/components/TransactionToast/TransactionToast.mjs +27 -28
- package/reactjs/components/TransactionToast/TransactionToastContainer.js +1 -20
- package/reactjs/components/TransactionToast/TransactionToastContainer.mjs +16 -18
- package/reactjs/components/TransactionToast/index.js +1 -6
- package/reactjs/components/TransactionToast/index.mjs +4 -4
- package/reactjs/components/TrimAddress/TrimAddress.js +1 -27
- package/reactjs/components/TrimAddress/TrimAddress.mjs +19 -24
- package/reactjs/components/TrimAddress/index.js +1 -4
- package/reactjs/components/TrimAddress/index.mjs +2 -2
- package/reactjs/components/base/MxButton/MxButton.js +1 -71
- package/reactjs/components/base/MxButton/MxButton.mjs +46 -46
- package/reactjs/components/base/MxButton/index.js +1 -4
- package/reactjs/components/base/MxButton/index.mjs +2 -2
- package/reactjs/components/base/MxCard/MxCard.js +1 -54
- package/reactjs/components/base/MxCard/MxCard.mjs +34 -34
- package/reactjs/components/base/MxCard/index.js +1 -4
- package/reactjs/components/base/MxCard/index.mjs +2 -2
- package/reactjs/components/base/MxCircleLoader/MxCircleLoader.js +1 -28
- package/reactjs/components/base/MxCircleLoader/MxCircleLoader.mjs +24 -26
- package/reactjs/components/base/MxCircleLoader/index.js +1 -4
- package/reactjs/components/base/MxCircleLoader/index.mjs +2 -2
- package/reactjs/components/base/MxLink/MxLink.js +1 -70
- package/reactjs/components/base/MxLink/MxLink.mjs +44 -46
- package/reactjs/components/base/MxLink/index.js +1 -4
- package/reactjs/components/base/MxLink/index.mjs +2 -2
- package/reactjs/components/base/MxSearch/MxSearch.js +1 -69
- package/reactjs/components/base/MxSearch/MxSearch.mjs +37 -41
- package/reactjs/components/base/MxSearch/index.js +1 -4
- package/reactjs/components/base/MxSearch/index.mjs +2 -2
- package/reactjs/components/base/MxSlideover/MxSlideover.js +1 -78
- package/reactjs/components/base/MxSlideover/MxSlideover.mjs +72 -74
- package/reactjs/components/base/MxSlideover/index.js +1 -4
- package/reactjs/components/base/MxSlideover/index.mjs +2 -2
- package/reactjs/components/base/MxTooltip/MxTooltip.js +1 -163
- package/reactjs/components/base/MxTooltip/MxTooltip.mjs +92 -135
- package/reactjs/components/base/MxTooltip/components/TooltipContainer/TooltipContainer.js +1 -33
- package/reactjs/components/base/MxTooltip/components/TooltipContainer/TooltipContainer.mjs +29 -31
- package/reactjs/components/base/MxTooltip/components/TooltipContainer/index.js +1 -4
- package/reactjs/components/base/MxTooltip/components/TooltipContainer/index.mjs +2 -2
- package/reactjs/components/base/MxTooltip/components/TooltipContent/TooltipContent.js +1 -27
- package/reactjs/components/base/MxTooltip/components/TooltipContent/TooltipContent.mjs +23 -25
- package/reactjs/components/base/MxTooltip/components/TooltipContent/index.js +1 -4
- package/reactjs/components/base/MxTooltip/components/TooltipContent/index.mjs +2 -2
- package/reactjs/components/base/MxTooltip/components/index.js +1 -6
- package/reactjs/components/base/MxTooltip/components/index.mjs +4 -4
- package/reactjs/components/base/MxTooltip/index.js +1 -4
- package/reactjs/components/base/MxTooltip/index.mjs +2 -2
- package/reactjs/components/base/index.js +1 -14
- package/reactjs/components/base/index.mjs +12 -12
- package/reactjs/components/index.js +1 -54
- package/reactjs/components/index.mjs +52 -52
- package/reactjs/constants/chains.js +1 -54
- package/reactjs/constants/chains.mjs +33 -52
- package/reactjs/constants/index.js +1 -13
- package/reactjs/constants/index.mjs +9 -10
- package/reactjs/context/Web3AppProvider.js +1 -40
- package/reactjs/context/Web3AppProvider.mjs +34 -34
- package/reactjs/context/queryClient.js +1 -11
- package/reactjs/context/queryClient.mjs +5 -8
- package/reactjs/context/useWeb3App.js +1 -12
- package/reactjs/context/useWeb3App.mjs +7 -8
- package/reactjs/helpers/index.js +1 -6
- package/reactjs/helpers/index.mjs +4 -4
- package/reactjs/helpers/resolveBridgeApiChainId.js +1 -40
- package/reactjs/helpers/resolveBridgeApiChainId.mjs +21 -34
- package/reactjs/hooks/index.js +1 -35
- package/reactjs/hooks/index.mjs +33 -33
- package/reactjs/hooks/tests/useGenericSignMessage.spec.d.ts +1 -0
- package/reactjs/hooks/tests/useGenericSignMessage.spec.js +2 -0
- package/reactjs/hooks/tests/useGenericSignMessage.spec.mjs +52 -0
- package/reactjs/hooks/tests/useSignTransaction.spec.d.ts +1 -0
- package/reactjs/hooks/tests/useSignTransaction.spec.js +2 -0
- package/reactjs/hooks/tests/useSignTransaction.spec.mjs +156 -0
- package/reactjs/hooks/useAccount.js +1 -13
- package/reactjs/hooks/useAccount.mjs +7 -8
- package/reactjs/hooks/useBalances.js +1 -53
- package/reactjs/hooks/useBalances.mjs +28 -40
- package/reactjs/hooks/useBridgeApiChainId.js +1 -13
- package/reactjs/hooks/useBridgeApiChainId.mjs +9 -9
- package/reactjs/hooks/useBridgeFormik.js +1 -162
- package/reactjs/hooks/useBridgeFormik.mjs +110 -150
- package/reactjs/hooks/useDebounce.js +1 -13
- package/reactjs/hooks/useDebounce.mjs +8 -10
- package/reactjs/hooks/useFetchBridgeData.js +1 -45
- package/reactjs/hooks/useFetchBridgeData.mjs +37 -38
- package/reactjs/hooks/useFetchTokens.js +1 -113
- package/reactjs/hooks/useFetchTokens.mjs +80 -106
- package/reactjs/hooks/useGenericSignMessage.js +1 -55
- package/reactjs/hooks/useGenericSignMessage.mjs +47 -47
- package/reactjs/hooks/useGetChainId.js +1 -11
- package/reactjs/hooks/useGetChainId.mjs +7 -8
- package/reactjs/hooks/useResolveTokenChain.js +1 -20
- package/reactjs/hooks/useResolveTokenChain.mjs +11 -14
- package/reactjs/hooks/useSendTransactions.js +1 -25
- package/reactjs/hooks/useSendTransactions.mjs +19 -23
- package/reactjs/hooks/useSignTransaction.js +1 -86
- package/reactjs/hooks/useSignTransaction.mjs +59 -59
- package/reactjs/hooks/useSuiConnect.js +1 -86
- package/reactjs/hooks/useSuiConnect.mjs +52 -70
- package/reactjs/hooks/validation/index.js +1 -10
- package/reactjs/hooks/validation/index.mjs +8 -8
- package/reactjs/hooks/validation/useAmountSchema.js +1 -32
- package/reactjs/hooks/validation/useAmountSchema.mjs +8 -11
- package/reactjs/hooks/validation/useSecondAmountSchema.js +1 -26
- package/reactjs/hooks/validation/useSecondAmountSchema.mjs +5 -6
- package/reactjs/hooks/validation/useTestHasEnoughFunds.js +1 -37
- package/reactjs/hooks/validation/useTestHasEnoughFunds.mjs +20 -29
- package/reactjs/hooks/validation/useTestIsConnected.js +1 -27
- package/reactjs/hooks/validation/useTestIsConnected.mjs +13 -19
- package/reactjs/index.js +1 -190
- package/reactjs/index.mjs +154 -154
- package/reactjs/init/index.js +1 -5
- package/reactjs/init/index.mjs +3 -3
- package/reactjs/init/init.d.ts +1 -0
- package/reactjs/init/init.js +1 -139
- package/reactjs/init/init.mjs +59 -72
- package/reactjs/queries/index.js +1 -17
- package/reactjs/queries/index.mjs +15 -15
- package/reactjs/queries/useCheckAccount.query.js +1 -39
- package/reactjs/queries/useCheckAccount.query.mjs +29 -33
- package/reactjs/queries/useGetAllTokens.query.js +1 -35
- package/reactjs/queries/useGetAllTokens.query.mjs +26 -30
- package/reactjs/queries/useGetChains.query.js +1 -34
- package/reactjs/queries/useGetChains.query.mjs +26 -28
- package/reactjs/queries/useGetHistory.query.d.ts +1 -1
- package/reactjs/queries/useGetHistory.query.js +1 -68
- package/reactjs/queries/useGetHistory.query.mjs +55 -58
- package/reactjs/queries/useGetMvxTokensBalances.query.d.ts +1 -1
- package/reactjs/queries/useGetMvxTokensBalances.query.js +1 -71
- package/reactjs/queries/useGetMvxTokensBalances.query.mjs +40 -53
- package/reactjs/queries/useGetNonMvxTokensBalances.query.d.ts +1 -1
- package/reactjs/queries/useGetNonMvxTokensBalances.query.js +1 -81
- package/reactjs/queries/useGetNonMvxTokensBalances.query.mjs +51 -59
- package/reactjs/queries/useGetRate.mutation.js +1 -18
- package/reactjs/queries/useGetRate.mutation.mjs +12 -15
- package/reactjs/reexports.js +1 -48
- package/reactjs/reexports.mjs +13 -13
- package/reactjs/utils/delay.js +1 -6
- package/reactjs/utils/delay.mjs +3 -3
- package/reactjs/utils/formatAmount.js +1 -23
- package/reactjs/utils/formatAmount.mjs +16 -17
- package/reactjs/utils/getCleanStringAmount.js +1 -11
- package/reactjs/utils/getCleanStringAmount.mjs +6 -8
- package/reactjs/utils/getCompletePathname.js +1 -5
- package/reactjs/utils/getCompletePathname.mjs +3 -3
- package/reactjs/utils/getInitialTokens.js +1 -12
- package/reactjs/utils/getInitialTokens.mjs +6 -7
- package/reactjs/utils/hasEnoughFunds.js +1 -19
- package/reactjs/utils/hasEnoughFunds.mjs +11 -14
- package/reactjs/utils/index.js +1 -26
- package/reactjs/utils/index.mjs +24 -24
- package/reactjs/utils/isStringFloat.js +1 -21
- package/reactjs/utils/isStringFloat.mjs +11 -18
- package/reactjs/utils/mxClsx.js +1 -8
- package/reactjs/utils/mxClsx.mjs +4 -6
- package/reactjs/utils/pipe.js +1 -25
- package/reactjs/utils/pipe.mjs +13 -17
- package/reactjs/utils/removeCommas.js +1 -6
- package/reactjs/utils/removeCommas.mjs +2 -4
- package/reactjs/utils/roundAmount.js +1 -40
- package/reactjs/utils/roundAmount.mjs +16 -36
- package/reactjs/utils/testNumber.js +1 -4
- package/reactjs/utils/testNumber.mjs +2 -2
- package/store/inMemoryStore.js +1 -39
- package/store/inMemoryStore.mjs +17 -21
- package/style.css +1 -2274
- package/types/chainType.js +1 -11
- package/types/chainType.mjs +2 -9
- package/types/errors.d.ts +3 -0
- package/types/errors.js +2 -0
- package/types/errors.mjs +8 -0
- package/types/providerType.js +1 -9
- package/types/providerType.mjs +2 -7
- package/types/transaction.d.ts +2 -0
- package/all-networks-EJIVYZ_i.mjs +0 -4
- package/all-networks-NYACMyeN.js +0 -4
- package/default-BYtXv70Z.mjs +0 -4
- package/default-H3AbmzFV.js +0 -4
- package/reactjs/hooks/useSignTransaction.d.ts +0 -511
|
@@ -1,113 +1,87 @@
|
|
|
1
|
-
import { useMemo, useEffect } from "react";
|
|
2
|
-
import { useAccount } from "./useAccount.mjs";
|
|
3
|
-
import { useBridgeApiChainId } from "./useBridgeApiChainId.mjs";
|
|
4
|
-
import { MVX_CHAIN_IDS } from "../../constants/index.mjs";
|
|
5
|
-
import { useWeb3App } from "../context/useWeb3App.mjs";
|
|
6
|
-
import { useGetAllTokensQuery } from "../queries/useGetAllTokens.query.mjs";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
const
|
|
10
|
-
mvxAddress,
|
|
11
|
-
mvxApiURL,
|
|
12
|
-
refetchTrigger
|
|
1
|
+
import { useMemo as c, useEffect as f } from "react";
|
|
2
|
+
import { useAccount as y } from "./useAccount.mjs";
|
|
3
|
+
import { useBridgeApiChainId as A } from "./useBridgeApiChainId.mjs";
|
|
4
|
+
import { MVX_CHAIN_IDS as p } from "../../constants/index.mjs";
|
|
5
|
+
import { useWeb3App as Q } from "../context/useWeb3App.mjs";
|
|
6
|
+
import { useGetAllTokensQuery as S } from "../queries/useGetAllTokens.query.mjs";
|
|
7
|
+
import { useInvalidateMvxTokensBalancesQuery as x, useGetMvxTokensBalancesQuery as N } from "../queries/useGetMvxTokensBalances.query.mjs";
|
|
8
|
+
import { useInvalidateEvmTokensBalances as W, useGetNonMvxTokensBalancesQuery as G } from "../queries/useGetNonMvxTokensBalances.query.mjs";
|
|
9
|
+
const X = ({
|
|
10
|
+
mvxAddress: d,
|
|
11
|
+
mvxApiURL: T,
|
|
12
|
+
refetchTrigger: u
|
|
13
13
|
}) => {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
} =
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
});
|
|
25
|
-
const nonMvxTokens = useMemo(
|
|
26
|
-
() => tokens == null ? void 0 : tokens.filter(
|
|
27
|
-
(token) => !MVX_CHAIN_IDS.includes(token.chainId.toString()) && token.chainId.toLowerCase() !== "fiat"
|
|
14
|
+
const l = A(), m = y(), { nativeAuthToken: L, bridgeOnly: B } = Q(), v = x(), g = W(), {
|
|
15
|
+
data: a,
|
|
16
|
+
isLoading: h,
|
|
17
|
+
isError: k
|
|
18
|
+
} = S({
|
|
19
|
+
nativeAuthToken: L,
|
|
20
|
+
bridgeOnly: B
|
|
21
|
+
}), s = c(
|
|
22
|
+
() => a == null ? void 0 : a.filter(
|
|
23
|
+
(e) => !p.includes(e.chainId.toString()) && e.chainId.toLowerCase() !== "fiat"
|
|
28
24
|
),
|
|
29
|
-
[
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
(token) => MVX_CHAIN_IDS.includes(token.chainId.toString())
|
|
25
|
+
[a]
|
|
26
|
+
), o = c(
|
|
27
|
+
() => a == null ? void 0 : a.filter(
|
|
28
|
+
(e) => p.includes(e.chainId.toString())
|
|
34
29
|
),
|
|
35
|
-
[
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
useEffect(() => {
|
|
89
|
-
if (mvxAddress) {
|
|
90
|
-
invalidateMvxTokensBalancesQuery();
|
|
91
|
-
}
|
|
92
|
-
}, [refetchTrigger, mvxAddress]);
|
|
93
|
-
useEffect(() => {
|
|
94
|
-
if (!account.address) {
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
invalidateEvmTokensBalances();
|
|
98
|
-
}, [refetchTrigger, bridgeApiChainId, account.address]);
|
|
99
|
-
return {
|
|
100
|
-
isTokensLoading,
|
|
101
|
-
isTokensError,
|
|
102
|
-
isLoadingEvmTokensBalances: isLoadingNonMvxTokensBalances,
|
|
103
|
-
isErrorEvmTokensBalances: isErrorNonMvxTokensBalances,
|
|
104
|
-
evmTokensWithBalances: nonMvxTokensWithBalances,
|
|
105
|
-
isLoadingMvxTokensBalances,
|
|
106
|
-
isErrorMvxTokensBalances,
|
|
107
|
-
mvxTokensWithBalances,
|
|
108
|
-
tokens
|
|
30
|
+
[a]
|
|
31
|
+
), {
|
|
32
|
+
data: r,
|
|
33
|
+
isLoading: E,
|
|
34
|
+
isError: I
|
|
35
|
+
} = G({
|
|
36
|
+
tokens: s ?? [],
|
|
37
|
+
chainId: l
|
|
38
|
+
}), {
|
|
39
|
+
data: i,
|
|
40
|
+
isLoading: C,
|
|
41
|
+
isError: b
|
|
42
|
+
} = N({
|
|
43
|
+
tokens: o ?? [],
|
|
44
|
+
mvxAddress: d,
|
|
45
|
+
apiURL: T
|
|
46
|
+
}), M = c(() => o == null ? void 0 : o.map((e) => {
|
|
47
|
+
const n = i == null ? void 0 : i.find(
|
|
48
|
+
(t) => t.address.toLowerCase() === e.address.toLowerCase()
|
|
49
|
+
);
|
|
50
|
+
return n ? {
|
|
51
|
+
...n,
|
|
52
|
+
balance: n.balance.toString()
|
|
53
|
+
} : {
|
|
54
|
+
...e,
|
|
55
|
+
balance: "0"
|
|
56
|
+
};
|
|
57
|
+
}), [o, i]), w = c(() => s == null ? void 0 : s.map((e) => {
|
|
58
|
+
const n = r == null ? void 0 : r.find(
|
|
59
|
+
(t) => t.address.toLowerCase() === e.address.toLowerCase() && t.chainId.toLowerCase() === e.chainId.toLowerCase()
|
|
60
|
+
);
|
|
61
|
+
return n ? {
|
|
62
|
+
...n,
|
|
63
|
+
balance: n.balance.toString()
|
|
64
|
+
} : {
|
|
65
|
+
...e,
|
|
66
|
+
balance: "0"
|
|
67
|
+
};
|
|
68
|
+
}), [s, r]);
|
|
69
|
+
return f(() => {
|
|
70
|
+
d && v();
|
|
71
|
+
}, [u, d]), f(() => {
|
|
72
|
+
m.address && g();
|
|
73
|
+
}, [u, l, m.address]), {
|
|
74
|
+
isTokensLoading: h,
|
|
75
|
+
isTokensError: k,
|
|
76
|
+
isLoadingEvmTokensBalances: E,
|
|
77
|
+
isErrorEvmTokensBalances: I,
|
|
78
|
+
evmTokensWithBalances: w,
|
|
79
|
+
isLoadingMvxTokensBalances: C,
|
|
80
|
+
isErrorMvxTokensBalances: b,
|
|
81
|
+
mvxTokensWithBalances: M,
|
|
82
|
+
tokens: a
|
|
109
83
|
};
|
|
110
84
|
};
|
|
111
85
|
export {
|
|
112
|
-
useFetchTokens
|
|
86
|
+
X as useFetchTokens
|
|
113
87
|
};
|
|
@@ -1,56 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const react = require("@reown/appkit/react");
|
|
5
|
-
const wagmi = require("wagmi");
|
|
6
|
-
const reactjs_hooks_useAccount = require("./useAccount.js");
|
|
7
|
-
const useGenericSignMessage = () => {
|
|
8
|
-
const { caipNetwork } = react.useAppKitNetworkCore();
|
|
9
|
-
const { address, isConnected } = reactjs_hooks_useAccount.useAccount();
|
|
10
|
-
const { signMessageAsync } = wagmi.useSignMessage();
|
|
11
|
-
const { walletProvider: solWalletProvider } = react.useAppKitProvider("solana");
|
|
12
|
-
const { walletProvider: btcWalletProvider } = react.useAppKitProvider("bip122");
|
|
13
|
-
const { walletProvider: suiWalletProvider } = react.useAppKitProvider("sui");
|
|
14
|
-
const signMessage = async (message) => {
|
|
15
|
-
if (!isConnected || !(caipNetwork == null ? void 0 : caipNetwork.chainNamespace)) {
|
|
16
|
-
throw new Error("Wallet not connected or chain namespace unavailable");
|
|
17
|
-
}
|
|
18
|
-
switch (caipNetwork == null ? void 0 : caipNetwork.chainNamespace) {
|
|
19
|
-
case "eip155": {
|
|
20
|
-
return await signMessageAsync({ message });
|
|
21
|
-
}
|
|
22
|
-
case "solana": {
|
|
23
|
-
const encodedMessage = Buffer.from(message);
|
|
24
|
-
const signature = await solWalletProvider.signMessage(encodedMessage);
|
|
25
|
-
return Buffer.from(signature).toString("hex");
|
|
26
|
-
}
|
|
27
|
-
case "bip122": {
|
|
28
|
-
return await btcWalletProvider.signMessage({
|
|
29
|
-
address: address ?? "",
|
|
30
|
-
message
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
case "sui": {
|
|
34
|
-
if (!suiWalletProvider) {
|
|
35
|
-
throw new Error("Sui wallet not connected");
|
|
36
|
-
}
|
|
37
|
-
const encodedMessage = new TextEncoder().encode(message);
|
|
38
|
-
const result = await suiWalletProvider.request({
|
|
39
|
-
method: "sui_signPersonalMessage",
|
|
40
|
-
params: {
|
|
41
|
-
message: Buffer.from(encodedMessage).toString("base64")
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
return result.signature;
|
|
45
|
-
}
|
|
46
|
-
default:
|
|
47
|
-
throw new Error(
|
|
48
|
-
`Unsupported chain namespace: ${caipNetwork.chainNamespace}`
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
return {
|
|
53
|
-
signMessage
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
exports.useGenericSignMessage = useGenericSignMessage;
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@reown/appkit/react"),m=require("wagmi"),p=require("./useAccount.js"),w=()=>{const{caipNetwork:e}=a.useAppKitNetworkCore(),{address:c,isConnected:u}=p.useAccount(),{signMessageAsync:d}=m.useSignMessage(),{walletProvider:l}=a.useAppKitProvider("solana"),{walletProvider:g}=a.useAppKitProvider("bip122"),{walletProvider:o}=a.useAppKitProvider("sui");return{signMessage:async r=>{if(!u||!(e!=null&&e.chainNamespace))throw new Error("Wallet not connected or chain namespace unavailable");switch(e==null?void 0:e.chainNamespace){case"eip155":return await d({message:r});case"solana":{const t=Buffer.from(r),s=await l.signMessage(t);return Buffer.from(s).toString("hex")}case"bip122":return await g.signMessage({address:c??"",message:r});case"sui":{if(!o)throw new Error("Sui wallet not connected");const t=new TextEncoder().encode(r),s={message:Buffer.from(t).toString("base64")},i=32*1024;if(!s.message||typeof s.message!="string")throw new Error("Invalid Sui message: payload must be a non-empty string");try{if(atob(s.message).length>i)throw new Error(`Sui message payload exceeds maximum size of ${i} bytes`)}catch(n){throw n instanceof Error&&n.message.includes("maximum size")?n:new Error("Invalid Sui message: payload is not valid base64")}return(await o.request({method:"sui_signPersonalMessage",params:s})).signature}default:throw new Error(`Unsupported chain namespace: ${e.chainNamespace}`)}}}};exports.useGenericSignMessage=w;
|
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import { useAppKitNetworkCore, useAppKitProvider } from "@reown/appkit/react";
|
|
2
|
-
import { useSignMessage } from "wagmi";
|
|
3
|
-
import { useAccount } from "./useAccount.mjs";
|
|
4
|
-
const
|
|
5
|
-
const { caipNetwork } =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
case "eip155": {
|
|
17
|
-
return await signMessageAsync({ message });
|
|
18
|
-
}
|
|
19
|
-
case "solana": {
|
|
20
|
-
const encodedMessage = Buffer.from(message);
|
|
21
|
-
const signature = await solWalletProvider.signMessage(encodedMessage);
|
|
22
|
-
return Buffer.from(signature).toString("hex");
|
|
23
|
-
}
|
|
24
|
-
case "bip122": {
|
|
25
|
-
return await btcWalletProvider.signMessage({
|
|
26
|
-
address: address ?? "",
|
|
27
|
-
message
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
case "sui": {
|
|
31
|
-
if (!suiWalletProvider) {
|
|
32
|
-
throw new Error("Sui wallet not connected");
|
|
1
|
+
import { useAppKitNetworkCore as m, useAppKitProvider as t } from "@reown/appkit/react";
|
|
2
|
+
import { useSignMessage as f } from "wagmi";
|
|
3
|
+
import { useAccount as p } from "./useAccount.mjs";
|
|
4
|
+
const E = () => {
|
|
5
|
+
const { caipNetwork: e } = m(), { address: c, isConnected: d } = p(), { signMessageAsync: u } = f(), { walletProvider: l } = t("solana"), { walletProvider: g } = t("bip122"), { walletProvider: o } = t("sui");
|
|
6
|
+
return {
|
|
7
|
+
signMessage: async (r) => {
|
|
8
|
+
if (!d || !(e != null && e.chainNamespace))
|
|
9
|
+
throw new Error("Wallet not connected or chain namespace unavailable");
|
|
10
|
+
switch (e == null ? void 0 : e.chainNamespace) {
|
|
11
|
+
case "eip155":
|
|
12
|
+
return await u({ message: r });
|
|
13
|
+
case "solana": {
|
|
14
|
+
const n = Buffer.from(r), s = await l.signMessage(n);
|
|
15
|
+
return Buffer.from(s).toString("hex");
|
|
33
16
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
17
|
+
case "bip122":
|
|
18
|
+
return await g.signMessage({
|
|
19
|
+
address: c ?? "",
|
|
20
|
+
message: r
|
|
21
|
+
});
|
|
22
|
+
case "sui": {
|
|
23
|
+
if (!o)
|
|
24
|
+
throw new Error("Sui wallet not connected");
|
|
25
|
+
const n = new TextEncoder().encode(r), s = {
|
|
26
|
+
message: Buffer.from(n).toString("base64")
|
|
27
|
+
}, i = 32 * 1024;
|
|
28
|
+
if (!s.message || typeof s.message != "string")
|
|
29
|
+
throw new Error(
|
|
30
|
+
"Invalid Sui message: payload must be a non-empty string"
|
|
31
|
+
);
|
|
32
|
+
try {
|
|
33
|
+
if (atob(s.message).length > i)
|
|
34
|
+
throw new Error(
|
|
35
|
+
`Sui message payload exceeds maximum size of ${i} bytes`
|
|
36
|
+
);
|
|
37
|
+
} catch (a) {
|
|
38
|
+
throw a instanceof Error && a.message.includes("maximum size") ? a : new Error("Invalid Sui message: payload is not valid base64");
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
return (await o.request({
|
|
41
|
+
method: "sui_signPersonalMessage",
|
|
42
|
+
params: s
|
|
43
|
+
})).signature;
|
|
44
|
+
}
|
|
45
|
+
default:
|
|
46
|
+
throw new Error(
|
|
47
|
+
`Unsupported chain namespace: ${e.chainNamespace}`
|
|
48
|
+
);
|
|
42
49
|
}
|
|
43
|
-
default:
|
|
44
|
-
throw new Error(
|
|
45
|
-
`Unsupported chain namespace: ${caipNetwork.chainNamespace}`
|
|
46
|
-
);
|
|
47
50
|
}
|
|
48
51
|
};
|
|
49
|
-
return {
|
|
50
|
-
signMessage
|
|
51
|
-
};
|
|
52
52
|
};
|
|
53
53
|
export {
|
|
54
|
-
useGenericSignMessage
|
|
54
|
+
E as useGenericSignMessage
|
|
55
55
|
};
|
|
@@ -1,12 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const react = require("@reown/appkit/react");
|
|
5
|
-
const React = require("react");
|
|
6
|
-
const reactjs_context_useWeb3App = require("../context/useWeb3App.js");
|
|
7
|
-
const useGetChainId = () => {
|
|
8
|
-
const { chainId } = react.useAppKitNetwork();
|
|
9
|
-
const { appKit } = reactjs_context_useWeb3App.useWeb3App();
|
|
10
|
-
return React.useMemo(() => chainId ?? appKit.getChainId(), [chainId, appKit]);
|
|
11
|
-
};
|
|
12
|
-
exports.useGetChainId = useGetChainId;
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("@reown/appkit/react"),r=require("react"),s=require("../context/useWeb3App.js"),o=()=>{const{chainId:e}=n.useAppKitNetwork(),{appKit:t}=s.useWeb3App();return r.useMemo(()=>e??t.getChainId(),[e,t])};exports.useGetChainId=o;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { useAppKitNetwork } from "@reown/appkit/react";
|
|
2
|
-
import { useMemo } from "react";
|
|
3
|
-
import { useWeb3App } from "../context/useWeb3App.mjs";
|
|
4
|
-
const
|
|
5
|
-
const { chainId } =
|
|
6
|
-
|
|
7
|
-
return useMemo(() => chainId ?? appKit.getChainId(), [chainId, appKit]);
|
|
1
|
+
import { useAppKitNetwork as e } from "@reown/appkit/react";
|
|
2
|
+
import { useMemo as p } from "react";
|
|
3
|
+
import { useWeb3App as r } from "../context/useWeb3App.mjs";
|
|
4
|
+
const s = () => {
|
|
5
|
+
const { chainId: t } = e(), { appKit: o } = r();
|
|
6
|
+
return p(() => t ?? o.getChainId(), [t, o]);
|
|
8
7
|
};
|
|
9
8
|
export {
|
|
10
|
-
useGetChainId
|
|
9
|
+
s as useGetChainId
|
|
11
10
|
};
|
|
@@ -1,21 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const React = require("react");
|
|
5
|
-
require("../constants/index.js");
|
|
6
|
-
const reactjs_queries_useGetChains_query = require("../queries/useGetChains.query.js");
|
|
7
|
-
const reactjs_constants_chains = require("../constants/chains.js");
|
|
8
|
-
const useResolveTokenChain = ({ token }) => {
|
|
9
|
-
const { data: chains, isLoading } = reactjs_queries_useGetChains_query.useGetChainsQuery();
|
|
10
|
-
const tokenChain = React.useMemo(() => {
|
|
11
|
-
return chains == null ? void 0 : chains.find(
|
|
12
|
-
(chain) => chain.chainId.toString() === (token == null ? void 0 : token.chainId.toString())
|
|
13
|
-
);
|
|
14
|
-
}, [chains, token]);
|
|
15
|
-
return {
|
|
16
|
-
tokenChain,
|
|
17
|
-
isLoading,
|
|
18
|
-
chainIcon: tokenChain ? tokenChain.pngUrl ?? reactjs_constants_chains.chainIdentifier[tokenChain.chainName] : null
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
exports.useResolveTokenChain = useResolveTokenChain;
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react");require("../constants/index.js");const a=require("../queries/useGetChains.query.js"),u=require("../constants/chains.js"),c=({token:e})=>{const{data:n,isLoading:r}=a.useGetChainsQuery(),i=t.useMemo(()=>n==null?void 0:n.find(s=>s.chainId.toString()===(e==null?void 0:e.chainId.toString())),[n,e]);return{tokenChain:i,isLoading:r,chainIcon:i?i.pngUrl??u.chainIdentifier[i.chainName]:null}};exports.useResolveTokenChain=c;
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
import { useMemo } from "react";
|
|
1
|
+
import { useMemo as a } from "react";
|
|
2
2
|
import "../constants/index.mjs";
|
|
3
|
-
import { useGetChainsQuery } from "../queries/useGetChains.query.mjs";
|
|
4
|
-
import { chainIdentifier } from "../constants/chains.mjs";
|
|
5
|
-
const
|
|
6
|
-
const { data:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
(chain) => chain.chainId.toString() === (token == null ? void 0 : token.chainId.toString())
|
|
10
|
-
);
|
|
11
|
-
}, [chains, token]);
|
|
3
|
+
import { useGetChainsQuery as e } from "../queries/useGetChains.query.mjs";
|
|
4
|
+
import { chainIdentifier as m } from "../constants/chains.mjs";
|
|
5
|
+
const d = ({ token: i }) => {
|
|
6
|
+
const { data: n, isLoading: o } = e(), r = a(() => n == null ? void 0 : n.find(
|
|
7
|
+
(t) => t.chainId.toString() === (i == null ? void 0 : i.chainId.toString())
|
|
8
|
+
), [n, i]);
|
|
12
9
|
return {
|
|
13
|
-
tokenChain,
|
|
14
|
-
isLoading,
|
|
15
|
-
chainIcon:
|
|
10
|
+
tokenChain: r,
|
|
11
|
+
isLoading: o,
|
|
12
|
+
chainIcon: r ? r.pngUrl ?? m[r.chainName] : null
|
|
16
13
|
};
|
|
17
14
|
};
|
|
18
15
|
export {
|
|
19
|
-
useResolveTokenChain
|
|
16
|
+
d as useResolveTokenChain
|
|
20
17
|
};
|
|
@@ -1,26 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const React = require("react");
|
|
5
|
-
const api_sendTransactions = require("../../api/sendTransactions.js");
|
|
6
|
-
const useSendTransactions = () => {
|
|
7
|
-
return React.useCallback(
|
|
8
|
-
async ({
|
|
9
|
-
transactions,
|
|
10
|
-
provider,
|
|
11
|
-
url,
|
|
12
|
-
token,
|
|
13
|
-
axiosConfig
|
|
14
|
-
}) => {
|
|
15
|
-
return await api_sendTransactions.sendTransactions({
|
|
16
|
-
transactions,
|
|
17
|
-
provider,
|
|
18
|
-
url,
|
|
19
|
-
token,
|
|
20
|
-
axiosConfig
|
|
21
|
-
});
|
|
22
|
-
},
|
|
23
|
-
[]
|
|
24
|
-
);
|
|
25
|
-
};
|
|
26
|
-
exports.useSendTransactions = useSendTransactions;
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),c=require("../../api/sendTransactions.js"),i=()=>t.useCallback(async({transactions:e,provider:n,url:s,token:a,axiosConfig:r})=>await c.sendTransactions({transactions:e,provider:n,url:s,token:a,axiosConfig:r}),[]);exports.useSendTransactions=i;
|
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
import { useCallback } from "react";
|
|
2
|
-
import { sendTransactions } from "../../api/sendTransactions.mjs";
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
},
|
|
20
|
-
[]
|
|
21
|
-
);
|
|
22
|
-
};
|
|
1
|
+
import { useCallback as o } from "react";
|
|
2
|
+
import { sendTransactions as e } from "../../api/sendTransactions.mjs";
|
|
3
|
+
const m = () => o(
|
|
4
|
+
async ({
|
|
5
|
+
transactions: r,
|
|
6
|
+
provider: n,
|
|
7
|
+
url: a,
|
|
8
|
+
token: s,
|
|
9
|
+
axiosConfig: t
|
|
10
|
+
}) => await e({
|
|
11
|
+
transactions: r,
|
|
12
|
+
provider: n,
|
|
13
|
+
url: a,
|
|
14
|
+
token: s,
|
|
15
|
+
axiosConfig: t
|
|
16
|
+
}),
|
|
17
|
+
[]
|
|
18
|
+
);
|
|
23
19
|
export {
|
|
24
|
-
useSendTransactions
|
|
20
|
+
m as useSendTransactions
|
|
25
21
|
};
|
|
@@ -1,87 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const react$1 = require("@reown/appkit/react");
|
|
5
|
-
const react = require("@reown/appkit-adapter-solana/react");
|
|
6
|
-
const web3_js = require("@solana/web3.js");
|
|
7
|
-
const wagmi = require("wagmi");
|
|
8
|
-
const useSignTransaction = () => {
|
|
9
|
-
const {
|
|
10
|
-
data: hash,
|
|
11
|
-
sendTransactionAsync: signEvmTransaction,
|
|
12
|
-
...rest
|
|
13
|
-
} = wagmi.useSendTransaction();
|
|
14
|
-
const { connection } = react.useAppKitConnection();
|
|
15
|
-
const { walletProvider: solWalletProvider } = react$1.useAppKitProvider("solana");
|
|
16
|
-
const { walletProvider: btcWalletProvider } = react$1.useAppKitProvider("bip122");
|
|
17
|
-
const { walletProvider: suiWalletProvider } = react$1.useAppKitProvider("sui");
|
|
18
|
-
const signTransactionSolanaTransaction = async ({
|
|
19
|
-
feePayer,
|
|
20
|
-
instructions,
|
|
21
|
-
recentBlockhash
|
|
22
|
-
}) => {
|
|
23
|
-
for (const instruction of instructions) {
|
|
24
|
-
const transactionInstruction = new web3_js.TransactionInstruction({
|
|
25
|
-
...instruction
|
|
26
|
-
});
|
|
27
|
-
const transaction = new web3_js.Transaction().add(transactionInstruction);
|
|
28
|
-
transaction.feePayer = new web3_js.PublicKey(feePayer);
|
|
29
|
-
if (connection) {
|
|
30
|
-
transaction.recentBlockhash = recentBlockhash ?? (await connection.getLatestBlockhash("confirmed")).blockhash;
|
|
31
|
-
}
|
|
32
|
-
return await solWalletProvider.signAndSendTransaction(transaction);
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
const signPSBT = async (params) => {
|
|
36
|
-
if (!btcWalletProvider) {
|
|
37
|
-
throw Error("user is disconnected");
|
|
38
|
-
}
|
|
39
|
-
params.signInputs = [];
|
|
40
|
-
const signature = await btcWalletProvider.signPSBT(params);
|
|
41
|
-
return signature.psbt;
|
|
42
|
-
};
|
|
43
|
-
const signSuiTransaction = async (suiParams) => {
|
|
44
|
-
const transaction = (suiParams == null ? void 0 : suiParams.transaction) ?? (suiParams == null ? void 0 : suiParams.transactionBlock);
|
|
45
|
-
if (!transaction) {
|
|
46
|
-
throw new Error("No Sui transaction bytes provided");
|
|
47
|
-
}
|
|
48
|
-
if (!(suiParams == null ? void 0 : suiParams.address)) {
|
|
49
|
-
throw new Error("No Sui sender address");
|
|
50
|
-
}
|
|
51
|
-
if (!suiWalletProvider) {
|
|
52
|
-
throw new Error("Sui wallet not connected");
|
|
53
|
-
}
|
|
54
|
-
const result = await suiWalletProvider.request({
|
|
55
|
-
method: "sui_signTransaction",
|
|
56
|
-
params: {
|
|
57
|
-
transaction,
|
|
58
|
-
address: suiParams.address
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
if (!result) {
|
|
62
|
-
throw new Error("Sui wallet did not return a signature");
|
|
63
|
-
}
|
|
64
|
-
return result.signature;
|
|
65
|
-
};
|
|
66
|
-
return {
|
|
67
|
-
evm: {
|
|
68
|
-
hash,
|
|
69
|
-
signTransaction: signEvmTransaction,
|
|
70
|
-
...rest
|
|
71
|
-
},
|
|
72
|
-
solana: {
|
|
73
|
-
signTransaction: signTransactionSolanaTransaction,
|
|
74
|
-
connection,
|
|
75
|
-
walletProvider: solWalletProvider
|
|
76
|
-
},
|
|
77
|
-
bitcoin: {
|
|
78
|
-
signTransaction: signPSBT,
|
|
79
|
-
walletProvider: btcWalletProvider
|
|
80
|
-
},
|
|
81
|
-
sui: {
|
|
82
|
-
signTransaction: signSuiTransaction,
|
|
83
|
-
walletProvider: suiWalletProvider
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
};
|
|
87
|
-
exports.useSignTransaction = useSignTransaction;
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("@reown/appkit/react"),f=require("@reown/appkit-adapter-solana/react"),w=require("@solana/web3.js"),y=require("wagmi"),b=()=>{const{data:g,sendTransactionAsync:h,...p}=y.useSendTransaction(),{connection:s}=f.useAppKitConnection(),{walletProvider:u}=i.useAppKitProvider("solana"),{walletProvider:a}=i.useAppKitProvider("bip122"),{walletProvider:c}=i.useAppKitProvider("sui"),{address:d}=i.useAppKitAccount({namespace:"sui"}),v=async({feePayer:n,instructions:t,recentBlockhash:r})=>{for(const o of t){const e=new w.TransactionInstruction({...o}),l=new w.Transaction().add(e);return l.feePayer=new w.PublicKey(n),s&&(l.recentBlockhash=r??(await s.getLatestBlockhash("confirmed")).blockhash),await u.signAndSendTransaction(l)}},S=async n=>{if(!a)throw Error("user is disconnected");return(await a.signPSBT(n)).psbt},T=async n=>{const t=(n==null?void 0:n.transaction)??(n==null?void 0:n.transactionBlock);if(!t)throw new Error("No Sui transaction bytes provided");if(!(n!=null&&n.address))throw new Error("No Sui sender address");if(!c)throw new Error("Sui wallet not connected");const r=32*1024;if(!t||typeof t!="string")throw new Error("Invalid Sui transaction: payload must be a non-empty string");try{if(atob(t).length>r)throw new Error(`Sui transaction payload exceeds maximum size of ${r} bytes`)}catch(e){throw e instanceof Error&&e.message.includes("maximum size")?e:new Error("Invalid Sui transaction: payload is not valid base64")}if(n.address&&d&&n.address!==d)throw new Error(`Sui address mismatch: expected ${d}, got ${n.address}`);const o=await c.request({method:"sui_signTransaction",params:{transaction:t,address:n.address}});if(!o)throw new Error("Sui wallet did not return a signature");return o.signature};return{evm:{hash:g,signTransaction:h,...p},solana:{signTransaction:v,connection:s,walletProvider:u},bitcoin:{signTransaction:S,walletProvider:a},sui:{signTransaction:T,walletProvider:c}}};exports.useSignTransaction=b;
|