@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
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import React, { ReactNode, useContext } from 'react'
|
|
2
|
+
|
|
3
|
+
import { BabylonConfigV2 } from '@unisat/babylon-service/types'
|
|
2
4
|
|
|
3
5
|
import {
|
|
4
6
|
Account,
|
|
@@ -6,49 +8,57 @@ import {
|
|
|
6
8
|
AddressCAT20TokenSummary,
|
|
7
9
|
AddressCAT20UtxoSummary,
|
|
8
10
|
AddressCAT721CollectionSummary,
|
|
11
|
+
AddressFlagType,
|
|
9
12
|
AddressRunesTokenSummary,
|
|
10
13
|
AddressSummary,
|
|
11
14
|
AddressTokenSummary,
|
|
12
15
|
AlkanesBalance,
|
|
13
16
|
AlkanesCollection,
|
|
14
17
|
AlkanesInfo,
|
|
18
|
+
Announcement,
|
|
15
19
|
AppInfo,
|
|
20
|
+
AppExtra,
|
|
16
21
|
AppSummary,
|
|
22
|
+
BRC20HistoryItem,
|
|
17
23
|
BabylonAddressSummary,
|
|
18
24
|
BitcoinBalance,
|
|
19
25
|
BitcoinBalanceV2,
|
|
20
|
-
BRC20HistoryItem,
|
|
21
26
|
BtcChannelItem,
|
|
22
27
|
CAT20Balance,
|
|
23
28
|
CAT20MergeOrder,
|
|
24
29
|
CAT721Balance,
|
|
25
30
|
CoinPrice,
|
|
31
|
+
ConnectedSite,
|
|
26
32
|
CosmosBalance,
|
|
27
33
|
CosmosSignDataType,
|
|
28
34
|
DecodedPsbt,
|
|
35
|
+
DummyTxType,
|
|
29
36
|
FeeSummary,
|
|
30
37
|
InscribeOrder,
|
|
31
38
|
Inscription,
|
|
32
39
|
InscriptionSummary,
|
|
40
|
+
LocalPsbtSummary,
|
|
41
|
+
RateUsStatus,
|
|
33
42
|
RuneBalance,
|
|
34
43
|
SignPsbtOptions,
|
|
44
|
+
SignedData,
|
|
45
|
+
SignedMessage,
|
|
46
|
+
StoredNotification,
|
|
35
47
|
TickPriceItem,
|
|
48
|
+
ToSignData,
|
|
49
|
+
ToSignInput,
|
|
50
|
+
ToSignMessage,
|
|
36
51
|
TokenBalance,
|
|
37
52
|
TokenTransfer,
|
|
38
53
|
TxHistoryItem,
|
|
39
|
-
UserToSignInput,
|
|
40
54
|
UTXO,
|
|
41
55
|
UTXO_Detail,
|
|
56
|
+
UnspentOutput,
|
|
42
57
|
VersionDetail,
|
|
43
58
|
WalletConfig,
|
|
44
59
|
WalletKeyring,
|
|
45
60
|
WebsiteResult,
|
|
46
|
-
ToSignInput,
|
|
47
|
-
UnspentOutput,
|
|
48
|
-
AddressFlagType,
|
|
49
|
-
ConnectedSite,
|
|
50
61
|
} from '@unisat/wallet-shared'
|
|
51
|
-
import { BabylonConfigV2 } from '@unisat/babylon-service/types'
|
|
52
62
|
import { AddressType, ChainType, NetworkType } from '@unisat/wallet-types'
|
|
53
63
|
|
|
54
64
|
interface ContactBookItem {
|
|
@@ -65,7 +75,13 @@ export interface WalletController {
|
|
|
65
75
|
openapi: {
|
|
66
76
|
[key: string]: (...params: any) => Promise<any>
|
|
67
77
|
}
|
|
78
|
+
// for development use only
|
|
79
|
+
requestMethod: (...params: any) => Promise<any>
|
|
68
80
|
|
|
81
|
+
setBackgroundInited(value: boolean): Promise<void>
|
|
82
|
+
getBackgroundInited(): Promise<boolean>
|
|
83
|
+
|
|
84
|
+
getDesc: () => string
|
|
69
85
|
boot(password: string): Promise<void>
|
|
70
86
|
isBooted(): Promise<boolean>
|
|
71
87
|
|
|
@@ -75,7 +91,7 @@ export interface WalletController {
|
|
|
75
91
|
|
|
76
92
|
hasVault(): Promise<boolean>
|
|
77
93
|
|
|
78
|
-
verifyPassword(password: string): Promise<
|
|
94
|
+
verifyPassword(password: string): Promise<boolean>
|
|
79
95
|
changePassword: (password: string, newPassword: string) => Promise<void>
|
|
80
96
|
|
|
81
97
|
unlock(password: string): Promise<void>
|
|
@@ -143,7 +159,8 @@ export interface WalletController {
|
|
|
143
159
|
hdPath: string,
|
|
144
160
|
passphrase: string,
|
|
145
161
|
addressType: AddressType,
|
|
146
|
-
accountCount: number
|
|
162
|
+
accountCount: number,
|
|
163
|
+
accountIndexDerivation?: boolean
|
|
147
164
|
): Promise<{ address: string; type: string }[]>
|
|
148
165
|
createKeyringWithKeystone(
|
|
149
166
|
urType: string,
|
|
@@ -186,8 +203,26 @@ export interface WalletController {
|
|
|
186
203
|
hdPath: string,
|
|
187
204
|
passphrase: string,
|
|
188
205
|
addressType: AddressType,
|
|
189
|
-
accountCount?: number
|
|
206
|
+
accountCount?: number,
|
|
207
|
+
accountIndexDerivation?: boolean
|
|
208
|
+
): Promise<WalletKeyring>
|
|
209
|
+
|
|
210
|
+
createTmpKeyringWithMnemonics2(
|
|
211
|
+
mnemonic: string,
|
|
212
|
+
passphrase: string,
|
|
213
|
+
hdPaths: string[],
|
|
214
|
+
addressTypes: AddressType[]
|
|
215
|
+
): Promise<WalletKeyring[]>
|
|
216
|
+
|
|
217
|
+
createTmpKeyringWithMnemonicsScan(
|
|
218
|
+
mnemonic: string,
|
|
219
|
+
hdPath: string,
|
|
220
|
+
passphrase: string,
|
|
221
|
+
addressType: AddressType,
|
|
222
|
+
accountCount: number,
|
|
223
|
+
accountIndexDerivation?: boolean
|
|
190
224
|
): Promise<WalletKeyring>
|
|
225
|
+
|
|
191
226
|
removeKeyring(keyring: WalletKeyring): Promise<WalletKeyring>
|
|
192
227
|
deriveNewAccountFromMnemonic(keyring: WalletKeyring, alianName?: string): Promise<string[]>
|
|
193
228
|
getAccountsCount(): Promise<number>
|
|
@@ -200,74 +235,51 @@ export interface WalletController {
|
|
|
200
235
|
|
|
201
236
|
getCurrentKeyringAccounts(): Promise<Account[]>
|
|
202
237
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
autoFinalized: boolean
|
|
207
|
-
): Promise<string>
|
|
238
|
+
signPsbtV2(toSignData: ToSignData): Promise<SignedData>
|
|
239
|
+
|
|
240
|
+
signMessage(params: ToSignMessage): Promise<SignedMessage>
|
|
208
241
|
|
|
209
|
-
|
|
242
|
+
createSendBTCPsbt(data: {
|
|
210
243
|
to: string
|
|
211
244
|
amount: number
|
|
212
245
|
btcUtxos: UnspentOutput[]
|
|
213
246
|
feeRate: number
|
|
214
|
-
enableRBF
|
|
247
|
+
enableRBF?: boolean
|
|
215
248
|
memo?: string
|
|
216
249
|
memos?: string[]
|
|
217
|
-
}): Promise<
|
|
218
|
-
psbtHex: string
|
|
219
|
-
rawtx: string
|
|
220
|
-
fee: number
|
|
221
|
-
}>
|
|
250
|
+
}): Promise<ToSignData>
|
|
222
251
|
|
|
223
|
-
|
|
252
|
+
createSendAllBTCPsbt(data: {
|
|
224
253
|
to: string
|
|
225
254
|
btcUtxos: UnspentOutput[]
|
|
226
255
|
feeRate: number
|
|
227
|
-
enableRBF
|
|
228
|
-
}): Promise<
|
|
229
|
-
psbtHex: string
|
|
230
|
-
rawtx: string
|
|
231
|
-
fee: number
|
|
232
|
-
}>
|
|
256
|
+
enableRBF?: boolean
|
|
257
|
+
}): Promise<ToSignData>
|
|
233
258
|
|
|
234
|
-
|
|
259
|
+
createSendInscriptionPsbt(data: {
|
|
235
260
|
to: string
|
|
236
261
|
inscriptionId: string
|
|
237
262
|
feeRate: number
|
|
238
263
|
outputValue?: number
|
|
239
|
-
enableRBF: boolean
|
|
240
264
|
btcUtxos: UnspentOutput[]
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
rawtx: string
|
|
244
|
-
fee: number
|
|
245
|
-
}>
|
|
265
|
+
enableRBF?: boolean
|
|
266
|
+
}): Promise<ToSignData>
|
|
246
267
|
|
|
247
|
-
|
|
268
|
+
createSendMultipleInscriptionsPsbt(data: {
|
|
248
269
|
to: string
|
|
249
270
|
inscriptionIds: string[]
|
|
250
271
|
feeRate: number
|
|
251
|
-
enableRBF: boolean
|
|
252
272
|
btcUtxos: UnspentOutput[]
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
rawtx: string
|
|
256
|
-
fee: number
|
|
257
|
-
}>
|
|
273
|
+
enableRBF?: boolean
|
|
274
|
+
}): Promise<ToSignData>
|
|
258
275
|
|
|
259
|
-
|
|
276
|
+
createSplitInscriptionPsbt(data: {
|
|
260
277
|
inscriptionId: string
|
|
261
278
|
feeRate: number
|
|
262
279
|
outputValue: number
|
|
263
|
-
enableRBF: boolean
|
|
264
280
|
btcUtxos: UnspentOutput[]
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
rawtx: string
|
|
268
|
-
fee: number
|
|
269
|
-
splitedCount: number
|
|
270
|
-
}>
|
|
281
|
+
enableRBF?: boolean
|
|
282
|
+
}): Promise<ToSignData>
|
|
271
283
|
|
|
272
284
|
pushTx(rawtx: string): Promise<string>
|
|
273
285
|
|
|
@@ -287,9 +299,11 @@ export interface WalletController {
|
|
|
287
299
|
getConnectedSites(): Promise<ConnectedSite[]>
|
|
288
300
|
removeConnectedSite(origin: string): Promise<void>
|
|
289
301
|
getCurrentConnectedSite(id: string): Promise<ConnectedSite>
|
|
302
|
+
updateConnectSite(origin: string, data: Partial<ConnectedSite>): Promise<void>
|
|
290
303
|
|
|
291
304
|
getCurrentKeyring(): Promise<WalletKeyring>
|
|
292
305
|
getKeyrings(): Promise<WalletKeyring[]>
|
|
306
|
+
getTotalKeyringCount(): Promise<number>
|
|
293
307
|
changeKeyring(keyring: WalletKeyring, accountIndex?: number): Promise<void>
|
|
294
308
|
getAllAddresses(keyring: WalletKeyring, index: number): Promise<string[]>
|
|
295
309
|
|
|
@@ -298,6 +312,7 @@ export interface WalletController {
|
|
|
298
312
|
|
|
299
313
|
setAccountAlianName(account: Account, name: string): Promise<Account>
|
|
300
314
|
getFeeSummary(): Promise<FeeSummary>
|
|
315
|
+
getLowFeeSummary(): Promise<FeeSummary>
|
|
301
316
|
getCoinPrice(): Promise<CoinPrice>
|
|
302
317
|
getBrc20sPrice(ticks: string[]): Promise<{ [tick: string]: TickPriceItem }>
|
|
303
318
|
getRunesPrice(ticks: string[]): Promise<{ [tick: string]: TickPriceItem }>
|
|
@@ -320,6 +335,7 @@ export interface WalletController {
|
|
|
320
335
|
getInscribeResult(orderId: string): Promise<TokenTransfer>
|
|
321
336
|
|
|
322
337
|
decodePsbt(psbtHex: string, website: string): Promise<DecodedPsbt>
|
|
338
|
+
analyzeLocalPsbts(toSignDatas: ToSignData[]): Promise<LocalPsbtSummary>
|
|
323
339
|
|
|
324
340
|
decodeContracts(contracts: any[], account: any): Promise<any[]>
|
|
325
341
|
|
|
@@ -329,24 +345,39 @@ export interface WalletController {
|
|
|
329
345
|
pageSize: number
|
|
330
346
|
): Promise<{ currentPage: number; pageSize: number; total: number; list: Inscription[] }>
|
|
331
347
|
|
|
332
|
-
getBRC20List(
|
|
333
|
-
address
|
|
334
|
-
currentPage
|
|
348
|
+
getBRC20List({
|
|
349
|
+
address,
|
|
350
|
+
currentPage,
|
|
351
|
+
pageSize,
|
|
352
|
+
}: {
|
|
353
|
+
address: string
|
|
354
|
+
currentPage: number
|
|
335
355
|
pageSize: number
|
|
336
|
-
): Promise<{ currentPage: number; pageSize: number; total: number; list: TokenBalance[] }>
|
|
356
|
+
}): Promise<{ currentPage: number; pageSize: number; total: number; list: TokenBalance[] }>
|
|
337
357
|
|
|
338
|
-
getBRC20ProgList(
|
|
339
|
-
address
|
|
340
|
-
currentPage
|
|
358
|
+
getBRC20ProgList({
|
|
359
|
+
address,
|
|
360
|
+
currentPage,
|
|
361
|
+
pageSize,
|
|
362
|
+
}: {
|
|
363
|
+
address: string
|
|
364
|
+
currentPage: number
|
|
341
365
|
pageSize: number
|
|
342
|
-
): Promise<{ currentPage: number; pageSize: number; total: number; list: TokenBalance[] }>
|
|
343
|
-
|
|
344
|
-
getBRC20TransferableList(
|
|
345
|
-
address
|
|
346
|
-
ticker
|
|
347
|
-
|
|
366
|
+
}): Promise<{ currentPage: number; pageSize: number; total: number; list: TokenBalance[] }>
|
|
367
|
+
|
|
368
|
+
getBRC20TransferableList({
|
|
369
|
+
address,
|
|
370
|
+
ticker,
|
|
371
|
+
tickerHex,
|
|
372
|
+
currentPage,
|
|
373
|
+
pageSize,
|
|
374
|
+
}: {
|
|
375
|
+
address: string
|
|
376
|
+
ticker: string
|
|
377
|
+
tickerHex: string
|
|
378
|
+
currentPage: number
|
|
348
379
|
pageSize: number
|
|
349
|
-
): Promise<{ currentPage: number; pageSize: number; total: number; list: TokenTransfer[] }>
|
|
380
|
+
}): Promise<{ currentPage: number; pageSize: number; total: number; list: TokenTransfer[] }>
|
|
350
381
|
|
|
351
382
|
getOrdinalsInscriptions(
|
|
352
383
|
address: string,
|
|
@@ -354,7 +385,13 @@ export interface WalletController {
|
|
|
354
385
|
pageSize: number
|
|
355
386
|
): Promise<{ currentPage: number; pageSize: number; total: number; list: Inscription[] }>
|
|
356
387
|
|
|
357
|
-
getBRC20Summary(
|
|
388
|
+
getBRC20Summary({
|
|
389
|
+
address,
|
|
390
|
+
ticker,
|
|
391
|
+
}: {
|
|
392
|
+
address: string
|
|
393
|
+
ticker: string
|
|
394
|
+
}): Promise<AddressTokenSummary>
|
|
358
395
|
|
|
359
396
|
expireUICachedData(address: string): Promise<void>
|
|
360
397
|
|
|
@@ -429,20 +466,16 @@ export interface WalletController {
|
|
|
429
466
|
|
|
430
467
|
getAddressRunesTokenSummary(address: string, runeid: string): Promise<AddressRunesTokenSummary>
|
|
431
468
|
|
|
432
|
-
|
|
469
|
+
createSendRunesPsbt(data: {
|
|
433
470
|
to: string
|
|
434
471
|
runeid: string
|
|
435
472
|
runeAmount: string
|
|
436
473
|
feeRate: number
|
|
437
|
-
enableRBF: boolean
|
|
438
474
|
btcUtxos?: UnspentOutput[]
|
|
439
475
|
assetUtxos?: UnspentOutput[]
|
|
440
476
|
outputValue?: number
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
rawtx: string
|
|
444
|
-
fee: number
|
|
445
|
-
}>
|
|
477
|
+
enableRBF?: boolean
|
|
478
|
+
}): Promise<ToSignData>
|
|
446
479
|
|
|
447
480
|
setAutoLockTimeId(timeId: number): Promise<void>
|
|
448
481
|
getAutoLockTimeId(): Promise<number>
|
|
@@ -475,18 +508,16 @@ export interface WalletController {
|
|
|
475
508
|
tokenId: string,
|
|
476
509
|
tokenAmount: string,
|
|
477
510
|
feeRate: number
|
|
478
|
-
): Promise<{ id: string;
|
|
511
|
+
): Promise<{ id: string; feeRate: number; toSignData: ToSignData }>
|
|
479
512
|
transferCAT20Step2(
|
|
480
513
|
version: 'v1' | 'v2',
|
|
481
514
|
transferId: string,
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
): Promise<{ revealTx: string; toSignInputs: UserToSignInput[] }>
|
|
515
|
+
psbtHex: string
|
|
516
|
+
): Promise<{ toSignData: ToSignData }>
|
|
485
517
|
transferCAT20Step3(
|
|
486
518
|
version: 'v1' | 'v2',
|
|
487
519
|
transferId: string,
|
|
488
|
-
|
|
489
|
-
toSignInputs: UserToSignInput[]
|
|
520
|
+
psbtHex: string
|
|
490
521
|
): Promise<{ txid: string }>
|
|
491
522
|
|
|
492
523
|
mergeCAT20Prepare(
|
|
@@ -498,10 +529,11 @@ export interface WalletController {
|
|
|
498
529
|
transferCAT20Step1ByMerge(
|
|
499
530
|
version: 'v1' | 'v2',
|
|
500
531
|
mergeId: string
|
|
501
|
-
): Promise<{ id: string;
|
|
532
|
+
): Promise<{ id: string; feeRate: number; toSignData: ToSignData }>
|
|
502
533
|
getMergeCAT20Status(version: 'v1' | 'v2', mergeId: string): Promise<any>
|
|
503
534
|
|
|
504
535
|
getAppList(): Promise<{ tab: string; items: AppInfo[] }[]>
|
|
536
|
+
getAppExtra(id: string | number, locale?: string): Promise<AppExtra>
|
|
505
537
|
getBannerList(): Promise<{ id: string; img: string; link: string }[]>
|
|
506
538
|
getBlockActiveInfo(): Promise<{ allTransactions: number; allAddrs: number }>
|
|
507
539
|
|
|
@@ -524,18 +556,16 @@ export interface WalletController {
|
|
|
524
556
|
collectionId: string,
|
|
525
557
|
localId: string,
|
|
526
558
|
feeRate: number
|
|
527
|
-
): Promise<{ id: string;
|
|
559
|
+
): Promise<{ id: string; feeRate: number; toSignData: ToSignData }>
|
|
528
560
|
transferCAT721Step2(
|
|
529
561
|
version: 'v1' | 'v2',
|
|
530
562
|
transferId: string,
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
): Promise<{ revealTx: string; toSignInputs: UserToSignInput[] }>
|
|
563
|
+
psbtHex: string
|
|
564
|
+
): Promise<{ toSignData: ToSignData }>
|
|
534
565
|
transferCAT721Step3(
|
|
535
566
|
version: 'v1' | 'v2',
|
|
536
567
|
transferId: string,
|
|
537
|
-
|
|
538
|
-
toSignInputs: UserToSignInput[]
|
|
568
|
+
psbtHex: string
|
|
539
569
|
): Promise<{ txid: string }>
|
|
540
570
|
|
|
541
571
|
getBuyCoinChannelList(coin: string): Promise<BtcChannelItem[]>
|
|
@@ -593,23 +623,16 @@ export interface WalletController {
|
|
|
593
623
|
feeRate: number
|
|
594
624
|
}): Promise<{
|
|
595
625
|
orderId: string
|
|
596
|
-
|
|
597
|
-
toSignInputs: UserToSignInput[]
|
|
626
|
+
toSignData: ToSignData
|
|
598
627
|
}>
|
|
599
628
|
|
|
600
|
-
singleStepTransferBRC20Step2(params: {
|
|
601
|
-
|
|
602
|
-
commitTx: string
|
|
603
|
-
toSignInputs: UserToSignInput[]
|
|
604
|
-
}): Promise<{
|
|
605
|
-
psbtHex: string
|
|
606
|
-
toSignInputs: UserToSignInput[]
|
|
629
|
+
singleStepTransferBRC20Step2(params: { orderId: string; commitTx: string }): Promise<{
|
|
630
|
+
toSignData: ToSignData
|
|
607
631
|
}>
|
|
608
632
|
|
|
609
633
|
singleStepTransferBRC20Step3(params: {
|
|
610
634
|
orderId: string
|
|
611
635
|
revealTx: string
|
|
612
|
-
toSignInputs: UserToSignInput[]
|
|
613
636
|
}): Promise<{ txid: string }>
|
|
614
637
|
|
|
615
638
|
setLastActiveTime(): void
|
|
@@ -617,14 +640,11 @@ export interface WalletController {
|
|
|
617
640
|
getOpenInSidePanel(): Promise<boolean>
|
|
618
641
|
setOpenInSidePanel(openInSidePanel: boolean): Promise<void>
|
|
619
642
|
|
|
620
|
-
|
|
643
|
+
createSendBTCOffsetPsbt(
|
|
621
644
|
tos: { address: string; satoshis: number }[],
|
|
622
|
-
feeRate: number
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
rawtx: string
|
|
626
|
-
fee: number
|
|
627
|
-
}>
|
|
645
|
+
feeRate: number,
|
|
646
|
+
enableRBF?: boolean
|
|
647
|
+
): Promise<ToSignData>
|
|
628
648
|
|
|
629
649
|
getAlkanesList(
|
|
630
650
|
address: string,
|
|
@@ -640,30 +660,14 @@ export interface WalletController {
|
|
|
640
660
|
fetchAvailable: boolean
|
|
641
661
|
): Promise<AddressAlkanesTokenSummary>
|
|
642
662
|
|
|
643
|
-
|
|
644
|
-
userAddress: string
|
|
645
|
-
userPubkey: string
|
|
646
|
-
receiver: string
|
|
647
|
-
alkaneid: string
|
|
648
|
-
amount: string
|
|
649
|
-
feeRate: number
|
|
650
|
-
}): Promise<{
|
|
651
|
-
psbtHex: string
|
|
652
|
-
toSignInputs: UserToSignInput[]
|
|
653
|
-
}>
|
|
654
|
-
|
|
655
|
-
signAlkanesSendTx(params: {
|
|
656
|
-
commitTx: string
|
|
657
|
-
toSignInputs: ToSignInput[]
|
|
658
|
-
}): Promise<{ txid: string }>
|
|
659
|
-
|
|
660
|
-
sendAlkanes(params: {
|
|
663
|
+
createSendAlkanesPsbt(params: {
|
|
661
664
|
to: string
|
|
662
665
|
alkaneid: string
|
|
663
666
|
amount: string
|
|
664
667
|
feeRate: number
|
|
665
|
-
|
|
666
|
-
|
|
668
|
+
type: 'ft' | 'nft'
|
|
669
|
+
enableRBF?: boolean
|
|
670
|
+
}): Promise<ToSignData>
|
|
667
671
|
|
|
668
672
|
getAlkanesCollectionList(
|
|
669
673
|
address: string,
|
|
@@ -678,9 +682,49 @@ export interface WalletController {
|
|
|
678
682
|
): Promise<{ currentPage: number; pageSize: number; list: AlkanesInfo[]; total: number }>
|
|
679
683
|
|
|
680
684
|
getBRC20RecentHistory(address: string, ticker: string): Promise<BRC20HistoryItem[]>
|
|
685
|
+
|
|
686
|
+
resetAllData(): Promise<void>
|
|
687
|
+
|
|
688
|
+
getGuideReaded(): Promise<boolean>
|
|
689
|
+
setGuideReaded(): Promise<void>
|
|
690
|
+
|
|
691
|
+
getRateUsStatus(): Promise<RateUsStatus>
|
|
692
|
+
|
|
693
|
+
setHasRated(hasRated: boolean): Promise<void>
|
|
694
|
+
setRatePromptDismissedAt(timestamp: number | null): Promise<void>
|
|
695
|
+
setHasShownSecondPrompt(hasShown: boolean): Promise<void>
|
|
696
|
+
resetRateUsStatus(): Promise<void>
|
|
697
|
+
getAnnouncements(
|
|
698
|
+
cursor: number,
|
|
699
|
+
size: number
|
|
700
|
+
): Promise<{
|
|
701
|
+
hasMore: boolean
|
|
702
|
+
list: Announcement[]
|
|
703
|
+
}>
|
|
704
|
+
|
|
705
|
+
getNotifications(): Promise<StoredNotification[]>
|
|
706
|
+
readNotification(id: string): Promise<void>
|
|
707
|
+
readAllNotifications(): Promise<void>
|
|
708
|
+
deleteNotification(id: string): Promise<void>
|
|
709
|
+
getNotificationUnreadCount(): Promise<number>
|
|
710
|
+
|
|
711
|
+
getAcceptLowFeeMode(): Promise<boolean>
|
|
712
|
+
setAcceptLowFeeMode(accept: boolean): Promise<void>
|
|
713
|
+
getEnableRBF(): Promise<boolean>
|
|
714
|
+
setEnableRBF(enableRBF: boolean): Promise<void>
|
|
715
|
+
|
|
716
|
+
createTmpKeyringWithPublicKey(publicKey: string, addressType: AddressType): Promise<WalletKeyring>
|
|
717
|
+
|
|
718
|
+
createKeyringWithPublicKey(data: string, addressType: AddressType): Promise<void>
|
|
719
|
+
|
|
720
|
+
createTmpKeyringWithAddress(address: string): Promise<WalletKeyring>
|
|
721
|
+
|
|
722
|
+
createKeyringWithAddress(address: string): Promise<void>
|
|
723
|
+
|
|
724
|
+
createDummyPsbt(params: { txType: DummyTxType }): Promise<ToSignData>
|
|
681
725
|
}
|
|
682
726
|
|
|
683
|
-
const WalletContext = createContext<{
|
|
727
|
+
const WalletContext = React.createContext<{
|
|
684
728
|
wallet: WalletController
|
|
685
729
|
} | null>(null)
|
|
686
730
|
|
|
@@ -700,4 +744,4 @@ const useWallet = () => {
|
|
|
700
744
|
return wallet
|
|
701
745
|
}
|
|
702
746
|
|
|
703
|
-
export {
|
|
747
|
+
export { WalletProvider, useWallet }
|
package/src/context/index.ts
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { ApprovalContext, useApproval, type ApprovalContextType } from './ApprovalContext'
|
|
2
|
+
export { DeviceContext, useDevice, type DeviceContextType } from './DeviceContext'
|
|
3
|
+
export { I18nContext, useI18n, type I18nContextType } from './I18nContext'
|
|
4
|
+
export {
|
|
5
|
+
NavigationContext,
|
|
6
|
+
useNavigation,
|
|
7
|
+
type NavigationContextType,
|
|
8
|
+
type RouteTypes,
|
|
9
|
+
} from './NavigationContext'
|
|
10
|
+
export { PriceProvider, usePrice } from './PriceContext'
|
|
11
|
+
export {
|
|
12
|
+
createStorageProvider,
|
|
13
|
+
StorageContext,
|
|
14
|
+
useStorage,
|
|
15
|
+
type StorageContextType,
|
|
16
|
+
} from './StorageContext'
|
|
17
|
+
export { ToolsContext, useTools, type ToolsContextType } from './ToolsContext'
|
|
2
18
|
export { useWallet, WalletProvider } from './WalletContext'
|
|
3
|
-
export { usePrice, PriceProvider } from './PriceContext'
|
package/src/hooks/accounts.ts
CHANGED
|
@@ -2,16 +2,16 @@ import { useCallback } from 'react'
|
|
|
2
2
|
|
|
3
3
|
import { Account } from '@unisat/wallet-shared'
|
|
4
4
|
|
|
5
|
-
import { AddressType } from '@unisat/wallet-types'
|
|
6
5
|
import { KeyringType } from '@unisat/keyring-service/types'
|
|
6
|
+
import { AddressType, ChainType } from '@unisat/wallet-types'
|
|
7
7
|
|
|
8
8
|
import { AppState } from '..'
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { useWallet } from '../context/WalletContext'
|
|
10
|
+
import { accountActions } from '../reducers/accounts'
|
|
11
11
|
import { keyringsActions } from '../reducers/keyrings'
|
|
12
12
|
import { settingsActions } from '../reducers/settings'
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
13
|
+
import { useAppDispatch, useAppSelector } from './base'
|
|
14
|
+
import { useCurrentKeyring } from './keyrings'
|
|
15
15
|
|
|
16
16
|
export function useAccountsState(): AppState['accounts'] {
|
|
17
17
|
return useAppSelector(state => state.accounts)
|
|
@@ -40,6 +40,7 @@ export function useAccountBalance() {
|
|
|
40
40
|
availableBalance: 0,
|
|
41
41
|
unavailableBalance: 0,
|
|
42
42
|
totalBalance: 0,
|
|
43
|
+
chainType: ChainType.BITCOIN_MAINNET,
|
|
43
44
|
}
|
|
44
45
|
)
|
|
45
46
|
}
|
|
@@ -210,6 +211,7 @@ export function useFetchBalanceCallback() {
|
|
|
210
211
|
accountActions['setBalanceV2']!({
|
|
211
212
|
address: currentAccount.address,
|
|
212
213
|
balance: balanceV2,
|
|
214
|
+
chainType: balanceV2.chainType,
|
|
213
215
|
})
|
|
214
216
|
)
|
|
215
217
|
}, [dispatch, wallet, currentAccount, balance])
|
|
@@ -244,3 +246,7 @@ export function useIsKeystoneWallet() {
|
|
|
244
246
|
const currentKeyring = useCurrentKeyring()
|
|
245
247
|
return currentKeyring.type === KeyringType.KeystoneKeyring
|
|
246
248
|
}
|
|
249
|
+
export function useModelPopover() {
|
|
250
|
+
const modelState = useAccountsState()
|
|
251
|
+
return modelState.molelsPopover
|
|
252
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AppState } from '..'
|
|
2
|
+
import { useAppSelector } from '../hooks'
|
|
3
|
+
|
|
4
|
+
export function useBrowserState(): AppState['browser'] {
|
|
5
|
+
return useAppSelector(state => state.browser)
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function useWalletTabScreenState() {
|
|
9
|
+
const state = useBrowserState()
|
|
10
|
+
return state.walletTabScreen
|
|
11
|
+
}
|