@unisat/wallet-state 1.0.5 → 1.2.0
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/LICENSE +0 -5
- package/lib/actions/global.d.ts +2 -0
- package/lib/actions/global.d.ts.map +1 -0
- package/lib/context/ApprovalContext.d.ts +9 -0
- package/lib/context/ApprovalContext.d.ts.map +1 -0
- package/lib/context/DeviceContext.d.ts +17 -0
- package/lib/context/DeviceContext.d.ts.map +1 -0
- package/lib/context/I18nContext.d.ts +13 -0
- package/lib/context/I18nContext.d.ts.map +1 -0
- package/lib/context/NavigationContext.d.ts +218 -0
- package/lib/context/NavigationContext.d.ts.map +1 -0
- package/lib/context/PriceContext.d.ts +13 -0
- package/lib/context/PriceContext.d.ts.map +1 -0
- package/lib/context/StorageContext.d.ts +60 -0
- package/lib/context/StorageContext.d.ts.map +1 -0
- package/lib/context/ToolsContext.d.ts +17 -0
- package/lib/context/ToolsContext.d.ts.map +1 -0
- package/lib/context/WalletContext.d.ts +493 -0
- package/lib/context/WalletContext.d.ts.map +1 -0
- package/lib/context/index.d.ts +9 -0
- package/lib/context/index.d.ts.map +1 -0
- package/lib/hooks/accounts.d.ts +34 -0
- package/lib/hooks/accounts.d.ts.map +1 -0
- package/lib/hooks/base.d.ts +14 -0
- package/lib/hooks/base.d.ts.map +1 -0
- package/lib/hooks/browser.d.ts +32 -0
- package/lib/hooks/browser.d.ts.map +1 -0
- package/lib/hooks/discovery.d.ts +17 -0
- package/lib/hooks/discovery.d.ts.map +1 -0
- package/lib/hooks/global.d.ts +43 -0
- package/lib/hooks/global.d.ts.map +1 -0
- package/lib/hooks/index.d.ts +10 -0
- package/lib/hooks/index.d.ts.map +1 -0
- package/lib/hooks/keyrings.d.ts +5 -0
- package/lib/hooks/keyrings.d.ts.map +1 -0
- package/lib/hooks/settings.d.ts +43 -0
- package/lib/hooks/settings.d.ts.map +1 -0
- package/lib/hooks/transactions.d.ts +67 -0
- package/lib/hooks/transactions.d.ts.map +1 -0
- package/lib/hooks/ui.d.ts +112 -0
- package/lib/hooks/ui.d.ts.map +1 -0
- package/lib/index.d.mts +2072 -199
- package/lib/index.d.ts +31 -946
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +7176 -582
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +6971 -525
- package/lib/index.mjs.map +1 -1
- package/lib/reducers/accounts.d.ts +49 -0
- package/lib/reducers/accounts.d.ts.map +1 -0
- package/lib/reducers/browser.d.ts +49 -0
- package/lib/reducers/browser.d.ts.map +1 -0
- package/lib/reducers/discovery.d.ts +22 -0
- package/lib/reducers/discovery.d.ts.map +1 -0
- package/lib/reducers/global.d.ts +35 -0
- package/lib/reducers/global.d.ts.map +1 -0
- package/lib/reducers/index.d.ts +9 -0
- package/lib/reducers/index.d.ts.map +1 -0
- package/lib/reducers/keyrings.d.ts +10 -0
- package/lib/reducers/keyrings.d.ts.map +1 -0
- package/lib/reducers/settings.d.ts +16 -0
- package/lib/reducers/settings.d.ts.map +1 -0
- package/lib/reducers/transactions.d.ts +61 -0
- package/lib/reducers/transactions.d.ts.map +1 -0
- package/lib/reducers/ui.d.ts +55 -0
- package/lib/reducers/ui.d.ts.map +1 -0
- package/lib/types/index.d.mts +7 -3
- package/lib/types/index.d.ts +3 -30
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js +7 -1
- package/lib/types/index.js.map +1 -1
- package/lib/types/index.mjs +7 -2
- package/lib/types/index.mjs.map +1 -1
- package/lib/types/ui.d.ts +31 -0
- package/lib/types/ui.d.ts.map +1 -0
- package/lib/ui-hooks/index.d.ts +55 -0
- package/lib/ui-hooks/index.d.ts.map +1 -0
- package/lib/ui-hooks/useActionOverviewSectionLogic.d.ts +12 -0
- package/lib/ui-hooks/useActionOverviewSectionLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useAddressTypeScreenLogic.d.ts +19 -0
- package/lib/ui-hooks/useAddressTypeScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useAlkanesBalanceCardLogic.d.ts +19 -0
- package/lib/ui-hooks/useAlkanesBalanceCardLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useAlkanesCollectionListLogic.d.ts +11 -0
- package/lib/ui-hooks/useAlkanesCollectionListLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useAlkanesListLogic.d.ts +14 -0
- package/lib/ui-hooks/useAlkanesListLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useAlkanesNFTListLogic.d.ts +11 -0
- package/lib/ui-hooks/useAlkanesNFTListLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useAlkanesNFTScreenLogic.d.ts +9 -0
- package/lib/ui-hooks/useAlkanesNFTScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useAlkanesTokenScreenLogic.d.ts +22 -0
- package/lib/ui-hooks/useAlkanesTokenScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useAmountInputLogic.d.ts +22 -0
- package/lib/ui-hooks/useAmountInputLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useAnnouncementCardLogic.d.ts +11 -0
- package/lib/ui-hooks/useAnnouncementCardLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useBRC20BalanceCardLogic.d.ts +26 -0
- package/lib/ui-hooks/useBRC20BalanceCardLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useBRC20InscribeTransferLogic.d.ts +103 -0
- package/lib/ui-hooks/useBRC20InscribeTransferLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useBRC20ListLogic.d.ts +14 -0
- package/lib/ui-hooks/useBRC20ListLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useBRC20ProgListLogic.d.ts +14 -0
- package/lib/ui-hooks/useBRC20ProgListLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useBRC20SendScreenLogic.d.ts +67 -0
- package/lib/ui-hooks/useBRC20SendScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useBRC20SingleStepScreenLogic.d.ts +36 -0
- package/lib/ui-hooks/useBRC20SingleStepScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useBRC20TokenScreenLogic.d.ts +75 -0
- package/lib/ui-hooks/useBRC20TokenScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useBalanceCardLogic.d.ts +26 -0
- package/lib/ui-hooks/useBalanceCardLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useBtcDisplayLogic.d.ts +5 -0
- package/lib/ui-hooks/useBtcDisplayLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useCAT20BalanceCardLogic.d.ts +20 -0
- package/lib/ui-hooks/useCAT20BalanceCardLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useCAT20ListLogic.d.ts +14 -0
- package/lib/ui-hooks/useCAT20ListLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useCAT20TokenScreenLogic.d.ts +19 -0
- package/lib/ui-hooks/useCAT20TokenScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useCAT721ListLogic.d.ts +11 -0
- package/lib/ui-hooks/useCAT721ListLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useCAT721NFTScreenLogic.d.ts +9 -0
- package/lib/ui-hooks/useCAT721NFTScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useCreatePasswordScreenLogic.d.ts +27 -0
- package/lib/ui-hooks/useCreatePasswordScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useCreateWalletLogicImportWordsStep.d.ts +78 -0
- package/lib/ui-hooks/useCreateWalletLogicImportWordsStep.d.ts.map +1 -0
- package/lib/ui-hooks/useEditAccountNameScreenLogic.d.ts +18 -0
- package/lib/ui-hooks/useEditAccountNameScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useEditContactScreenLogic.d.ts +24 -0
- package/lib/ui-hooks/useEditContactScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useEditWalletNameScreenLogic.d.ts +15 -0
- package/lib/ui-hooks/useEditWalletNameScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useExportMnemonicsScreenLogic.d.ts +18 -0
- package/lib/ui-hooks/useExportMnemonicsScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useExportPrivateKeyScreenLogic.d.ts +17 -0
- package/lib/ui-hooks/useExportPrivateKeyScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useFeeRateBarLogic.d.ts +34 -0
- package/lib/ui-hooks/useFeeRateBarLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useInfiniteList.d.ts +19 -0
- package/lib/ui-hooks/useInfiniteList.d.ts.map +1 -0
- package/lib/ui-hooks/useInscriptionListLogic.d.ts +11 -0
- package/lib/ui-hooks/useInscriptionListLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useLockTimePageLogic.d.ts +11 -0
- package/lib/ui-hooks/useLockTimePageLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useNotificationsLogic.d.ts +14 -0
- package/lib/ui-hooks/useNotificationsLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useOrdinalsInscriptionScreenLogic.d.ts +27 -0
- package/lib/ui-hooks/useOrdinalsInscriptionScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useRunesBalanceCardLogic.d.ts +19 -0
- package/lib/ui-hooks/useRunesBalanceCardLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useRunesListLogic.d.ts +14 -0
- package/lib/ui-hooks/useRunesListLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useRunesTokenScreenLogic.d.ts +22 -0
- package/lib/ui-hooks/useRunesTokenScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useSecurityCardLogic.d.ts +1 -0
- package/lib/ui-hooks/useSecurityCardLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useSendAlkanesNFTScreenLogic.d.ts +32 -0
- package/lib/ui-hooks/useSendAlkanesNFTScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useSendAlkanesScreenLogic.d.ts +37 -0
- package/lib/ui-hooks/useSendAlkanesScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useSendCAT20ScreenLogic.d.ts +44 -0
- package/lib/ui-hooks/useSendCAT20ScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useSendCAT721ScreenLogic.d.ts +40 -0
- package/lib/ui-hooks/useSendCAT721ScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useSendOrdinalsInscriptionScreenLogic.d.ts +22 -0
- package/lib/ui-hooks/useSendOrdinalsInscriptionScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useSendRunesScreenLogic.d.ts +30 -0
- package/lib/ui-hooks/useSendRunesScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useSettingsTabScreenLogic.d.ts +72 -0
- package/lib/ui-hooks/useSettingsTabScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useSignMessageLogic.d.ts +54 -0
- package/lib/ui-hooks/useSignMessageLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useSignPsbtLogic.d.ts +82 -0
- package/lib/ui-hooks/useSignPsbtLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useSplitOrdinalsInscriptionScreenLogic.d.ts +15 -0
- package/lib/ui-hooks/useSplitOrdinalsInscriptionScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useTxConfirmScreenLogic.d.ts +8 -0
- package/lib/ui-hooks/useTxConfirmScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useTxCreateScreenLogic.d.ts +28 -0
- package/lib/ui-hooks/useTxCreateScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useTxFailScreenLogic.d.ts +7 -0
- package/lib/ui-hooks/useTxFailScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useTxSuccessScreenLogic.d.ts +8 -0
- package/lib/ui-hooks/useTxSuccessScreenLogic.d.ts.map +1 -0
- package/lib/updater/accounts.d.ts +2 -0
- package/lib/updater/accounts.d.ts.map +1 -0
- package/lib/updater/index.d.ts +2 -0
- package/lib/updater/index.d.ts.map +1 -0
- package/lib/utils/bitcoin-utils.d.ts +7 -0
- package/lib/utils/bitcoin-utils.d.ts.map +1 -0
- package/lib/utils/eventBus.d.ts +12 -0
- package/lib/utils/eventBus.d.ts.map +1 -0
- package/lib/utils/password-utils.d.ts +12 -0
- package/lib/utils/password-utils.d.ts.map +1 -0
- package/lib/utils/ui-utils.d.ts +4 -0
- package/lib/utils/ui-utils.d.ts.map +1 -0
- package/package.json +19 -15
- package/src/.DS_Store +0 -0
- package/src/context/ApprovalContext.tsx +27 -0
- package/src/context/DeviceContext.tsx +36 -0
- package/src/context/I18nContext.tsx +14 -172
- package/src/context/NavigationContext.tsx +305 -0
- package/src/context/PriceContext.tsx +2 -2
- package/src/context/StorageContext.tsx +393 -0
- package/src/context/ToolsContext.tsx +50 -0
- package/src/context/WalletContext.tsx +170 -126
- package/src/context/index.ts +17 -2
- package/src/hooks/accounts.ts +11 -5
- package/src/hooks/browser.ts +11 -0
- package/src/hooks/global.ts +170 -7
- package/src/hooks/index.ts +1 -2
- package/src/hooks/settings.ts +38 -37
- package/src/hooks/transactions.ts +45 -151
- package/src/hooks/ui.ts +239 -35
- package/src/index.ts +33 -24
- package/src/reducers/accounts.ts +22 -2
- package/src/reducers/browser.ts +223 -0
- package/src/reducers/global.ts +67 -1
- package/src/reducers/index.ts +1 -0
- package/src/reducers/transactions.ts +0 -9
- package/src/reducers/ui.ts +144 -4
- package/src/types/index.ts +1 -1
- package/src/types/ui.ts +6 -1
- package/src/ui-hooks/index.ts +107 -0
- package/src/ui-hooks/useActionOverviewSectionLogic.ts +150 -0
- package/src/ui-hooks/useAddressTypeScreenLogic.ts +160 -0
- package/src/ui-hooks/useAlkanesBalanceCardLogic.ts +41 -0
- package/src/ui-hooks/useAlkanesCollectionListLogic.ts +68 -0
- package/src/ui-hooks/useAlkanesListLogic.ts +69 -0
- package/src/ui-hooks/useAlkanesNFTListLogic.ts +42 -0
- package/src/ui-hooks/useAlkanesNFTScreenLogic.ts +45 -0
- package/src/ui-hooks/useAlkanesTokenScreenLogic.ts +138 -0
- package/src/ui-hooks/useAmountInputLogic.ts +80 -0
- package/src/ui-hooks/useAnnouncementCardLogic.ts +91 -0
- package/src/ui-hooks/useBRC20BalanceCardLogic.ts +115 -0
- package/src/ui-hooks/useBRC20InscribeTransferLogic.ts +418 -0
- package/src/ui-hooks/useBRC20ListLogic.ts +79 -0
- package/src/ui-hooks/useBRC20ProgListLogic.ts +81 -0
- package/src/ui-hooks/useBRC20SendScreenLogic.ts +424 -0
- package/src/ui-hooks/useBRC20SingleStepScreenLogic.ts +208 -0
- package/src/ui-hooks/useBRC20TokenScreenLogic.ts +489 -0
- package/src/ui-hooks/useBalanceCardLogic.ts +164 -0
- package/src/ui-hooks/useBtcDisplayLogic.ts +16 -0
- package/src/ui-hooks/useCAT20BalanceCardLogic.ts +35 -0
- package/src/ui-hooks/useCAT20ListLogic.ts +83 -0
- package/src/ui-hooks/useCAT20TokenScreenLogic.ts +127 -0
- package/src/ui-hooks/useCAT721ListLogic.ts +68 -0
- package/src/ui-hooks/useCAT721NFTScreenLogic.ts +37 -0
- package/src/ui-hooks/useCreatePasswordScreenLogic.ts +92 -0
- package/src/ui-hooks/useCreateWalletLogicImportWordsStep.ts +299 -0
- package/src/ui-hooks/useEditAccountNameScreenLogic.ts +71 -0
- package/src/ui-hooks/useEditContactScreenLogic.ts +162 -0
- package/src/ui-hooks/useEditWalletNameScreenLogic.ts +60 -0
- package/src/ui-hooks/useExportMnemonicsScreenLogic.ts +75 -0
- package/src/ui-hooks/useExportPrivateKeyScreenLogic.ts +64 -0
- package/src/ui-hooks/useFeeRateBarLogic.ts +303 -0
- package/src/ui-hooks/useInfiniteList.ts +85 -0
- package/src/ui-hooks/useInscriptionListLogic.ts +68 -0
- package/src/ui-hooks/useLockTimePageLogic.ts +43 -0
- package/src/ui-hooks/useNotificationsLogic.ts +115 -0
- package/src/ui-hooks/useOrdinalsInscriptionScreenLogic.ts +130 -0
- package/src/ui-hooks/useRunesBalanceCardLogic.ts +44 -0
- package/src/ui-hooks/useRunesListLogic.ts +74 -0
- package/src/ui-hooks/useRunesTokenScreenLogic.ts +156 -0
- package/src/ui-hooks/useSecurityCardLogic.ts +0 -0
- package/src/ui-hooks/useSendAlkanesNFTScreenLogic.ts +160 -0
- package/src/ui-hooks/useSendAlkanesScreenLogic.ts +208 -0
- package/src/ui-hooks/useSendCAT20ScreenLogic.ts +297 -0
- package/src/ui-hooks/useSendCAT721ScreenLogic.ts +205 -0
- package/src/ui-hooks/useSendOrdinalsInscriptionScreenLogic.ts +152 -0
- package/src/ui-hooks/useSendRunesScreenLogic.ts +189 -0
- package/src/ui-hooks/useSettingsTabScreenLogic.ts +211 -0
- package/src/ui-hooks/useSignMessageLogic.ts +302 -0
- package/src/ui-hooks/useSignPsbtLogic.ts +517 -0
- package/src/ui-hooks/useSplitOrdinalsInscriptionScreenLogic.ts +109 -0
- package/src/ui-hooks/useTxConfirmScreenLogic.ts +47 -0
- package/src/ui-hooks/useTxCreateScreenLogic.ts +177 -0
- package/src/ui-hooks/useTxFailScreenLogic.ts +26 -0
- package/src/ui-hooks/useTxSuccessScreenLogic.ts +33 -0
- package/src/updater/accounts.ts +11 -11
- package/src/utils/bitcoin-utils.ts +17 -8
- package/src/utils/eventBus.ts +2 -1
- package/src/utils/password-utils.ts +78 -0
- package/src/utils/ui-utils.ts +28 -0
- package/src/hooks/approval.ts +0 -72
- package/src/hooks/i18n.ts +0 -53
- package/src/utils/i18n.ts +0 -41
package/src/hooks/ui.ts
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
import { useMemo } from 'react'
|
|
1
|
+
import { useCallback, useMemo } from 'react'
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { CHAINS_MAP, Inscription } from '@unisat/wallet-shared'
|
|
4
|
+
import { AddressType, ChainType } from '@unisat/wallet-types'
|
|
5
5
|
import { getAddressType } from '../utils/bitcoin-utils'
|
|
6
|
-
import { AddressType } from '@unisat/wallet-types'
|
|
7
6
|
|
|
8
7
|
import { AppState, AssetTabKey } from '..'
|
|
9
|
-
import {
|
|
8
|
+
import { useCurrentAddress } from '../hooks/accounts'
|
|
10
9
|
import { useAppDispatch, useAppSelector } from '../hooks/base'
|
|
11
|
-
import { useChainType,
|
|
10
|
+
import { useChainType, useIconBaseUrl, useUnisatWebsite } from '../hooks/settings'
|
|
12
11
|
import { uiActions } from '../reducers/ui'
|
|
13
|
-
import { TypeChain } from '@unisat/wallet-shared'
|
|
14
|
-
import { useLocation } from 'react-router-dom'
|
|
15
12
|
export function useUIState(): AppState['ui'] {
|
|
16
13
|
return useAppSelector(state => state.ui)
|
|
17
14
|
}
|
|
@@ -36,6 +33,11 @@ export function useAlkanesAssetTabKey() {
|
|
|
36
33
|
return uiState.alkanesAssetTabKey
|
|
37
34
|
}
|
|
38
35
|
|
|
36
|
+
export function useMoreAssetTabKey() {
|
|
37
|
+
const uiState = useUIState()
|
|
38
|
+
return uiState.moreAssetTabKey
|
|
39
|
+
}
|
|
40
|
+
|
|
39
41
|
export function useUiTxCreateScreen() {
|
|
40
42
|
const uiState = useUIState()
|
|
41
43
|
return uiState.uiTxCreateScreen
|
|
@@ -47,14 +49,112 @@ export function useUpdateUiTxCreateScreen() {
|
|
|
47
49
|
toInfo,
|
|
48
50
|
inputAmount,
|
|
49
51
|
enableRBF,
|
|
50
|
-
feeRate,
|
|
51
52
|
}: {
|
|
52
53
|
toInfo?: { address: string; domain: string; inscription?: Inscription }
|
|
53
54
|
inputAmount?: string
|
|
54
55
|
enableRBF?: boolean
|
|
56
|
+
}) => {
|
|
57
|
+
dispatch(
|
|
58
|
+
(uiActions as any).updateTxCreateScreen({
|
|
59
|
+
toInfo,
|
|
60
|
+
inputAmount,
|
|
61
|
+
enableRBF,
|
|
62
|
+
})
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function useFeeRateBar() {
|
|
68
|
+
const uiState = useUIState()
|
|
69
|
+
return uiState.feeRateBar
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function useUpdateFeeRateBar() {
|
|
73
|
+
const dispatch = useAppDispatch()
|
|
74
|
+
return ({
|
|
75
|
+
feeRate,
|
|
76
|
+
feeRateInputVal,
|
|
77
|
+
enableLowFeeRate,
|
|
78
|
+
feeOptionIndex,
|
|
79
|
+
showCustomInput,
|
|
80
|
+
}: {
|
|
55
81
|
feeRate?: number
|
|
82
|
+
feeRateInputVal?: string
|
|
83
|
+
enableLowFeeRate?: boolean
|
|
84
|
+
feeOptionIndex?: number
|
|
85
|
+
showCustomInput?: boolean
|
|
56
86
|
}) => {
|
|
57
|
-
dispatch(
|
|
87
|
+
dispatch(
|
|
88
|
+
(uiActions as any).updateFeeRateBar({
|
|
89
|
+
feeRate,
|
|
90
|
+
feeRateInputVal,
|
|
91
|
+
enableLowFeeRate,
|
|
92
|
+
feeOptionIndex,
|
|
93
|
+
showCustomInput,
|
|
94
|
+
})
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export function useResetFeeRateBar() {
|
|
100
|
+
const dispatch = useAppDispatch()
|
|
101
|
+
return () => {
|
|
102
|
+
dispatch((uiActions as any).resetFeeRateBar())
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export function useAddressInput() {
|
|
107
|
+
const uiState = useUIState()
|
|
108
|
+
return uiState.addressInput
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export function useUpdateAddressInput() {
|
|
112
|
+
const dispatch = useAppDispatch()
|
|
113
|
+
return ({ address, domain }: { address?: string; domain?: string }) => {
|
|
114
|
+
dispatch(
|
|
115
|
+
(uiActions as any).updateAddressInput({
|
|
116
|
+
address,
|
|
117
|
+
domain,
|
|
118
|
+
})
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export function useResetAddressInput() {
|
|
124
|
+
const dispatch = useAppDispatch()
|
|
125
|
+
return () => {
|
|
126
|
+
dispatch((uiActions as any).resetAddressInput())
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export function useAmountInput() {
|
|
131
|
+
const uiState = useUIState()
|
|
132
|
+
return uiState.amountInput
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export function useUpdateAmountInput() {
|
|
136
|
+
const dispatch = useAppDispatch()
|
|
137
|
+
return ({ amount }: { amount?: string }) => {
|
|
138
|
+
dispatch(
|
|
139
|
+
(uiActions as any).updateAmountInput({
|
|
140
|
+
amount,
|
|
141
|
+
})
|
|
142
|
+
)
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export function useResetAmountInput() {
|
|
147
|
+
const dispatch = useAppDispatch()
|
|
148
|
+
return () => {
|
|
149
|
+
dispatch((uiActions as any).resetAmountInput())
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export function useResetTxState() {
|
|
154
|
+
const dispatch = useAppDispatch()
|
|
155
|
+
return () => {
|
|
156
|
+
dispatch((uiActions as any).resetTxCreateScreen())
|
|
157
|
+
dispatch((uiActions as any).resetFeeRateBar())
|
|
58
158
|
}
|
|
59
159
|
}
|
|
60
160
|
|
|
@@ -65,18 +165,32 @@ export function useResetUiTxCreateScreen() {
|
|
|
65
165
|
}
|
|
66
166
|
}
|
|
67
167
|
|
|
68
|
-
export
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
168
|
+
export const useThrottle = (callback, delay, lastCallRef) => {
|
|
169
|
+
return useCallback(
|
|
170
|
+
(...args) => {
|
|
171
|
+
const now = Date.now()
|
|
172
|
+
if (now - lastCallRef.current > delay) {
|
|
173
|
+
lastCallRef.current = now
|
|
174
|
+
callback(...args)
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
[callback, delay, lastCallRef]
|
|
178
|
+
)
|
|
179
|
+
}
|
|
73
180
|
|
|
181
|
+
export function getSupportedAssets(chainType: ChainType, address: string) {
|
|
74
182
|
const assetTabKeys: AssetTabKey[] = []
|
|
183
|
+
|
|
184
|
+
const chain = CHAINS_MAP[chainType]
|
|
185
|
+
const networkType = chain.networkType
|
|
186
|
+
const addressType = getAddressType(address, networkType)
|
|
187
|
+
|
|
75
188
|
const assets = {
|
|
76
189
|
ordinals: false,
|
|
77
190
|
runes: false,
|
|
78
191
|
CAT20: false,
|
|
79
192
|
alkanes: false,
|
|
193
|
+
brc20Prog: false,
|
|
80
194
|
}
|
|
81
195
|
|
|
82
196
|
assets.ordinals = true
|
|
@@ -86,27 +200,35 @@ export function useSupportedAssets() {
|
|
|
86
200
|
assetTabKeys.push(AssetTabKey.RUNES)
|
|
87
201
|
|
|
88
202
|
if (
|
|
89
|
-
chainType === ChainType.FRACTAL_BITCOIN_MAINNET ||
|
|
90
|
-
|
|
203
|
+
(chainType === ChainType.FRACTAL_BITCOIN_MAINNET ||
|
|
204
|
+
chainType === ChainType.FRACTAL_BITCOIN_TESTNET) &&
|
|
205
|
+
(addressType == AddressType.P2TR || addressType == AddressType.P2WPKH)
|
|
91
206
|
) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
assets.CAT20 = true
|
|
95
|
-
assetTabKeys.push(AssetTabKey.CAT)
|
|
96
|
-
}
|
|
207
|
+
assets.CAT20 = true
|
|
208
|
+
assetTabKeys.push(AssetTabKey.CAT)
|
|
97
209
|
}
|
|
98
210
|
|
|
99
|
-
if (chainType === ChainType.
|
|
211
|
+
if (chainType === ChainType.BITCOIN_MAINNET || chainType === ChainType.BITCOIN_SIGNET) {
|
|
100
212
|
assets.alkanes = true
|
|
101
|
-
assetTabKeys.push(AssetTabKey.
|
|
213
|
+
assetTabKeys.push(AssetTabKey.MORE)
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
if (chainType === ChainType.BITCOIN_MAINNET || chainType === ChainType.BITCOIN_SIGNET) {
|
|
217
|
+
assets.brc20Prog = true
|
|
102
218
|
}
|
|
103
219
|
|
|
104
220
|
return {
|
|
105
|
-
tabKeys: assetTabKeys,
|
|
106
221
|
assets,
|
|
107
|
-
|
|
222
|
+
tabKeys: assetTabKeys,
|
|
223
|
+
key: chainType + address + assetTabKeys.join(','),
|
|
108
224
|
}
|
|
109
225
|
}
|
|
226
|
+
export function useSupportedAssets() {
|
|
227
|
+
const chainType = useChainType()
|
|
228
|
+
const currentAddress = useCurrentAddress()
|
|
229
|
+
const supportedAssets = getSupportedAssets(chainType, currentAddress)
|
|
230
|
+
return supportedAssets
|
|
231
|
+
}
|
|
110
232
|
|
|
111
233
|
export const useIsInExpandView = () => {
|
|
112
234
|
// @ts-ignore
|
|
@@ -124,18 +246,100 @@ export const useIsInExpandView = () => {
|
|
|
124
246
|
}, [window.innerWidth])
|
|
125
247
|
}
|
|
126
248
|
|
|
127
|
-
export
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
249
|
+
export function useWalletTopTabScreenState() {
|
|
250
|
+
const uiState = useUIState()
|
|
251
|
+
return uiState.walletTopTabScreen
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export function useBRC20IconInfo(ticker: string) {
|
|
255
|
+
const baseUrl = useIconBaseUrl()
|
|
256
|
+
const iconUrl = `${baseUrl}/brc20/${ticker}`
|
|
257
|
+
const iconShortName = ticker.substring(0, 2)
|
|
258
|
+
const chainType = useChainType()
|
|
259
|
+
if (chainType === ChainType.BITCOIN_MAINNET || chainType === ChainType.FRACTAL_BITCOIN_MAINNET) {
|
|
260
|
+
return { iconUrl, iconShortName }
|
|
131
261
|
}
|
|
132
262
|
|
|
133
|
-
return {
|
|
134
|
-
|
|
263
|
+
return { iconUrl: '', iconShortName }
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export function useRunesIconInfo(spacedRune: string) {
|
|
267
|
+
const baseUrl = useIconBaseUrl()
|
|
268
|
+
const iconUrl = `${baseUrl}/runes/${spacedRune}`
|
|
269
|
+
const iconShortName = spacedRune.substring(0, 2)
|
|
270
|
+
const chainType = useChainType()
|
|
271
|
+
if (chainType === ChainType.BITCOIN_MAINNET || chainType === ChainType.FRACTAL_BITCOIN_MAINNET) {
|
|
272
|
+
return { iconUrl, iconShortName }
|
|
135
273
|
}
|
|
274
|
+
|
|
275
|
+
return { iconUrl: '', iconShortName }
|
|
136
276
|
}
|
|
137
277
|
|
|
138
|
-
export function
|
|
139
|
-
const
|
|
140
|
-
|
|
278
|
+
export function useAlkanesIconInfo(name: string, alkaneid: string) {
|
|
279
|
+
const baseUrl = useIconBaseUrl()
|
|
280
|
+
const iconUrl = `${baseUrl}/alkanes/${name}/${alkaneid}`
|
|
281
|
+
const iconShortName = name.substring(0, 2)
|
|
282
|
+
const chainType = useChainType()
|
|
283
|
+
if (chainType === ChainType.BITCOIN_MAINNET || chainType === ChainType.FRACTAL_BITCOIN_MAINNET) {
|
|
284
|
+
return { iconUrl, iconShortName }
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
return { iconUrl: '', iconShortName }
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
export function useCAT20IconInfo(name: string, tokenId: string) {
|
|
291
|
+
const baseUrl = useIconBaseUrl()
|
|
292
|
+
const iconUrl = `${baseUrl}/cat20/${name}/${tokenId}`
|
|
293
|
+
const iconShortName = name.substring(0, 2)
|
|
294
|
+
const chainType = useChainType()
|
|
295
|
+
if (chainType === ChainType.BITCOIN_MAINNET || chainType === ChainType.FRACTAL_BITCOIN_MAINNET) {
|
|
296
|
+
return { iconUrl, iconShortName }
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
return { iconUrl: '', iconShortName }
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
export function useBRC20MarketPlaceWebsite(ticker: string) {
|
|
303
|
+
const chainType = useChainType()
|
|
304
|
+
const unisatWebsite = useUnisatWebsite()
|
|
305
|
+
if (chainType === ChainType.BITCOIN_MAINNET) {
|
|
306
|
+
if (ticker.length == 6) {
|
|
307
|
+
return `${unisatWebsite}/market/brc20_prog?tick=${ticker}`
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
return `${unisatWebsite}/market/brc20?tick=${ticker}`
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
export function useRunesMarketUrl(ticker: string) {
|
|
314
|
+
const unisatWebsite = useUnisatWebsite()
|
|
315
|
+
return `${unisatWebsite}/runes/market?tick=${ticker}`
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
export function useAlkanesMarketPlaceWebsite(alkaneid: string) {
|
|
319
|
+
const unisatWebsite = useUnisatWebsite()
|
|
320
|
+
return `${unisatWebsite}/alkanes/market?tick=${alkaneid}`
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
export function useCAT20MarketPlaceWebsite(tokenId: string) {
|
|
324
|
+
const unisatWebsite = useUnisatWebsite()
|
|
325
|
+
return `${unisatWebsite}/dex/cat20/${tokenId}`
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
export function useRunesInscribeUrl(rune: string) {
|
|
329
|
+
const unisatWebsite = useUnisatWebsite()
|
|
330
|
+
const newUrl = `${unisatWebsite}/runes/inscribe?only=1&tab=mint&rune=${rune}`
|
|
331
|
+
return newUrl
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
export function useBalanceCardDetailExpanded() {
|
|
335
|
+
const uiState = useUIState()
|
|
336
|
+
return uiState.balanceDetailExpanded
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
export function useToggleBalanceCardDetailExpanded() {
|
|
340
|
+
const { balanceDetailExpanded } = useUIState()
|
|
341
|
+
const dispatch = useAppDispatch()
|
|
342
|
+
return useCallback(() => {
|
|
343
|
+
dispatch((uiActions as any).setBalanceDetailExpanded(!balanceDetailExpanded))
|
|
344
|
+
}, [dispatch, balanceDetailExpanded])
|
|
141
345
|
}
|
package/src/index.ts
CHANGED
|
@@ -11,35 +11,44 @@ import keyrings from './reducers/keyrings'
|
|
|
11
11
|
import settings from './reducers/settings'
|
|
12
12
|
import transactions from './reducers/transactions'
|
|
13
13
|
import ui from './reducers/ui'
|
|
14
|
+
import browser from './reducers/browser'
|
|
14
15
|
|
|
15
16
|
const PERSISTED_KEYS: string[] = ['ui', 'discovery']
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
17
|
+
|
|
18
|
+
export function createAppStore() {
|
|
19
|
+
const store = configureStore({
|
|
20
|
+
reducer: {
|
|
21
|
+
accounts,
|
|
22
|
+
transactions,
|
|
23
|
+
settings,
|
|
24
|
+
global,
|
|
25
|
+
keyrings,
|
|
26
|
+
ui,
|
|
27
|
+
discovery,
|
|
28
|
+
browser,
|
|
29
|
+
},
|
|
30
|
+
middleware: getDefaultMiddleware =>
|
|
31
|
+
getDefaultMiddleware({ thunk: true }).concat(
|
|
32
|
+
save({ states: PERSISTED_KEYS, debounce: 1000 })
|
|
33
|
+
),
|
|
34
|
+
preloadedState: load({ states: PERSISTED_KEYS, disableWarnings: true }),
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
store.dispatch(updateVersion())
|
|
38
|
+
setupListeners(store.dispatch)
|
|
39
|
+
|
|
40
|
+
return store
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type AppStore = ReturnType<typeof createAppStore>
|
|
44
|
+
export type AppState = ReturnType<AppStore['getState']>
|
|
45
|
+
export type AppDispatch = AppStore['dispatch']
|
|
40
46
|
|
|
41
47
|
export * from './context'
|
|
42
48
|
export * from './hooks'
|
|
43
49
|
export * from './updater'
|
|
44
50
|
export * from './reducers'
|
|
45
51
|
export * from './types'
|
|
52
|
+
export * from './ui-hooks'
|
|
53
|
+
export { uiEventBus } from './utils/eventBus'
|
|
54
|
+
export { useAsyncEffect } from './utils/ui-utils'
|
package/src/reducers/accounts.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createSlice, Slice } from '@reduxjs/toolkit'
|
|
1
2
|
import {
|
|
2
3
|
Account,
|
|
3
4
|
AddressSummary,
|
|
@@ -7,10 +8,19 @@ import {
|
|
|
7
8
|
InscriptionSummary,
|
|
8
9
|
TxHistoryItem,
|
|
9
10
|
} from '@unisat/wallet-shared'
|
|
10
|
-
import { createSlice, Slice } from '@reduxjs/toolkit'
|
|
11
11
|
|
|
12
12
|
import { updateVersion } from '../actions/global'
|
|
13
13
|
|
|
14
|
+
export interface Molels {
|
|
15
|
+
states: boolean
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface MolelsPopover {
|
|
19
|
+
state: boolean
|
|
20
|
+
title: string
|
|
21
|
+
data: any
|
|
22
|
+
}
|
|
23
|
+
|
|
14
24
|
export interface AccountsState {
|
|
15
25
|
accounts: Account[]
|
|
16
26
|
current: Account
|
|
@@ -43,6 +53,8 @@ export interface AccountsState {
|
|
|
43
53
|
appSummary: AppSummary
|
|
44
54
|
inscriptionSummary: InscriptionSummary
|
|
45
55
|
addressSummary: AddressSummary
|
|
56
|
+
model: Molels
|
|
57
|
+
molelsPopover: MolelsPopover
|
|
46
58
|
}
|
|
47
59
|
|
|
48
60
|
const initialAccount = {
|
|
@@ -84,6 +96,9 @@ export const initialState: AccountsState = {
|
|
|
84
96
|
address: '',
|
|
85
97
|
runesCount: 0,
|
|
86
98
|
},
|
|
99
|
+
|
|
100
|
+
model: { states: false },
|
|
101
|
+
molelsPopover: { state: false, title: '', data: null },
|
|
87
102
|
}
|
|
88
103
|
|
|
89
104
|
const slice: Slice<AccountsState> = createSlice({
|
|
@@ -150,7 +165,7 @@ const slice: Slice<AccountsState> = createSlice({
|
|
|
150
165
|
) {
|
|
151
166
|
const {
|
|
152
167
|
payload: {
|
|
153
|
-
balance: { availableBalance, unavailableBalance, totalBalance },
|
|
168
|
+
balance: { availableBalance, unavailableBalance, totalBalance, chainType },
|
|
154
169
|
address,
|
|
155
170
|
},
|
|
156
171
|
} = action
|
|
@@ -158,14 +173,19 @@ const slice: Slice<AccountsState> = createSlice({
|
|
|
158
173
|
availableBalance: 0,
|
|
159
174
|
unavailableBalance: 0,
|
|
160
175
|
totalBalance: 0,
|
|
176
|
+
chainType,
|
|
161
177
|
}
|
|
162
178
|
state.balanceV2Map[address].availableBalance = availableBalance
|
|
163
179
|
state.balanceV2Map[address].unavailableBalance = unavailableBalance
|
|
164
180
|
state.balanceV2Map[address].totalBalance = totalBalance
|
|
181
|
+
state.balanceV2Map[address].chainType = chainType
|
|
165
182
|
},
|
|
166
183
|
setAddressSummary(state, action: { payload: any }) {
|
|
167
184
|
state.addressSummary = action.payload
|
|
168
185
|
},
|
|
186
|
+
setModelPopover(state, action: { payload: MolelsPopover }) {
|
|
187
|
+
state.molelsPopover = action.payload
|
|
188
|
+
},
|
|
169
189
|
expireBalance(state) {
|
|
170
190
|
const balance = state.balanceMap[state.current.address]
|
|
171
191
|
if (balance) {
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { createSlice, Slice } from '@reduxjs/toolkit'
|
|
2
|
+
import { AppInfo } from '@unisat/wallet-shared'
|
|
3
|
+
export enum WalletTabScreenTabKey {
|
|
4
|
+
ALL,
|
|
5
|
+
BRC20,
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
type suspensionType = {
|
|
9
|
+
suspensionIf: boolean
|
|
10
|
+
info: AppInfo | object | any
|
|
11
|
+
web: any
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
type wcars = {
|
|
15
|
+
if?: boolean
|
|
16
|
+
url: string
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
type guideListsType = {
|
|
20
|
+
id: number
|
|
21
|
+
title: string
|
|
22
|
+
content: string
|
|
23
|
+
img: string
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface setSessionDateProps {
|
|
27
|
+
icon: string
|
|
28
|
+
name: string
|
|
29
|
+
origin: string
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const wcarss: wcars = {
|
|
33
|
+
if: false,
|
|
34
|
+
url: '',
|
|
35
|
+
}
|
|
36
|
+
const riskIfs: boolean = false
|
|
37
|
+
|
|
38
|
+
const suspensions: suspensionType = {
|
|
39
|
+
suspensionIf: false,
|
|
40
|
+
info: {},
|
|
41
|
+
web: '',
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const collects: any = [
|
|
45
|
+
{
|
|
46
|
+
id: 4,
|
|
47
|
+
name: 'My favorites',
|
|
48
|
+
icon: 'collect_white',
|
|
49
|
+
list: null,
|
|
50
|
+
},
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
const yys: any = false
|
|
54
|
+
|
|
55
|
+
const riseHeights: number = 100
|
|
56
|
+
|
|
57
|
+
const ScanDatas: string = ''
|
|
58
|
+
|
|
59
|
+
const historyLists: any = []
|
|
60
|
+
|
|
61
|
+
const mnemonicAids: any = []
|
|
62
|
+
|
|
63
|
+
const amountValues: string = null
|
|
64
|
+
|
|
65
|
+
const guideLists: guideListsType[] = [
|
|
66
|
+
{
|
|
67
|
+
id: 1,
|
|
68
|
+
title: 'Welcome to UniSat',
|
|
69
|
+
content: 'Your trusted Bitcoin wallet with full support for Ordinals and Atomicals protocols.',
|
|
70
|
+
img: 'guide1',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: 2,
|
|
74
|
+
title: 'Effortless Bitcoin Asset Management',
|
|
75
|
+
content: 'Easily switch between accounts and wallets for seamless asset management.',
|
|
76
|
+
img: 'guide2',
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
id: 3,
|
|
80
|
+
title: 'Discover Web3 on Bitcoin',
|
|
81
|
+
content: 'Let us guide you through the world of Bitcoin web3 with ease.',
|
|
82
|
+
img: 'guide3',
|
|
83
|
+
},
|
|
84
|
+
]
|
|
85
|
+
|
|
86
|
+
const popUps: boolean = false
|
|
87
|
+
|
|
88
|
+
const setStatusBars: boolean = false
|
|
89
|
+
|
|
90
|
+
const setSessionDates: setSessionDateProps = {
|
|
91
|
+
icon: '',
|
|
92
|
+
name: '',
|
|
93
|
+
origin: '',
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const i18Classs: string = 'ru'
|
|
97
|
+
|
|
98
|
+
const webViewLods: boolean = true
|
|
99
|
+
|
|
100
|
+
export interface BrowserState {
|
|
101
|
+
walletTabScreen: {
|
|
102
|
+
tabKey: wcars
|
|
103
|
+
riskIf: boolean
|
|
104
|
+
collect: any
|
|
105
|
+
historyList: any
|
|
106
|
+
suspension: suspensionType
|
|
107
|
+
yy: any
|
|
108
|
+
riseHeight: number
|
|
109
|
+
ScanData: string
|
|
110
|
+
amountValue: string
|
|
111
|
+
guideList: guideListsType[]
|
|
112
|
+
popUp: boolean
|
|
113
|
+
setStatusBar: boolean
|
|
114
|
+
i18Class: string
|
|
115
|
+
setSessionDate: setSessionDateProps
|
|
116
|
+
webViewLod: boolean
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export const initialState: BrowserState = {
|
|
121
|
+
walletTabScreen: {
|
|
122
|
+
tabKey: wcarss,
|
|
123
|
+
riskIf: riskIfs,
|
|
124
|
+
collect: collects,
|
|
125
|
+
historyList: historyLists,
|
|
126
|
+
suspension: suspensions,
|
|
127
|
+
yy: yys,
|
|
128
|
+
riseHeight: riseHeights,
|
|
129
|
+
ScanData: ScanDatas,
|
|
130
|
+
amountValue: amountValues,
|
|
131
|
+
guideList: guideLists,
|
|
132
|
+
popUp: popUps,
|
|
133
|
+
setStatusBar: setStatusBars,
|
|
134
|
+
i18Class: i18Classs,
|
|
135
|
+
setSessionDate: setSessionDates,
|
|
136
|
+
webViewLod: webViewLods,
|
|
137
|
+
},
|
|
138
|
+
}
|
|
139
|
+
const slice: Slice<BrowserState> = createSlice({
|
|
140
|
+
name: 'browser',
|
|
141
|
+
initialState,
|
|
142
|
+
reducers: {
|
|
143
|
+
reset(state) {
|
|
144
|
+
return initialState
|
|
145
|
+
},
|
|
146
|
+
updateWalletRisk(
|
|
147
|
+
state,
|
|
148
|
+
action: {
|
|
149
|
+
payload: {
|
|
150
|
+
tabKey: wcars
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
) {
|
|
154
|
+
const { payload } = action
|
|
155
|
+
state.walletTabScreen.tabKey = payload.tabKey
|
|
156
|
+
return state
|
|
157
|
+
},
|
|
158
|
+
usedatariskIfs(state, action) {
|
|
159
|
+
state.walletTabScreen.riskIf = action.payload
|
|
160
|
+
return state
|
|
161
|
+
},
|
|
162
|
+
usedataricollect(state, action) {
|
|
163
|
+
if (!action.payload) {
|
|
164
|
+
state.walletTabScreen.collect[0].list = null
|
|
165
|
+
} else {
|
|
166
|
+
state.walletTabScreen.collect[0].list = action.payload
|
|
167
|
+
}
|
|
168
|
+
return state
|
|
169
|
+
},
|
|
170
|
+
usedatariInfo(state, action) {
|
|
171
|
+
return state
|
|
172
|
+
},
|
|
173
|
+
usedatarihistoryList(state, action) {
|
|
174
|
+
state.walletTabScreen.historyList = action.payload
|
|
175
|
+
return state
|
|
176
|
+
},
|
|
177
|
+
usedatarisuspension(state, action) {
|
|
178
|
+
state.walletTabScreen.suspension = action.payload
|
|
179
|
+
return state
|
|
180
|
+
},
|
|
181
|
+
usedatarisyyn(state, action) {
|
|
182
|
+
state.walletTabScreen.yy = action.payload
|
|
183
|
+
return state
|
|
184
|
+
},
|
|
185
|
+
usedatarisriseHeight(state, action) {
|
|
186
|
+
state.walletTabScreen.riseHeight = action.payload
|
|
187
|
+
return state
|
|
188
|
+
},
|
|
189
|
+
usedataScanData(state, action) {
|
|
190
|
+
state.walletTabScreen.ScanData = action.payload
|
|
191
|
+
return state
|
|
192
|
+
},
|
|
193
|
+
usedatamnemonicAid(state, action) {
|
|
194
|
+
return state
|
|
195
|
+
},
|
|
196
|
+
usedatamountValue(state, action) {
|
|
197
|
+
state.walletTabScreen.amountValue = action.payload
|
|
198
|
+
return state
|
|
199
|
+
},
|
|
200
|
+
usedatapopUp(state, action) {
|
|
201
|
+
state.walletTabScreen.popUp = action.payload
|
|
202
|
+
return state
|
|
203
|
+
},
|
|
204
|
+
usedatasetStatusBar(state, action) {
|
|
205
|
+
state.walletTabScreen.setStatusBar = action.payload
|
|
206
|
+
return state
|
|
207
|
+
},
|
|
208
|
+
usedatasetSessionDate(state, action) {
|
|
209
|
+
state.walletTabScreen.setSessionDate = action.payload
|
|
210
|
+
return state
|
|
211
|
+
},
|
|
212
|
+
usedatawebViewLod(state, action) {
|
|
213
|
+
state.walletTabScreen.webViewLod = action.payload
|
|
214
|
+
return state
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
extraReducers: builder => {
|
|
218
|
+
// todo
|
|
219
|
+
},
|
|
220
|
+
})
|
|
221
|
+
|
|
222
|
+
export const browserActions = slice.actions
|
|
223
|
+
export default slice.reducer
|