@unisat/wallet-state 1.0.0 → 1.0.2
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 +934 -0
- package/lib/index.d.ts +934 -0
- package/lib/index.js +2225 -0
- package/lib/index.js.map +1 -0
- package/lib/index.mjs +2124 -0
- package/lib/index.mjs.map +1 -0
- package/package.json +19 -5
- package/src/actions/global.ts +5 -0
- package/src/context/I18nContext.tsx +191 -0
- package/src/context/PriceContext.tsx +81 -0
- package/src/context/WalletContext.tsx +703 -0
- package/src/context/index.ts +3 -0
- package/src/hooks/accounts.ts +23 -21
- package/src/hooks/approval.ts +72 -0
- package/src/hooks/base.ts +6 -0
- package/src/hooks/discovery.ts +29 -0
- package/src/hooks/global.ts +129 -5
- package/src/hooks/i18n.ts +53 -0
- package/src/hooks/index.ts +9 -15
- package/src/hooks/keyrings.ts +14 -5
- package/src/hooks/settings.ts +318 -5
- package/src/hooks/transactions.ts +44 -38
- package/src/hooks/ui.ts +133 -5
- package/src/index.ts +42 -5
- package/src/{slices → reducers}/accounts.ts +12 -12
- package/src/reducers/discovery.ts +73 -0
- package/src/reducers/global.ts +51 -0
- package/src/{slices → reducers}/keyrings.ts +7 -6
- package/src/{slices → reducers}/settings.ts +5 -5
- package/src/{slices → reducers}/transactions.ts +4 -5
- package/src/{slices → reducers}/ui.ts +4 -5
- package/src/updater/accounts.ts +107 -0
- package/src/updater/index.ts +1 -0
- package/src/utils/bitcoin-utils.ts +81 -0
- package/src/utils/eventBus.ts +49 -0
- package/src/utils/i18n.ts +41 -0
- package/src/slices/global.ts +0 -52
- package/src/slices/index.ts +0 -10
- package/src/store/index.ts +0 -43
- package/src/types/index.ts +0 -37
package/src/store/index.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { configureStore } from '@reduxjs/toolkit';
|
|
2
|
-
import type { AppState } from '../types';
|
|
3
|
-
|
|
4
|
-
// Import reducers (to be implemented)
|
|
5
|
-
// import { accountsReducer } from '../slices/accounts';
|
|
6
|
-
// import { transactionsReducer } from '../slices/transactions';
|
|
7
|
-
// import { settingsReducer } from '../slices/settings';
|
|
8
|
-
// import { globalReducer } from '../slices/global';
|
|
9
|
-
// import { keyringsReducer } from '../slices/keyrings';
|
|
10
|
-
// import { uiReducer } from '../slices/ui';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Create store with platform-specific middleware and persistence
|
|
14
|
-
*/
|
|
15
|
-
export function createWalletStore(options?: {
|
|
16
|
-
persistedKeys?: string[];
|
|
17
|
-
middleware?: any[];
|
|
18
|
-
}) {
|
|
19
|
-
return configureStore({
|
|
20
|
-
reducer: {
|
|
21
|
-
// accounts: accountsReducer,
|
|
22
|
-
// transactions: transactionsReducer,
|
|
23
|
-
// settings: settingsReducer,
|
|
24
|
-
// global: globalReducer,
|
|
25
|
-
// keyrings: keyringsReducer,
|
|
26
|
-
// ui: uiReducer,
|
|
27
|
-
},
|
|
28
|
-
middleware: (getDefaultMiddleware) => {
|
|
29
|
-
let middleware = getDefaultMiddleware({ thunk: true });
|
|
30
|
-
|
|
31
|
-
if (options?.middleware) {
|
|
32
|
-
middleware = middleware.concat(options.middleware);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return middleware;
|
|
36
|
-
},
|
|
37
|
-
// Platform-specific preloaded state will be handled by the consuming app
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export type WalletStore = ReturnType<typeof createWalletStore>;
|
|
42
|
-
export type WalletDispatch = WalletStore['dispatch'];
|
|
43
|
-
export type { AppState };
|
package/src/types/index.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
// Redux state types
|
|
2
|
-
export interface AppState {
|
|
3
|
-
accounts: AccountsState;
|
|
4
|
-
transactions: TransactionsState;
|
|
5
|
-
settings: SettingsState;
|
|
6
|
-
global: GlobalState;
|
|
7
|
-
keyrings: KeyringsState;
|
|
8
|
-
ui: UIState;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
// Individual state slice types (to be populated from existing code)
|
|
12
|
-
export interface AccountsState {
|
|
13
|
-
// To be populated with actual account state structure
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface TransactionsState {
|
|
17
|
-
// To be populated with actual transaction state structure
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface SettingsState {
|
|
21
|
-
// To be populated with actual settings state structure
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface GlobalState {
|
|
25
|
-
// To be populated with actual global state structure
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface KeyringsState {
|
|
29
|
-
// To be populated with actual keyrings state structure
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface UIState {
|
|
33
|
-
// To be populated with actual UI state structure
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// Re-export common types
|
|
37
|
-
export * from '@unisat/wallet-types';
|