@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.
Files changed (290) hide show
  1. package/LICENSE +0 -5
  2. package/lib/actions/global.d.ts +2 -0
  3. package/lib/actions/global.d.ts.map +1 -0
  4. package/lib/context/ApprovalContext.d.ts +9 -0
  5. package/lib/context/ApprovalContext.d.ts.map +1 -0
  6. package/lib/context/DeviceContext.d.ts +17 -0
  7. package/lib/context/DeviceContext.d.ts.map +1 -0
  8. package/lib/context/I18nContext.d.ts +13 -0
  9. package/lib/context/I18nContext.d.ts.map +1 -0
  10. package/lib/context/NavigationContext.d.ts +218 -0
  11. package/lib/context/NavigationContext.d.ts.map +1 -0
  12. package/lib/context/PriceContext.d.ts +13 -0
  13. package/lib/context/PriceContext.d.ts.map +1 -0
  14. package/lib/context/StorageContext.d.ts +60 -0
  15. package/lib/context/StorageContext.d.ts.map +1 -0
  16. package/lib/context/ToolsContext.d.ts +17 -0
  17. package/lib/context/ToolsContext.d.ts.map +1 -0
  18. package/lib/context/WalletContext.d.ts +493 -0
  19. package/lib/context/WalletContext.d.ts.map +1 -0
  20. package/lib/context/index.d.ts +9 -0
  21. package/lib/context/index.d.ts.map +1 -0
  22. package/lib/hooks/accounts.d.ts +34 -0
  23. package/lib/hooks/accounts.d.ts.map +1 -0
  24. package/lib/hooks/base.d.ts +14 -0
  25. package/lib/hooks/base.d.ts.map +1 -0
  26. package/lib/hooks/browser.d.ts +32 -0
  27. package/lib/hooks/browser.d.ts.map +1 -0
  28. package/lib/hooks/discovery.d.ts +17 -0
  29. package/lib/hooks/discovery.d.ts.map +1 -0
  30. package/lib/hooks/global.d.ts +43 -0
  31. package/lib/hooks/global.d.ts.map +1 -0
  32. package/lib/hooks/index.d.ts +10 -0
  33. package/lib/hooks/index.d.ts.map +1 -0
  34. package/lib/hooks/keyrings.d.ts +5 -0
  35. package/lib/hooks/keyrings.d.ts.map +1 -0
  36. package/lib/hooks/settings.d.ts +43 -0
  37. package/lib/hooks/settings.d.ts.map +1 -0
  38. package/lib/hooks/transactions.d.ts +67 -0
  39. package/lib/hooks/transactions.d.ts.map +1 -0
  40. package/lib/hooks/ui.d.ts +112 -0
  41. package/lib/hooks/ui.d.ts.map +1 -0
  42. package/lib/index.d.mts +2072 -199
  43. package/lib/index.d.ts +31 -946
  44. package/lib/index.d.ts.map +1 -0
  45. package/lib/index.js +7176 -582
  46. package/lib/index.js.map +1 -1
  47. package/lib/index.mjs +6971 -525
  48. package/lib/index.mjs.map +1 -1
  49. package/lib/reducers/accounts.d.ts +49 -0
  50. package/lib/reducers/accounts.d.ts.map +1 -0
  51. package/lib/reducers/browser.d.ts +49 -0
  52. package/lib/reducers/browser.d.ts.map +1 -0
  53. package/lib/reducers/discovery.d.ts +22 -0
  54. package/lib/reducers/discovery.d.ts.map +1 -0
  55. package/lib/reducers/global.d.ts +35 -0
  56. package/lib/reducers/global.d.ts.map +1 -0
  57. package/lib/reducers/index.d.ts +9 -0
  58. package/lib/reducers/index.d.ts.map +1 -0
  59. package/lib/reducers/keyrings.d.ts +10 -0
  60. package/lib/reducers/keyrings.d.ts.map +1 -0
  61. package/lib/reducers/settings.d.ts +16 -0
  62. package/lib/reducers/settings.d.ts.map +1 -0
  63. package/lib/reducers/transactions.d.ts +61 -0
  64. package/lib/reducers/transactions.d.ts.map +1 -0
  65. package/lib/reducers/ui.d.ts +55 -0
  66. package/lib/reducers/ui.d.ts.map +1 -0
  67. package/lib/types/index.d.mts +7 -3
  68. package/lib/types/index.d.ts +3 -30
  69. package/lib/types/index.d.ts.map +1 -0
  70. package/lib/types/index.js +7 -1
  71. package/lib/types/index.js.map +1 -1
  72. package/lib/types/index.mjs +7 -2
  73. package/lib/types/index.mjs.map +1 -1
  74. package/lib/types/ui.d.ts +31 -0
  75. package/lib/types/ui.d.ts.map +1 -0
  76. package/lib/ui-hooks/index.d.ts +55 -0
  77. package/lib/ui-hooks/index.d.ts.map +1 -0
  78. package/lib/ui-hooks/useActionOverviewSectionLogic.d.ts +12 -0
  79. package/lib/ui-hooks/useActionOverviewSectionLogic.d.ts.map +1 -0
  80. package/lib/ui-hooks/useAddressTypeScreenLogic.d.ts +19 -0
  81. package/lib/ui-hooks/useAddressTypeScreenLogic.d.ts.map +1 -0
  82. package/lib/ui-hooks/useAlkanesBalanceCardLogic.d.ts +19 -0
  83. package/lib/ui-hooks/useAlkanesBalanceCardLogic.d.ts.map +1 -0
  84. package/lib/ui-hooks/useAlkanesCollectionListLogic.d.ts +11 -0
  85. package/lib/ui-hooks/useAlkanesCollectionListLogic.d.ts.map +1 -0
  86. package/lib/ui-hooks/useAlkanesListLogic.d.ts +14 -0
  87. package/lib/ui-hooks/useAlkanesListLogic.d.ts.map +1 -0
  88. package/lib/ui-hooks/useAlkanesNFTListLogic.d.ts +11 -0
  89. package/lib/ui-hooks/useAlkanesNFTListLogic.d.ts.map +1 -0
  90. package/lib/ui-hooks/useAlkanesNFTScreenLogic.d.ts +9 -0
  91. package/lib/ui-hooks/useAlkanesNFTScreenLogic.d.ts.map +1 -0
  92. package/lib/ui-hooks/useAlkanesTokenScreenLogic.d.ts +22 -0
  93. package/lib/ui-hooks/useAlkanesTokenScreenLogic.d.ts.map +1 -0
  94. package/lib/ui-hooks/useAmountInputLogic.d.ts +22 -0
  95. package/lib/ui-hooks/useAmountInputLogic.d.ts.map +1 -0
  96. package/lib/ui-hooks/useAnnouncementCardLogic.d.ts +11 -0
  97. package/lib/ui-hooks/useAnnouncementCardLogic.d.ts.map +1 -0
  98. package/lib/ui-hooks/useBRC20BalanceCardLogic.d.ts +26 -0
  99. package/lib/ui-hooks/useBRC20BalanceCardLogic.d.ts.map +1 -0
  100. package/lib/ui-hooks/useBRC20InscribeTransferLogic.d.ts +103 -0
  101. package/lib/ui-hooks/useBRC20InscribeTransferLogic.d.ts.map +1 -0
  102. package/lib/ui-hooks/useBRC20ListLogic.d.ts +14 -0
  103. package/lib/ui-hooks/useBRC20ListLogic.d.ts.map +1 -0
  104. package/lib/ui-hooks/useBRC20ProgListLogic.d.ts +14 -0
  105. package/lib/ui-hooks/useBRC20ProgListLogic.d.ts.map +1 -0
  106. package/lib/ui-hooks/useBRC20SendScreenLogic.d.ts +67 -0
  107. package/lib/ui-hooks/useBRC20SendScreenLogic.d.ts.map +1 -0
  108. package/lib/ui-hooks/useBRC20SingleStepScreenLogic.d.ts +36 -0
  109. package/lib/ui-hooks/useBRC20SingleStepScreenLogic.d.ts.map +1 -0
  110. package/lib/ui-hooks/useBRC20TokenScreenLogic.d.ts +75 -0
  111. package/lib/ui-hooks/useBRC20TokenScreenLogic.d.ts.map +1 -0
  112. package/lib/ui-hooks/useBalanceCardLogic.d.ts +26 -0
  113. package/lib/ui-hooks/useBalanceCardLogic.d.ts.map +1 -0
  114. package/lib/ui-hooks/useBtcDisplayLogic.d.ts +5 -0
  115. package/lib/ui-hooks/useBtcDisplayLogic.d.ts.map +1 -0
  116. package/lib/ui-hooks/useCAT20BalanceCardLogic.d.ts +20 -0
  117. package/lib/ui-hooks/useCAT20BalanceCardLogic.d.ts.map +1 -0
  118. package/lib/ui-hooks/useCAT20ListLogic.d.ts +14 -0
  119. package/lib/ui-hooks/useCAT20ListLogic.d.ts.map +1 -0
  120. package/lib/ui-hooks/useCAT20TokenScreenLogic.d.ts +19 -0
  121. package/lib/ui-hooks/useCAT20TokenScreenLogic.d.ts.map +1 -0
  122. package/lib/ui-hooks/useCAT721ListLogic.d.ts +11 -0
  123. package/lib/ui-hooks/useCAT721ListLogic.d.ts.map +1 -0
  124. package/lib/ui-hooks/useCAT721NFTScreenLogic.d.ts +9 -0
  125. package/lib/ui-hooks/useCAT721NFTScreenLogic.d.ts.map +1 -0
  126. package/lib/ui-hooks/useCreatePasswordScreenLogic.d.ts +27 -0
  127. package/lib/ui-hooks/useCreatePasswordScreenLogic.d.ts.map +1 -0
  128. package/lib/ui-hooks/useCreateWalletLogicImportWordsStep.d.ts +78 -0
  129. package/lib/ui-hooks/useCreateWalletLogicImportWordsStep.d.ts.map +1 -0
  130. package/lib/ui-hooks/useEditAccountNameScreenLogic.d.ts +18 -0
  131. package/lib/ui-hooks/useEditAccountNameScreenLogic.d.ts.map +1 -0
  132. package/lib/ui-hooks/useEditContactScreenLogic.d.ts +24 -0
  133. package/lib/ui-hooks/useEditContactScreenLogic.d.ts.map +1 -0
  134. package/lib/ui-hooks/useEditWalletNameScreenLogic.d.ts +15 -0
  135. package/lib/ui-hooks/useEditWalletNameScreenLogic.d.ts.map +1 -0
  136. package/lib/ui-hooks/useExportMnemonicsScreenLogic.d.ts +18 -0
  137. package/lib/ui-hooks/useExportMnemonicsScreenLogic.d.ts.map +1 -0
  138. package/lib/ui-hooks/useExportPrivateKeyScreenLogic.d.ts +17 -0
  139. package/lib/ui-hooks/useExportPrivateKeyScreenLogic.d.ts.map +1 -0
  140. package/lib/ui-hooks/useFeeRateBarLogic.d.ts +34 -0
  141. package/lib/ui-hooks/useFeeRateBarLogic.d.ts.map +1 -0
  142. package/lib/ui-hooks/useInfiniteList.d.ts +19 -0
  143. package/lib/ui-hooks/useInfiniteList.d.ts.map +1 -0
  144. package/lib/ui-hooks/useInscriptionListLogic.d.ts +11 -0
  145. package/lib/ui-hooks/useInscriptionListLogic.d.ts.map +1 -0
  146. package/lib/ui-hooks/useLockTimePageLogic.d.ts +11 -0
  147. package/lib/ui-hooks/useLockTimePageLogic.d.ts.map +1 -0
  148. package/lib/ui-hooks/useNotificationsLogic.d.ts +14 -0
  149. package/lib/ui-hooks/useNotificationsLogic.d.ts.map +1 -0
  150. package/lib/ui-hooks/useOrdinalsInscriptionScreenLogic.d.ts +27 -0
  151. package/lib/ui-hooks/useOrdinalsInscriptionScreenLogic.d.ts.map +1 -0
  152. package/lib/ui-hooks/useRunesBalanceCardLogic.d.ts +19 -0
  153. package/lib/ui-hooks/useRunesBalanceCardLogic.d.ts.map +1 -0
  154. package/lib/ui-hooks/useRunesListLogic.d.ts +14 -0
  155. package/lib/ui-hooks/useRunesListLogic.d.ts.map +1 -0
  156. package/lib/ui-hooks/useRunesTokenScreenLogic.d.ts +22 -0
  157. package/lib/ui-hooks/useRunesTokenScreenLogic.d.ts.map +1 -0
  158. package/lib/ui-hooks/useSecurityCardLogic.d.ts +1 -0
  159. package/lib/ui-hooks/useSecurityCardLogic.d.ts.map +1 -0
  160. package/lib/ui-hooks/useSendAlkanesNFTScreenLogic.d.ts +32 -0
  161. package/lib/ui-hooks/useSendAlkanesNFTScreenLogic.d.ts.map +1 -0
  162. package/lib/ui-hooks/useSendAlkanesScreenLogic.d.ts +37 -0
  163. package/lib/ui-hooks/useSendAlkanesScreenLogic.d.ts.map +1 -0
  164. package/lib/ui-hooks/useSendCAT20ScreenLogic.d.ts +44 -0
  165. package/lib/ui-hooks/useSendCAT20ScreenLogic.d.ts.map +1 -0
  166. package/lib/ui-hooks/useSendCAT721ScreenLogic.d.ts +40 -0
  167. package/lib/ui-hooks/useSendCAT721ScreenLogic.d.ts.map +1 -0
  168. package/lib/ui-hooks/useSendOrdinalsInscriptionScreenLogic.d.ts +22 -0
  169. package/lib/ui-hooks/useSendOrdinalsInscriptionScreenLogic.d.ts.map +1 -0
  170. package/lib/ui-hooks/useSendRunesScreenLogic.d.ts +30 -0
  171. package/lib/ui-hooks/useSendRunesScreenLogic.d.ts.map +1 -0
  172. package/lib/ui-hooks/useSettingsTabScreenLogic.d.ts +72 -0
  173. package/lib/ui-hooks/useSettingsTabScreenLogic.d.ts.map +1 -0
  174. package/lib/ui-hooks/useSignMessageLogic.d.ts +54 -0
  175. package/lib/ui-hooks/useSignMessageLogic.d.ts.map +1 -0
  176. package/lib/ui-hooks/useSignPsbtLogic.d.ts +82 -0
  177. package/lib/ui-hooks/useSignPsbtLogic.d.ts.map +1 -0
  178. package/lib/ui-hooks/useSplitOrdinalsInscriptionScreenLogic.d.ts +15 -0
  179. package/lib/ui-hooks/useSplitOrdinalsInscriptionScreenLogic.d.ts.map +1 -0
  180. package/lib/ui-hooks/useTxConfirmScreenLogic.d.ts +8 -0
  181. package/lib/ui-hooks/useTxConfirmScreenLogic.d.ts.map +1 -0
  182. package/lib/ui-hooks/useTxCreateScreenLogic.d.ts +28 -0
  183. package/lib/ui-hooks/useTxCreateScreenLogic.d.ts.map +1 -0
  184. package/lib/ui-hooks/useTxFailScreenLogic.d.ts +7 -0
  185. package/lib/ui-hooks/useTxFailScreenLogic.d.ts.map +1 -0
  186. package/lib/ui-hooks/useTxSuccessScreenLogic.d.ts +8 -0
  187. package/lib/ui-hooks/useTxSuccessScreenLogic.d.ts.map +1 -0
  188. package/lib/updater/accounts.d.ts +2 -0
  189. package/lib/updater/accounts.d.ts.map +1 -0
  190. package/lib/updater/index.d.ts +2 -0
  191. package/lib/updater/index.d.ts.map +1 -0
  192. package/lib/utils/bitcoin-utils.d.ts +7 -0
  193. package/lib/utils/bitcoin-utils.d.ts.map +1 -0
  194. package/lib/utils/eventBus.d.ts +12 -0
  195. package/lib/utils/eventBus.d.ts.map +1 -0
  196. package/lib/utils/password-utils.d.ts +12 -0
  197. package/lib/utils/password-utils.d.ts.map +1 -0
  198. package/lib/utils/ui-utils.d.ts +4 -0
  199. package/lib/utils/ui-utils.d.ts.map +1 -0
  200. package/package.json +19 -15
  201. package/src/.DS_Store +0 -0
  202. package/src/context/ApprovalContext.tsx +27 -0
  203. package/src/context/DeviceContext.tsx +36 -0
  204. package/src/context/I18nContext.tsx +14 -172
  205. package/src/context/NavigationContext.tsx +305 -0
  206. package/src/context/PriceContext.tsx +2 -2
  207. package/src/context/StorageContext.tsx +393 -0
  208. package/src/context/ToolsContext.tsx +50 -0
  209. package/src/context/WalletContext.tsx +170 -126
  210. package/src/context/index.ts +17 -2
  211. package/src/hooks/accounts.ts +11 -5
  212. package/src/hooks/browser.ts +11 -0
  213. package/src/hooks/global.ts +170 -7
  214. package/src/hooks/index.ts +1 -2
  215. package/src/hooks/settings.ts +38 -37
  216. package/src/hooks/transactions.ts +45 -151
  217. package/src/hooks/ui.ts +239 -35
  218. package/src/index.ts +33 -24
  219. package/src/reducers/accounts.ts +22 -2
  220. package/src/reducers/browser.ts +223 -0
  221. package/src/reducers/global.ts +67 -1
  222. package/src/reducers/index.ts +1 -0
  223. package/src/reducers/transactions.ts +0 -9
  224. package/src/reducers/ui.ts +144 -4
  225. package/src/types/index.ts +1 -1
  226. package/src/types/ui.ts +6 -1
  227. package/src/ui-hooks/index.ts +107 -0
  228. package/src/ui-hooks/useActionOverviewSectionLogic.ts +150 -0
  229. package/src/ui-hooks/useAddressTypeScreenLogic.ts +160 -0
  230. package/src/ui-hooks/useAlkanesBalanceCardLogic.ts +41 -0
  231. package/src/ui-hooks/useAlkanesCollectionListLogic.ts +68 -0
  232. package/src/ui-hooks/useAlkanesListLogic.ts +69 -0
  233. package/src/ui-hooks/useAlkanesNFTListLogic.ts +42 -0
  234. package/src/ui-hooks/useAlkanesNFTScreenLogic.ts +45 -0
  235. package/src/ui-hooks/useAlkanesTokenScreenLogic.ts +138 -0
  236. package/src/ui-hooks/useAmountInputLogic.ts +80 -0
  237. package/src/ui-hooks/useAnnouncementCardLogic.ts +91 -0
  238. package/src/ui-hooks/useBRC20BalanceCardLogic.ts +115 -0
  239. package/src/ui-hooks/useBRC20InscribeTransferLogic.ts +418 -0
  240. package/src/ui-hooks/useBRC20ListLogic.ts +79 -0
  241. package/src/ui-hooks/useBRC20ProgListLogic.ts +81 -0
  242. package/src/ui-hooks/useBRC20SendScreenLogic.ts +424 -0
  243. package/src/ui-hooks/useBRC20SingleStepScreenLogic.ts +208 -0
  244. package/src/ui-hooks/useBRC20TokenScreenLogic.ts +489 -0
  245. package/src/ui-hooks/useBalanceCardLogic.ts +164 -0
  246. package/src/ui-hooks/useBtcDisplayLogic.ts +16 -0
  247. package/src/ui-hooks/useCAT20BalanceCardLogic.ts +35 -0
  248. package/src/ui-hooks/useCAT20ListLogic.ts +83 -0
  249. package/src/ui-hooks/useCAT20TokenScreenLogic.ts +127 -0
  250. package/src/ui-hooks/useCAT721ListLogic.ts +68 -0
  251. package/src/ui-hooks/useCAT721NFTScreenLogic.ts +37 -0
  252. package/src/ui-hooks/useCreatePasswordScreenLogic.ts +92 -0
  253. package/src/ui-hooks/useCreateWalletLogicImportWordsStep.ts +299 -0
  254. package/src/ui-hooks/useEditAccountNameScreenLogic.ts +71 -0
  255. package/src/ui-hooks/useEditContactScreenLogic.ts +162 -0
  256. package/src/ui-hooks/useEditWalletNameScreenLogic.ts +60 -0
  257. package/src/ui-hooks/useExportMnemonicsScreenLogic.ts +75 -0
  258. package/src/ui-hooks/useExportPrivateKeyScreenLogic.ts +64 -0
  259. package/src/ui-hooks/useFeeRateBarLogic.ts +303 -0
  260. package/src/ui-hooks/useInfiniteList.ts +85 -0
  261. package/src/ui-hooks/useInscriptionListLogic.ts +68 -0
  262. package/src/ui-hooks/useLockTimePageLogic.ts +43 -0
  263. package/src/ui-hooks/useNotificationsLogic.ts +115 -0
  264. package/src/ui-hooks/useOrdinalsInscriptionScreenLogic.ts +130 -0
  265. package/src/ui-hooks/useRunesBalanceCardLogic.ts +44 -0
  266. package/src/ui-hooks/useRunesListLogic.ts +74 -0
  267. package/src/ui-hooks/useRunesTokenScreenLogic.ts +156 -0
  268. package/src/ui-hooks/useSecurityCardLogic.ts +0 -0
  269. package/src/ui-hooks/useSendAlkanesNFTScreenLogic.ts +160 -0
  270. package/src/ui-hooks/useSendAlkanesScreenLogic.ts +208 -0
  271. package/src/ui-hooks/useSendCAT20ScreenLogic.ts +297 -0
  272. package/src/ui-hooks/useSendCAT721ScreenLogic.ts +205 -0
  273. package/src/ui-hooks/useSendOrdinalsInscriptionScreenLogic.ts +152 -0
  274. package/src/ui-hooks/useSendRunesScreenLogic.ts +189 -0
  275. package/src/ui-hooks/useSettingsTabScreenLogic.ts +211 -0
  276. package/src/ui-hooks/useSignMessageLogic.ts +302 -0
  277. package/src/ui-hooks/useSignPsbtLogic.ts +517 -0
  278. package/src/ui-hooks/useSplitOrdinalsInscriptionScreenLogic.ts +109 -0
  279. package/src/ui-hooks/useTxConfirmScreenLogic.ts +47 -0
  280. package/src/ui-hooks/useTxCreateScreenLogic.ts +177 -0
  281. package/src/ui-hooks/useTxFailScreenLogic.ts +26 -0
  282. package/src/ui-hooks/useTxSuccessScreenLogic.ts +33 -0
  283. package/src/updater/accounts.ts +11 -11
  284. package/src/utils/bitcoin-utils.ts +17 -8
  285. package/src/utils/eventBus.ts +2 -1
  286. package/src/utils/password-utils.ts +78 -0
  287. package/src/utils/ui-utils.ts +28 -0
  288. package/src/hooks/approval.ts +0 -72
  289. package/src/hooks/i18n.ts +0 -53
  290. package/src/utils/i18n.ts +0 -41
@@ -1,4 +1,6 @@
1
- import { createContext, ReactNode, useContext } from 'react'
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<void>
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
- signPsbtWithHex(
204
- psbtHex: string,
205
- toSignInputs: ToSignInput[],
206
- autoFinalized: boolean
207
- ): Promise<string>
238
+ signPsbtV2(toSignData: ToSignData): Promise<SignedData>
239
+
240
+ signMessage(params: ToSignMessage): Promise<SignedMessage>
208
241
 
209
- sendBTC(data: {
242
+ createSendBTCPsbt(data: {
210
243
  to: string
211
244
  amount: number
212
245
  btcUtxos: UnspentOutput[]
213
246
  feeRate: number
214
- enableRBF: boolean
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
- sendAllBTC(data: {
252
+ createSendAllBTCPsbt(data: {
224
253
  to: string
225
254
  btcUtxos: UnspentOutput[]
226
255
  feeRate: number
227
- enableRBF: boolean
228
- }): Promise<{
229
- psbtHex: string
230
- rawtx: string
231
- fee: number
232
- }>
256
+ enableRBF?: boolean
257
+ }): Promise<ToSignData>
233
258
 
234
- sendOrdinalsInscription(data: {
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
- }): Promise<{
242
- psbtHex: string
243
- rawtx: string
244
- fee: number
245
- }>
265
+ enableRBF?: boolean
266
+ }): Promise<ToSignData>
246
267
 
247
- sendOrdinalsInscriptions(data: {
268
+ createSendMultipleInscriptionsPsbt(data: {
248
269
  to: string
249
270
  inscriptionIds: string[]
250
271
  feeRate: number
251
- enableRBF: boolean
252
272
  btcUtxos: UnspentOutput[]
253
- }): Promise<{
254
- psbtHex: string
255
- rawtx: string
256
- fee: number
257
- }>
273
+ enableRBF?: boolean
274
+ }): Promise<ToSignData>
258
275
 
259
- splitOrdinalsInscription(data: {
276
+ createSplitInscriptionPsbt(data: {
260
277
  inscriptionId: string
261
278
  feeRate: number
262
279
  outputValue: number
263
- enableRBF: boolean
264
280
  btcUtxos: UnspentOutput[]
265
- }): Promise<{
266
- psbtHex: string
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: string,
334
- currentPage: number,
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: string,
340
- currentPage: number,
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: string,
346
- ticker: string,
347
- currentPage: number,
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(address: string, ticker: string): Promise<AddressTokenSummary>
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
- sendRunes(data: {
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
- }): Promise<{
442
- psbtHex: string
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; commitTx: string; toSignInputs: UserToSignInput[]; feeRate: number }>
511
+ ): Promise<{ id: string; feeRate: number; toSignData: ToSignData }>
479
512
  transferCAT20Step2(
480
513
  version: 'v1' | 'v2',
481
514
  transferId: string,
482
- commitTx: string,
483
- toSignInputs: UserToSignInput[]
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
- revealTx: string,
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; commitTx: string; toSignInputs: UserToSignInput[]; feeRate: number }>
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; commitTx: string; toSignInputs: UserToSignInput[]; feeRate: number }>
559
+ ): Promise<{ id: string; feeRate: number; toSignData: ToSignData }>
528
560
  transferCAT721Step2(
529
561
  version: 'v1' | 'v2',
530
562
  transferId: string,
531
- commitTx: string,
532
- toSignInputs: UserToSignInput[]
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
- revealTx: string,
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
- psbtHex: string
597
- toSignInputs: UserToSignInput[]
626
+ toSignData: ToSignData
598
627
  }>
599
628
 
600
- singleStepTransferBRC20Step2(params: {
601
- orderId: string
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
- sendCoinBypassHeadOffsets(
643
+ createSendBTCOffsetPsbt(
621
644
  tos: { address: string; satoshis: number }[],
622
- feeRate: number
623
- ): Promise<{
624
- psbtHex: string
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
- createAlkanesSendTx(params: {
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
- enableRBF: boolean
666
- }): Promise<string>
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 { useWallet, WalletProvider }
747
+ export { WalletProvider, useWallet }
@@ -1,3 +1,18 @@
1
- export { I18nProvider } from './I18nContext'
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'
@@ -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 { useAppDispatch, useAppSelector } from './base'
10
- import { useCurrentKeyring } from './keyrings'
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 { accountActions } from '../reducers/accounts'
14
- import { useWallet } from '../context/WalletContext'
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
+ }