@unisat/wallet-state 1.0.2 → 1.0.5

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/lib/index.d.mts CHANGED
@@ -4,6 +4,7 @@ import * as _unisat_wallet_types from '@unisat/wallet-types';
4
4
  import { ChainType, NetworkType, AddressType } from '@unisat/wallet-types';
5
5
  import * as _unisat_wallet_shared from '@unisat/wallet-shared';
6
6
  import { AppInfo, Inscription, WalletKeyring, WalletConfig, UnspentOutput, Account, BitcoinBalanceV2, TxHistoryItem, AppSummary, InscriptionSummary, AddressSummary, BitcoinBalance, ToSignInput, ConnectedSite, FeeSummary, CoinPrice, TickPriceItem, InscribeOrder, TokenTransfer, DecodedPsbt, TokenBalance, AddressTokenSummary, UTXO_Detail, UTXO, WebsiteResult, SignPsbtOptions, AddressFlagType, VersionDetail, CosmosSignDataType, RuneBalance, AddressRunesTokenSummary, CAT20Balance, AddressCAT20TokenSummary, AddressCAT20UtxoSummary, UserToSignInput, CAT20MergeOrder, CAT721Balance, AddressCAT721CollectionSummary, BtcChannelItem, BabylonAddressSummary, CosmosBalance, AlkanesBalance, AddressAlkanesTokenSummary, AlkanesCollection, AlkanesInfo, BRC20HistoryItem, CAT_VERSION, ToAddressInfo, RawTxInfo, TypeChain } from '@unisat/wallet-shared';
7
+ import { AssetTabKey, OrdinalsAssetTabKey, CATAssetTabKey, AlkanesAssetTabKey, NavigationSource, TabOption } from './types/index.mjs';
7
8
  import React, { ReactNode } from 'react';
8
9
  import * as _unisat_babylon_service_types from '@unisat/babylon-service/types';
9
10
  import { BabylonConfigV2 } from '@unisat/babylon-service/types';
@@ -24,6 +25,7 @@ interface DiscoveryState {
24
25
  cachedBannerIds: string[];
25
26
  hasNewBanner: boolean;
26
27
  }
28
+ declare const discoveryActions: _reduxjs_toolkit.CaseReducerActions<_reduxjs_toolkit.SliceCaseReducers<DiscoveryState>, string>;
27
29
 
28
30
  interface UIState {
29
31
  assetTabKey: AssetTabKey;
@@ -47,45 +49,21 @@ interface UIState {
47
49
  navigationSource: NavigationSource;
48
50
  isBalanceHidden: boolean;
49
51
  }
50
- declare enum AssetTabKey {
51
- ORDINALS = 0,
52
- ATOMICALS = 1,
53
- RUNES = 2,
54
- CAT = 3,
55
- ALKANES = 4
56
- }
57
- declare enum OrdinalsAssetTabKey {
58
- ALL = 0,
59
- BRC20 = 1,
60
- BRC20_6BYTE = 2
61
- }
62
- declare enum CATAssetTabKey {
63
- CAT20 = 0,
64
- CAT721 = 1,
65
- CAT20_V2 = 2,
66
- CAT721_V2 = 3
67
- }
68
- declare enum AlkanesAssetTabKey {
69
- TOKEN = 0,
70
- COLLECTION = 1
71
- }
72
- declare enum NavigationSource {
73
- BACK = 0,
74
- NORMAL = 1
75
- }
52
+ declare const uiActions: _reduxjs_toolkit.CaseReducerActions<_reduxjs_toolkit.SliceCaseReducers<UIState>, string>;
76
53
 
77
54
  interface KeyringsState {
78
55
  keyrings: WalletKeyring[];
79
56
  current: WalletKeyring;
80
57
  }
58
+ declare const keyringsActions: _reduxjs_toolkit.CaseReducerActions<_reduxjs_toolkit.SliceCaseReducers<KeyringsState>, string>;
81
59
 
82
- type TabOption = 'home' | 'discover' | 'settings';
83
60
  interface GlobalState {
84
61
  tab: TabOption;
85
62
  isUnlocked: boolean;
86
63
  isReady: boolean;
87
64
  isBooted: boolean;
88
65
  }
66
+ declare const globalActions: any;
89
67
 
90
68
  interface SettingsState {
91
69
  locale: string;
@@ -96,6 +74,7 @@ interface SettingsState {
96
74
  autoLockTimeId: number;
97
75
  developerMode: boolean;
98
76
  }
77
+ declare const settingsActions: _reduxjs_toolkit.CaseReducerActions<_reduxjs_toolkit.SliceCaseReducers<SettingsState>, string>;
99
78
 
100
79
  interface BitcoinTx {
101
80
  fromAddress: string;
@@ -155,6 +134,7 @@ interface TransactionsState {
155
134
  assetUtxos_inscriptions: UnspentOutput[];
156
135
  assetUtxos_runes: UnspentOutput[];
157
136
  }
137
+ declare const transactionsActions: _reduxjs_toolkit.CaseReducerActions<_reduxjs_toolkit.SliceCaseReducers<TransactionsState>, string>;
158
138
 
159
139
  interface AccountsState {
160
140
  accounts: Account[];
@@ -189,6 +169,7 @@ interface AccountsState {
189
169
  inscriptionSummary: InscriptionSummary;
190
170
  addressSummary: AddressSummary;
191
171
  }
172
+ declare const accountActions: _reduxjs_toolkit.CaseReducerActions<_reduxjs_toolkit.SliceCaseReducers<AccountsState>, string>;
192
173
 
193
174
  declare const I18nProvider: React.FC<{
194
175
  children: React.ReactNode;
@@ -689,6 +670,36 @@ declare function PriceProvider({ children }: {
689
670
  children: ReactNode;
690
671
  }): JSX.Element;
691
672
 
673
+ declare function useAccountsState(): AppState['accounts'];
674
+ declare function useCurrentAccount(): Account;
675
+ declare function useCurrentAddress(): string;
676
+ declare function useAccounts(): Account[];
677
+ declare function useAccountBalance(): _unisat_wallet_shared.BitcoinBalanceV2;
678
+ declare function useAddressSummary(): _unisat_wallet_shared.AddressSummary;
679
+ declare function useAccountInscriptions(): {
680
+ list: _unisat_wallet_shared.Inscription[];
681
+ expired: boolean;
682
+ };
683
+ declare function useInscriptionSummary(): _unisat_wallet_shared.InscriptionSummary;
684
+ declare function useAppSummary(): _unisat_wallet_shared.AppSummary;
685
+ declare function useUnreadAppSummary(): _unisat_wallet_shared.AppInfo;
686
+ declare function useReadTab(): (name: 'app' | 'home' | 'settings') => Promise<void>;
687
+ declare function useReadApp(): (id: number) => Promise<void>;
688
+ declare function useHistory(): {
689
+ list: _unisat_wallet_shared.TxHistoryItem[];
690
+ expired: boolean;
691
+ };
692
+ declare function useAccountAddress(): string;
693
+ declare function useSetCurrentAccountCallback(): (account: Account) => void;
694
+ declare function useImportAccountCallback(): (privateKey: string, addressType: AddressType) => Promise<{
695
+ success: boolean;
696
+ error: any;
697
+ }>;
698
+ declare function useChangeAddressFlagCallback(): (isAdd: boolean, flag: number) => Promise<void>;
699
+ declare function useFetchBalanceCallback(): () => Promise<void>;
700
+ declare function useReloadAccounts(): () => Promise<void>;
701
+ declare function useIsKeystoneWallet(): boolean;
702
+
692
703
  type UiTypeCheck = {
693
704
  isTab: boolean;
694
705
  isNotification: boolean;
@@ -907,6 +918,7 @@ declare const useIsInExpandView: () => boolean;
907
918
  declare const useUtxoTools: (chain: TypeChain) => {
908
919
  openUtxoTools: () => void;
909
920
  };
921
+ declare function useLocationState<T>(): T;
910
922
 
911
923
  declare function AccountUpdater(): any;
912
924
 
@@ -931,4 +943,4 @@ declare const store: _reduxjs_toolkit_dist_configureStore.ToolkitStore<{
931
943
  type AppState = ReturnType<typeof store.getState>;
932
944
  type AppDispatch = typeof store.dispatch;
933
945
 
934
- export { AccountUpdater, AppDispatch, AppState, I18nProvider, PriceProvider, WalletProvider, store as default, getAddressTips, getCurrentLocale, getSpecialLocale, getUiType, useAddressExplorerUrl, useAddressTips, useAlkanesAssetTabKey, useAppDispatch, useAppList, useAppSelector, useApproval, useAssetTabKey, useAssetUtxosRunes, useAutoLockTimeId, useBRC20MarketPlaceWebsite, useBTCUnit, useBabylonConfig, useBannerList, useBitcoinTx, useBooted, useCAT20MarketPlaceWebsite, useCAT20TokenInfoExplorerUrl, useCAT721NFTContentBaseUrl, useCATAssetTabKey, useChain, useChainType, useChangeChainTypeCallback, useChangeLocaleCallback, useChangeNetworkTypeCallback, useCreateAccountCallback, useCreateColdWalletCallback, useCreateSplitTxCallback, useCurrentKeyring, useDeveloperMode, useDiscoveryState, useFetchAssetUtxosRunesCallback, useFetchUtxosCallback, useGetTxExplorerUrlCallback, useGlobalState, useHasNewBanner, useI18n, useImportAccountsFromKeystoneCallback, useIsInExpandView, useIsMainnetChain, useIsReady, useIsUnlocked, useKeyrings, useKeyringsState, useLastFetchInfo, useLocale, useNetworkType, useOrdinalsAssetTabKey, useOrdinalsTx, useOrdinalsWebsite, usePrepareSendAlkanesCallback, usePrepareSendBTCCallback, usePrepareSendBypassHeadOffsetsCallback, usePrepareSendOrdinalsInscriptionCallback, usePrepareSendOrdinalsInscriptionsCallback, usePrepareSendRunesCallback, usePrice, usePushBitcoinTxCallback, usePushOrdinalsTxCallback, useResetUiTxCreateScreen, useRunesMarketPlaceWebsite, useRunesTx, useSafeBalance, useSetDeveloperModeCallback, useSetSpendUnavailableUtxosCallback, useSetTabCallback, useSettingsState, useSkipVersionCallback, useSpendUnavailableUtxos, useSupportedAssets, useTab, useTransactionsState, useTxExplorerUrl, useUIState, useUiTxCreateScreen, useUnisatWebsite, useUnlockCallback, useUpdateUiTxCreateScreen, useUtxoTools, useUtxos, useVersionInfo, useWallet, useWalletConfig };
946
+ export { AccountUpdater, AlkanesAssetTabKey, AppDispatch, AppState, AssetTabKey, CATAssetTabKey, I18nProvider, NavigationSource, OrdinalsAssetTabKey, PriceProvider, TabOption, WalletProvider, accountActions, store as default, discoveryActions, getAddressTips, getCurrentLocale, getSpecialLocale, getUiType, globalActions, keyringsActions, settingsActions, transactionsActions, uiActions, useAccountAddress, useAccountBalance, useAccountInscriptions, useAccounts, useAccountsState, useAddressExplorerUrl, useAddressSummary, useAddressTips, useAlkanesAssetTabKey, useAppDispatch, useAppList, useAppSelector, useAppSummary, useApproval, useAssetTabKey, useAssetUtxosRunes, useAutoLockTimeId, useBRC20MarketPlaceWebsite, useBTCUnit, useBabylonConfig, useBannerList, useBitcoinTx, useBooted, useCAT20MarketPlaceWebsite, useCAT20TokenInfoExplorerUrl, useCAT721NFTContentBaseUrl, useCATAssetTabKey, useChain, useChainType, useChangeAddressFlagCallback, useChangeChainTypeCallback, useChangeLocaleCallback, useChangeNetworkTypeCallback, useCreateAccountCallback, useCreateColdWalletCallback, useCreateSplitTxCallback, useCurrentAccount, useCurrentAddress, useCurrentKeyring, useDeveloperMode, useDiscoveryState, useFetchAssetUtxosRunesCallback, useFetchBalanceCallback, useFetchUtxosCallback, useGetTxExplorerUrlCallback, useGlobalState, useHasNewBanner, useHistory, useI18n, useImportAccountCallback, useImportAccountsFromKeystoneCallback, useInscriptionSummary, useIsInExpandView, useIsKeystoneWallet, useIsMainnetChain, useIsReady, useIsUnlocked, useKeyrings, useKeyringsState, useLastFetchInfo, useLocale, useLocationState, useNetworkType, useOrdinalsAssetTabKey, useOrdinalsTx, useOrdinalsWebsite, usePrepareSendAlkanesCallback, usePrepareSendBTCCallback, usePrepareSendBypassHeadOffsetsCallback, usePrepareSendOrdinalsInscriptionCallback, usePrepareSendOrdinalsInscriptionsCallback, usePrepareSendRunesCallback, usePrice, usePushBitcoinTxCallback, usePushOrdinalsTxCallback, useReadApp, useReadTab, useReloadAccounts, useResetUiTxCreateScreen, useRunesMarketPlaceWebsite, useRunesTx, useSafeBalance, useSetCurrentAccountCallback, useSetDeveloperModeCallback, useSetSpendUnavailableUtxosCallback, useSetTabCallback, useSettingsState, useSkipVersionCallback, useSpendUnavailableUtxos, useSupportedAssets, useTab, useTransactionsState, useTxExplorerUrl, useUIState, useUiTxCreateScreen, useUnisatWebsite, useUnlockCallback, useUnreadAppSummary, useUpdateUiTxCreateScreen, useUtxoTools, useUtxos, useVersionInfo, useWallet, useWalletConfig };
package/lib/index.d.ts CHANGED
@@ -4,6 +4,7 @@ import * as _unisat_wallet_types from '@unisat/wallet-types';
4
4
  import { ChainType, NetworkType, AddressType } from '@unisat/wallet-types';
5
5
  import * as _unisat_wallet_shared from '@unisat/wallet-shared';
6
6
  import { AppInfo, Inscription, WalletKeyring, WalletConfig, UnspentOutput, Account, BitcoinBalanceV2, TxHistoryItem, AppSummary, InscriptionSummary, AddressSummary, BitcoinBalance, ToSignInput, ConnectedSite, FeeSummary, CoinPrice, TickPriceItem, InscribeOrder, TokenTransfer, DecodedPsbt, TokenBalance, AddressTokenSummary, UTXO_Detail, UTXO, WebsiteResult, SignPsbtOptions, AddressFlagType, VersionDetail, CosmosSignDataType, RuneBalance, AddressRunesTokenSummary, CAT20Balance, AddressCAT20TokenSummary, AddressCAT20UtxoSummary, UserToSignInput, CAT20MergeOrder, CAT721Balance, AddressCAT721CollectionSummary, BtcChannelItem, BabylonAddressSummary, CosmosBalance, AlkanesBalance, AddressAlkanesTokenSummary, AlkanesCollection, AlkanesInfo, BRC20HistoryItem, CAT_VERSION, ToAddressInfo, RawTxInfo, TypeChain } from '@unisat/wallet-shared';
7
+ import { AssetTabKey, OrdinalsAssetTabKey, CATAssetTabKey, AlkanesAssetTabKey, NavigationSource, TabOption } from './types/index.js';
7
8
  import React, { ReactNode } from 'react';
8
9
  import * as _unisat_babylon_service_types from '@unisat/babylon-service/types';
9
10
  import { BabylonConfigV2 } from '@unisat/babylon-service/types';
@@ -24,6 +25,7 @@ interface DiscoveryState {
24
25
  cachedBannerIds: string[];
25
26
  hasNewBanner: boolean;
26
27
  }
28
+ declare const discoveryActions: _reduxjs_toolkit.CaseReducerActions<_reduxjs_toolkit.SliceCaseReducers<DiscoveryState>, string>;
27
29
 
28
30
  interface UIState {
29
31
  assetTabKey: AssetTabKey;
@@ -47,45 +49,21 @@ interface UIState {
47
49
  navigationSource: NavigationSource;
48
50
  isBalanceHidden: boolean;
49
51
  }
50
- declare enum AssetTabKey {
51
- ORDINALS = 0,
52
- ATOMICALS = 1,
53
- RUNES = 2,
54
- CAT = 3,
55
- ALKANES = 4
56
- }
57
- declare enum OrdinalsAssetTabKey {
58
- ALL = 0,
59
- BRC20 = 1,
60
- BRC20_6BYTE = 2
61
- }
62
- declare enum CATAssetTabKey {
63
- CAT20 = 0,
64
- CAT721 = 1,
65
- CAT20_V2 = 2,
66
- CAT721_V2 = 3
67
- }
68
- declare enum AlkanesAssetTabKey {
69
- TOKEN = 0,
70
- COLLECTION = 1
71
- }
72
- declare enum NavigationSource {
73
- BACK = 0,
74
- NORMAL = 1
75
- }
52
+ declare const uiActions: _reduxjs_toolkit.CaseReducerActions<_reduxjs_toolkit.SliceCaseReducers<UIState>, string>;
76
53
 
77
54
  interface KeyringsState {
78
55
  keyrings: WalletKeyring[];
79
56
  current: WalletKeyring;
80
57
  }
58
+ declare const keyringsActions: _reduxjs_toolkit.CaseReducerActions<_reduxjs_toolkit.SliceCaseReducers<KeyringsState>, string>;
81
59
 
82
- type TabOption = 'home' | 'discover' | 'settings';
83
60
  interface GlobalState {
84
61
  tab: TabOption;
85
62
  isUnlocked: boolean;
86
63
  isReady: boolean;
87
64
  isBooted: boolean;
88
65
  }
66
+ declare const globalActions: any;
89
67
 
90
68
  interface SettingsState {
91
69
  locale: string;
@@ -96,6 +74,7 @@ interface SettingsState {
96
74
  autoLockTimeId: number;
97
75
  developerMode: boolean;
98
76
  }
77
+ declare const settingsActions: _reduxjs_toolkit.CaseReducerActions<_reduxjs_toolkit.SliceCaseReducers<SettingsState>, string>;
99
78
 
100
79
  interface BitcoinTx {
101
80
  fromAddress: string;
@@ -155,6 +134,7 @@ interface TransactionsState {
155
134
  assetUtxos_inscriptions: UnspentOutput[];
156
135
  assetUtxos_runes: UnspentOutput[];
157
136
  }
137
+ declare const transactionsActions: _reduxjs_toolkit.CaseReducerActions<_reduxjs_toolkit.SliceCaseReducers<TransactionsState>, string>;
158
138
 
159
139
  interface AccountsState {
160
140
  accounts: Account[];
@@ -189,6 +169,7 @@ interface AccountsState {
189
169
  inscriptionSummary: InscriptionSummary;
190
170
  addressSummary: AddressSummary;
191
171
  }
172
+ declare const accountActions: _reduxjs_toolkit.CaseReducerActions<_reduxjs_toolkit.SliceCaseReducers<AccountsState>, string>;
192
173
 
193
174
  declare const I18nProvider: React.FC<{
194
175
  children: React.ReactNode;
@@ -689,6 +670,36 @@ declare function PriceProvider({ children }: {
689
670
  children: ReactNode;
690
671
  }): JSX.Element;
691
672
 
673
+ declare function useAccountsState(): AppState['accounts'];
674
+ declare function useCurrentAccount(): Account;
675
+ declare function useCurrentAddress(): string;
676
+ declare function useAccounts(): Account[];
677
+ declare function useAccountBalance(): _unisat_wallet_shared.BitcoinBalanceV2;
678
+ declare function useAddressSummary(): _unisat_wallet_shared.AddressSummary;
679
+ declare function useAccountInscriptions(): {
680
+ list: _unisat_wallet_shared.Inscription[];
681
+ expired: boolean;
682
+ };
683
+ declare function useInscriptionSummary(): _unisat_wallet_shared.InscriptionSummary;
684
+ declare function useAppSummary(): _unisat_wallet_shared.AppSummary;
685
+ declare function useUnreadAppSummary(): _unisat_wallet_shared.AppInfo;
686
+ declare function useReadTab(): (name: 'app' | 'home' | 'settings') => Promise<void>;
687
+ declare function useReadApp(): (id: number) => Promise<void>;
688
+ declare function useHistory(): {
689
+ list: _unisat_wallet_shared.TxHistoryItem[];
690
+ expired: boolean;
691
+ };
692
+ declare function useAccountAddress(): string;
693
+ declare function useSetCurrentAccountCallback(): (account: Account) => void;
694
+ declare function useImportAccountCallback(): (privateKey: string, addressType: AddressType) => Promise<{
695
+ success: boolean;
696
+ error: any;
697
+ }>;
698
+ declare function useChangeAddressFlagCallback(): (isAdd: boolean, flag: number) => Promise<void>;
699
+ declare function useFetchBalanceCallback(): () => Promise<void>;
700
+ declare function useReloadAccounts(): () => Promise<void>;
701
+ declare function useIsKeystoneWallet(): boolean;
702
+
692
703
  type UiTypeCheck = {
693
704
  isTab: boolean;
694
705
  isNotification: boolean;
@@ -907,6 +918,7 @@ declare const useIsInExpandView: () => boolean;
907
918
  declare const useUtxoTools: (chain: TypeChain) => {
908
919
  openUtxoTools: () => void;
909
920
  };
921
+ declare function useLocationState<T>(): T;
910
922
 
911
923
  declare function AccountUpdater(): any;
912
924
 
@@ -931,4 +943,4 @@ declare const store: _reduxjs_toolkit_dist_configureStore.ToolkitStore<{
931
943
  type AppState = ReturnType<typeof store.getState>;
932
944
  type AppDispatch = typeof store.dispatch;
933
945
 
934
- export { AccountUpdater, AppDispatch, AppState, I18nProvider, PriceProvider, WalletProvider, store as default, getAddressTips, getCurrentLocale, getSpecialLocale, getUiType, useAddressExplorerUrl, useAddressTips, useAlkanesAssetTabKey, useAppDispatch, useAppList, useAppSelector, useApproval, useAssetTabKey, useAssetUtxosRunes, useAutoLockTimeId, useBRC20MarketPlaceWebsite, useBTCUnit, useBabylonConfig, useBannerList, useBitcoinTx, useBooted, useCAT20MarketPlaceWebsite, useCAT20TokenInfoExplorerUrl, useCAT721NFTContentBaseUrl, useCATAssetTabKey, useChain, useChainType, useChangeChainTypeCallback, useChangeLocaleCallback, useChangeNetworkTypeCallback, useCreateAccountCallback, useCreateColdWalletCallback, useCreateSplitTxCallback, useCurrentKeyring, useDeveloperMode, useDiscoveryState, useFetchAssetUtxosRunesCallback, useFetchUtxosCallback, useGetTxExplorerUrlCallback, useGlobalState, useHasNewBanner, useI18n, useImportAccountsFromKeystoneCallback, useIsInExpandView, useIsMainnetChain, useIsReady, useIsUnlocked, useKeyrings, useKeyringsState, useLastFetchInfo, useLocale, useNetworkType, useOrdinalsAssetTabKey, useOrdinalsTx, useOrdinalsWebsite, usePrepareSendAlkanesCallback, usePrepareSendBTCCallback, usePrepareSendBypassHeadOffsetsCallback, usePrepareSendOrdinalsInscriptionCallback, usePrepareSendOrdinalsInscriptionsCallback, usePrepareSendRunesCallback, usePrice, usePushBitcoinTxCallback, usePushOrdinalsTxCallback, useResetUiTxCreateScreen, useRunesMarketPlaceWebsite, useRunesTx, useSafeBalance, useSetDeveloperModeCallback, useSetSpendUnavailableUtxosCallback, useSetTabCallback, useSettingsState, useSkipVersionCallback, useSpendUnavailableUtxos, useSupportedAssets, useTab, useTransactionsState, useTxExplorerUrl, useUIState, useUiTxCreateScreen, useUnisatWebsite, useUnlockCallback, useUpdateUiTxCreateScreen, useUtxoTools, useUtxos, useVersionInfo, useWallet, useWalletConfig };
946
+ export { AccountUpdater, AlkanesAssetTabKey, AppDispatch, AppState, AssetTabKey, CATAssetTabKey, I18nProvider, NavigationSource, OrdinalsAssetTabKey, PriceProvider, TabOption, WalletProvider, accountActions, store as default, discoveryActions, getAddressTips, getCurrentLocale, getSpecialLocale, getUiType, globalActions, keyringsActions, settingsActions, transactionsActions, uiActions, useAccountAddress, useAccountBalance, useAccountInscriptions, useAccounts, useAccountsState, useAddressExplorerUrl, useAddressSummary, useAddressTips, useAlkanesAssetTabKey, useAppDispatch, useAppList, useAppSelector, useAppSummary, useApproval, useAssetTabKey, useAssetUtxosRunes, useAutoLockTimeId, useBRC20MarketPlaceWebsite, useBTCUnit, useBabylonConfig, useBannerList, useBitcoinTx, useBooted, useCAT20MarketPlaceWebsite, useCAT20TokenInfoExplorerUrl, useCAT721NFTContentBaseUrl, useCATAssetTabKey, useChain, useChainType, useChangeAddressFlagCallback, useChangeChainTypeCallback, useChangeLocaleCallback, useChangeNetworkTypeCallback, useCreateAccountCallback, useCreateColdWalletCallback, useCreateSplitTxCallback, useCurrentAccount, useCurrentAddress, useCurrentKeyring, useDeveloperMode, useDiscoveryState, useFetchAssetUtxosRunesCallback, useFetchBalanceCallback, useFetchUtxosCallback, useGetTxExplorerUrlCallback, useGlobalState, useHasNewBanner, useHistory, useI18n, useImportAccountCallback, useImportAccountsFromKeystoneCallback, useInscriptionSummary, useIsInExpandView, useIsKeystoneWallet, useIsMainnetChain, useIsReady, useIsUnlocked, useKeyrings, useKeyringsState, useLastFetchInfo, useLocale, useLocationState, useNetworkType, useOrdinalsAssetTabKey, useOrdinalsTx, useOrdinalsWebsite, usePrepareSendAlkanesCallback, usePrepareSendBTCCallback, usePrepareSendBypassHeadOffsetsCallback, usePrepareSendOrdinalsInscriptionCallback, usePrepareSendOrdinalsInscriptionsCallback, usePrepareSendRunesCallback, usePrice, usePushBitcoinTxCallback, usePushOrdinalsTxCallback, useReadApp, useReadTab, useReloadAccounts, useResetUiTxCreateScreen, useRunesMarketPlaceWebsite, useRunesTx, useSafeBalance, useSetCurrentAccountCallback, useSetDeveloperModeCallback, useSetSpendUnavailableUtxosCallback, useSetTabCallback, useSettingsState, useSkipVersionCallback, useSpendUnavailableUtxos, useSupportedAssets, useTab, useTransactionsState, useTxExplorerUrl, useUIState, useUiTxCreateScreen, useUnisatWebsite, useUnlockCallback, useUnreadAppSummary, useUpdateUiTxCreateScreen, useUtxoTools, useUtxos, useVersionInfo, useWallet, useWalletConfig };
package/lib/index.js CHANGED
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var reduxLocalstorageSimple = require('redux-localstorage-simple');
6
6
  var toolkit = require('@reduxjs/toolkit');
7
- var react$1 = require('@reduxjs/toolkit/query/react');
7
+ var index_js = require('@reduxjs/toolkit/dist/query/react/index.js');
8
8
  var walletTypes = require('@unisat/wallet-types');
9
9
  var walletShared = require('@unisat/wallet-shared');
10
10
  var log = require('loglevel');
@@ -14,8 +14,8 @@ var jsxRuntime = require('react/jsx-runtime');
14
14
  var compareVersions = require('compare-versions');
15
15
  var i18n$1 = require('i18next');
16
16
  var reactI18next = require('react-i18next');
17
- var types = require('@unisat/babylon-service/types');
18
- require('@unisat/keyring-service/types');
17
+ var types$1 = require('@unisat/babylon-service/types');
18
+ var types = require('@unisat/keyring-service/types');
19
19
  var reactRedux = require('react-redux');
20
20
  var reactRouterDom = require('react-router-dom');
21
21
  var baseUtils = require('@unisat/base-utils');
@@ -271,7 +271,7 @@ var slice2 = toolkit.createSlice({
271
271
  }
272
272
  }
273
273
  });
274
- slice2.actions;
274
+ var discoveryActions = slice2.actions;
275
275
  var discovery_default = slice2.reducer;
276
276
  var initialState3 = {
277
277
  tab: "home",
@@ -517,6 +517,41 @@ var slice6 = toolkit.createSlice({
517
517
  });
518
518
  var transactionsActions = slice6.actions;
519
519
  var transactions_default = slice6.reducer;
520
+
521
+ // src/types/ui.ts
522
+ var AssetTabKey = /* @__PURE__ */ ((AssetTabKey2) => {
523
+ AssetTabKey2[AssetTabKey2["ORDINALS"] = 0] = "ORDINALS";
524
+ AssetTabKey2[AssetTabKey2["ATOMICALS"] = 1] = "ATOMICALS";
525
+ AssetTabKey2[AssetTabKey2["RUNES"] = 2] = "RUNES";
526
+ AssetTabKey2[AssetTabKey2["CAT"] = 3] = "CAT";
527
+ AssetTabKey2[AssetTabKey2["ALKANES"] = 4] = "ALKANES";
528
+ return AssetTabKey2;
529
+ })(AssetTabKey || {});
530
+ var OrdinalsAssetTabKey = /* @__PURE__ */ ((OrdinalsAssetTabKey2) => {
531
+ OrdinalsAssetTabKey2[OrdinalsAssetTabKey2["ALL"] = 0] = "ALL";
532
+ OrdinalsAssetTabKey2[OrdinalsAssetTabKey2["BRC20"] = 1] = "BRC20";
533
+ OrdinalsAssetTabKey2[OrdinalsAssetTabKey2["BRC20_6BYTE"] = 2] = "BRC20_6BYTE";
534
+ return OrdinalsAssetTabKey2;
535
+ })(OrdinalsAssetTabKey || {});
536
+ var CATAssetTabKey = /* @__PURE__ */ ((CATAssetTabKey2) => {
537
+ CATAssetTabKey2[CATAssetTabKey2["CAT20"] = 0] = "CAT20";
538
+ CATAssetTabKey2[CATAssetTabKey2["CAT721"] = 1] = "CAT721";
539
+ CATAssetTabKey2[CATAssetTabKey2["CAT20_V2"] = 2] = "CAT20_V2";
540
+ CATAssetTabKey2[CATAssetTabKey2["CAT721_V2"] = 3] = "CAT721_V2";
541
+ return CATAssetTabKey2;
542
+ })(CATAssetTabKey || {});
543
+ var AlkanesAssetTabKey = /* @__PURE__ */ ((AlkanesAssetTabKey2) => {
544
+ AlkanesAssetTabKey2[AlkanesAssetTabKey2["TOKEN"] = 0] = "TOKEN";
545
+ AlkanesAssetTabKey2[AlkanesAssetTabKey2["COLLECTION"] = 1] = "COLLECTION";
546
+ return AlkanesAssetTabKey2;
547
+ })(AlkanesAssetTabKey || {});
548
+ var NavigationSource = /* @__PURE__ */ ((NavigationSource2) => {
549
+ NavigationSource2[NavigationSource2["BACK"] = 0] = "BACK";
550
+ NavigationSource2[NavigationSource2["NORMAL"] = 1] = "NORMAL";
551
+ return NavigationSource2;
552
+ })(NavigationSource || {});
553
+
554
+ // src/reducers/ui.ts
520
555
  var initialState7 = {
521
556
  assetTabKey: 0 /* ORDINALS */,
522
557
  ordinalsAssetTabKey: 0 /* ALL */,
@@ -843,6 +878,10 @@ function useCurrentAddress() {
843
878
  const accountsState = useAccountsState();
844
879
  return accountsState.current.address;
845
880
  }
881
+ function useAccounts() {
882
+ const accountsState = useAccountsState();
883
+ return accountsState.accounts;
884
+ }
846
885
  function useAccountBalance() {
847
886
  const accountsState = useAccountsState();
848
887
  const currentAccount = useCurrentAccount();
@@ -852,10 +891,109 @@ function useAccountBalance() {
852
891
  totalBalance: 0
853
892
  };
854
893
  }
894
+ function useAddressSummary() {
895
+ const accountsState = useAccountsState();
896
+ return accountsState.addressSummary;
897
+ }
898
+ function useAccountInscriptions() {
899
+ const accountsState = useAccountsState();
900
+ const currentAccount = useCurrentAccount();
901
+ return accountsState.inscriptionsMap[currentAccount.address] || { list: [], expired: true };
902
+ }
903
+ function useInscriptionSummary() {
904
+ const accountsState = useAccountsState();
905
+ return accountsState.inscriptionSummary;
906
+ }
907
+ function useAppSummary() {
908
+ const accountsState = useAccountsState();
909
+ return accountsState.appSummary;
910
+ }
911
+ function useUnreadAppSummary() {
912
+ const accountsState = useAccountsState();
913
+ const summary = accountsState.appSummary;
914
+ return summary.apps.find((w) => w.time && summary.readTabTime && w.time > summary.readTabTime);
915
+ }
916
+ function useReadTab() {
917
+ const wallet = useWallet();
918
+ const dispatch = useAppDispatch();
919
+ const appSummary = useAppSummary();
920
+ return react.useCallback(
921
+ async (name) => {
922
+ await wallet.readTab(name);
923
+ if (name == "app") {
924
+ const appSummary2 = await wallet.getAppSummary();
925
+ dispatch(accountActions["setAppSummary"](appSummary2));
926
+ }
927
+ },
928
+ [dispatch, wallet, appSummary]
929
+ );
930
+ }
931
+ function useReadApp() {
932
+ const wallet = useWallet();
933
+ const dispatch = useAppDispatch();
934
+ const appSummary = useAppSummary();
935
+ return react.useCallback(
936
+ async (id) => {
937
+ await wallet.readApp(id);
938
+ const appSummary2 = await wallet.getAppSummary();
939
+ dispatch(accountActions["setAppSummary"](appSummary2));
940
+ },
941
+ [dispatch, wallet, appSummary]
942
+ );
943
+ }
944
+ function useHistory() {
945
+ const accountsState = useAccountsState();
946
+ const address = useAccountAddress();
947
+ return accountsState.historyMap[address] || { list: [], expired: true };
948
+ }
855
949
  function useAccountAddress() {
856
950
  const currentAccount = useCurrentAccount();
857
951
  return currentAccount.address;
858
952
  }
953
+ function useSetCurrentAccountCallback() {
954
+ const dispatch = useAppDispatch();
955
+ return react.useCallback(
956
+ (account) => {
957
+ dispatch(accountActions["setCurrent"](account));
958
+ },
959
+ [dispatch]
960
+ );
961
+ }
962
+ function useImportAccountCallback() {
963
+ const wallet = useWallet();
964
+ const dispatch = useAppDispatch();
965
+ const currentKeyring = useCurrentKeyring();
966
+ return react.useCallback(
967
+ async (privateKey, addressType) => {
968
+ let success = false;
969
+ let error;
970
+ try {
971
+ const alianName = await wallet.getNextAlianName(currentKeyring);
972
+ await wallet.createKeyringWithPrivateKey(privateKey, addressType, alianName);
973
+ const currentAccount = await wallet.getCurrentAccount();
974
+ dispatch(accountActions["setCurrent"](currentAccount));
975
+ success = true;
976
+ } catch (e) {
977
+ console.log(e);
978
+ error = e.message;
979
+ }
980
+ return { success, error };
981
+ },
982
+ [dispatch, wallet, currentKeyring]
983
+ );
984
+ }
985
+ function useChangeAddressFlagCallback() {
986
+ const dispatch = useAppDispatch();
987
+ const wallet = useWallet();
988
+ const currentAccount = useCurrentAccount();
989
+ return react.useCallback(
990
+ async (isAdd, flag) => {
991
+ const account = isAdd ? await wallet.addAddressFlag(currentAccount, flag) : await wallet.removeAddressFlag(currentAccount, flag);
992
+ dispatch(accountActions["setCurrentAddressFlag"](account.flag));
993
+ },
994
+ [dispatch, wallet, currentAccount]
995
+ );
996
+ }
859
997
  function useFetchBalanceCallback() {
860
998
  const dispatch = useAppDispatch();
861
999
  const wallet = useWallet();
@@ -895,6 +1033,10 @@ function useReloadAccounts() {
895
1033
  });
896
1034
  }, [dispatch, wallet]);
897
1035
  }
1036
+ function useIsKeystoneWallet() {
1037
+ const currentKeyring = useCurrentKeyring();
1038
+ return currentKeyring.type === types.KeyringType.KeystoneKeyring;
1039
+ }
898
1040
 
899
1041
  // src/hooks/settings.ts
900
1042
  function useSettingsState() {
@@ -1138,7 +1280,7 @@ function useCAT20MarketPlaceWebsite(tokenId) {
1138
1280
  }
1139
1281
  function useBabylonConfig() {
1140
1282
  const chainType = useChainType();
1141
- return types.BABYLON_CONFIG_MAP[chainType] || types.BABYLON_CONFIG_MAP[walletTypes.ChainType.BITCOIN_MAINNET];
1283
+ return types$1.BABYLON_CONFIG_MAP[chainType] || types$1.BABYLON_CONFIG_MAP[walletTypes.ChainType.BITCOIN_MAINNET];
1142
1284
  }
1143
1285
  function useIsMainnetChain() {
1144
1286
  const chainType = useChainType();
@@ -1983,6 +2125,10 @@ var useUtxoTools = (chain) => {
1983
2125
  openUtxoTools
1984
2126
  };
1985
2127
  };
2128
+ function useLocationState() {
2129
+ const { state } = reactRouterDom.useLocation();
2130
+ return state;
2131
+ }
1986
2132
 
1987
2133
  // src/utils/eventBus.ts
1988
2134
  var EventBus = class {
@@ -2122,28 +2268,50 @@ var store = toolkit.configureStore({
2122
2268
  ui: ui_default,
2123
2269
  discovery: discovery_default
2124
2270
  },
2125
- middleware: (getDefaultMiddleware) => getDefaultMiddleware({ thunk: true }).concat(reduxLocalstorageSimple.save({ states: PERSISTED_KEYS, debounce: 1e3 })),
2271
+ middleware: (getDefaultMiddleware) => (
2272
+ // @ts-ignore
2273
+ getDefaultMiddleware({ thunk: true }).concat(reduxLocalstorageSimple.save({ states: PERSISTED_KEYS, debounce: 1e3 }))
2274
+ ),
2126
2275
  preloadedState: reduxLocalstorageSimple.load({ states: PERSISTED_KEYS, disableWarnings: true })
2127
2276
  });
2128
2277
  store.dispatch(updateVersion());
2129
- react$1.setupListeners(store.dispatch);
2278
+ index_js.setupListeners(store.dispatch);
2130
2279
  var src_default = store;
2131
2280
 
2132
2281
  exports.AccountUpdater = AccountUpdater;
2282
+ exports.AlkanesAssetTabKey = AlkanesAssetTabKey;
2283
+ exports.AssetTabKey = AssetTabKey;
2284
+ exports.CATAssetTabKey = CATAssetTabKey;
2133
2285
  exports.I18nProvider = I18nProvider;
2286
+ exports.NavigationSource = NavigationSource;
2287
+ exports.OrdinalsAssetTabKey = OrdinalsAssetTabKey;
2134
2288
  exports.PriceProvider = PriceProvider;
2135
2289
  exports.WalletProvider = WalletProvider;
2290
+ exports.accountActions = accountActions;
2136
2291
  exports.default = src_default;
2292
+ exports.discoveryActions = discoveryActions;
2137
2293
  exports.getAddressTips = getAddressTips;
2138
2294
  exports.getCurrentLocale = getCurrentLocale;
2139
2295
  exports.getSpecialLocale = getSpecialLocale;
2140
2296
  exports.getUiType = getUiType;
2297
+ exports.globalActions = globalActions;
2298
+ exports.keyringsActions = keyringsActions;
2299
+ exports.settingsActions = settingsActions;
2300
+ exports.transactionsActions = transactionsActions;
2301
+ exports.uiActions = uiActions;
2302
+ exports.useAccountAddress = useAccountAddress;
2303
+ exports.useAccountBalance = useAccountBalance;
2304
+ exports.useAccountInscriptions = useAccountInscriptions;
2305
+ exports.useAccounts = useAccounts;
2306
+ exports.useAccountsState = useAccountsState;
2141
2307
  exports.useAddressExplorerUrl = useAddressExplorerUrl;
2308
+ exports.useAddressSummary = useAddressSummary;
2142
2309
  exports.useAddressTips = useAddressTips;
2143
2310
  exports.useAlkanesAssetTabKey = useAlkanesAssetTabKey;
2144
2311
  exports.useAppDispatch = useAppDispatch;
2145
2312
  exports.useAppList = useAppList;
2146
2313
  exports.useAppSelector = useAppSelector;
2314
+ exports.useAppSummary = useAppSummary;
2147
2315
  exports.useApproval = useApproval;
2148
2316
  exports.useAssetTabKey = useAssetTabKey;
2149
2317
  exports.useAssetUtxosRunes = useAssetUtxosRunes;
@@ -2160,23 +2328,31 @@ exports.useCAT721NFTContentBaseUrl = useCAT721NFTContentBaseUrl;
2160
2328
  exports.useCATAssetTabKey = useCATAssetTabKey;
2161
2329
  exports.useChain = useChain;
2162
2330
  exports.useChainType = useChainType;
2331
+ exports.useChangeAddressFlagCallback = useChangeAddressFlagCallback;
2163
2332
  exports.useChangeChainTypeCallback = useChangeChainTypeCallback;
2164
2333
  exports.useChangeLocaleCallback = useChangeLocaleCallback;
2165
2334
  exports.useChangeNetworkTypeCallback = useChangeNetworkTypeCallback;
2166
2335
  exports.useCreateAccountCallback = useCreateAccountCallback;
2167
2336
  exports.useCreateColdWalletCallback = useCreateColdWalletCallback;
2168
2337
  exports.useCreateSplitTxCallback = useCreateSplitTxCallback;
2338
+ exports.useCurrentAccount = useCurrentAccount;
2339
+ exports.useCurrentAddress = useCurrentAddress;
2169
2340
  exports.useCurrentKeyring = useCurrentKeyring;
2170
2341
  exports.useDeveloperMode = useDeveloperMode;
2171
2342
  exports.useDiscoveryState = useDiscoveryState;
2172
2343
  exports.useFetchAssetUtxosRunesCallback = useFetchAssetUtxosRunesCallback;
2344
+ exports.useFetchBalanceCallback = useFetchBalanceCallback;
2173
2345
  exports.useFetchUtxosCallback = useFetchUtxosCallback;
2174
2346
  exports.useGetTxExplorerUrlCallback = useGetTxExplorerUrlCallback;
2175
2347
  exports.useGlobalState = useGlobalState;
2176
2348
  exports.useHasNewBanner = useHasNewBanner;
2349
+ exports.useHistory = useHistory;
2177
2350
  exports.useI18n = useI18n;
2351
+ exports.useImportAccountCallback = useImportAccountCallback;
2178
2352
  exports.useImportAccountsFromKeystoneCallback = useImportAccountsFromKeystoneCallback;
2353
+ exports.useInscriptionSummary = useInscriptionSummary;
2179
2354
  exports.useIsInExpandView = useIsInExpandView;
2355
+ exports.useIsKeystoneWallet = useIsKeystoneWallet;
2180
2356
  exports.useIsMainnetChain = useIsMainnetChain;
2181
2357
  exports.useIsReady = useIsReady;
2182
2358
  exports.useIsUnlocked = useIsUnlocked;
@@ -2184,6 +2360,7 @@ exports.useKeyrings = useKeyrings;
2184
2360
  exports.useKeyringsState = useKeyringsState;
2185
2361
  exports.useLastFetchInfo = useLastFetchInfo;
2186
2362
  exports.useLocale = useLocale;
2363
+ exports.useLocationState = useLocationState;
2187
2364
  exports.useNetworkType = useNetworkType;
2188
2365
  exports.useOrdinalsAssetTabKey = useOrdinalsAssetTabKey;
2189
2366
  exports.useOrdinalsTx = useOrdinalsTx;
@@ -2197,10 +2374,14 @@ exports.usePrepareSendRunesCallback = usePrepareSendRunesCallback;
2197
2374
  exports.usePrice = usePrice;
2198
2375
  exports.usePushBitcoinTxCallback = usePushBitcoinTxCallback;
2199
2376
  exports.usePushOrdinalsTxCallback = usePushOrdinalsTxCallback;
2377
+ exports.useReadApp = useReadApp;
2378
+ exports.useReadTab = useReadTab;
2379
+ exports.useReloadAccounts = useReloadAccounts;
2200
2380
  exports.useResetUiTxCreateScreen = useResetUiTxCreateScreen;
2201
2381
  exports.useRunesMarketPlaceWebsite = useRunesMarketPlaceWebsite;
2202
2382
  exports.useRunesTx = useRunesTx;
2203
2383
  exports.useSafeBalance = useSafeBalance;
2384
+ exports.useSetCurrentAccountCallback = useSetCurrentAccountCallback;
2204
2385
  exports.useSetDeveloperModeCallback = useSetDeveloperModeCallback;
2205
2386
  exports.useSetSpendUnavailableUtxosCallback = useSetSpendUnavailableUtxosCallback;
2206
2387
  exports.useSetTabCallback = useSetTabCallback;
@@ -2215,6 +2396,7 @@ exports.useUIState = useUIState;
2215
2396
  exports.useUiTxCreateScreen = useUiTxCreateScreen;
2216
2397
  exports.useUnisatWebsite = useUnisatWebsite;
2217
2398
  exports.useUnlockCallback = useUnlockCallback;
2399
+ exports.useUnreadAppSummary = useUnreadAppSummary;
2218
2400
  exports.useUpdateUiTxCreateScreen = useUpdateUiTxCreateScreen;
2219
2401
  exports.useUtxoTools = useUtxoTools;
2220
2402
  exports.useUtxos = useUtxos;