@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,4 @@
1
- import { createSlice, PayloadAction, Slice, SliceCaseReducers } from '@reduxjs/toolkit'
1
+ import { createSlice, PayloadAction, SliceCaseReducers } from '@reduxjs/toolkit'
2
2
 
3
3
  import { updateVersion } from '../actions/global'
4
4
  import { TabOption } from '../types'
@@ -8,6 +8,29 @@ export interface GlobalState {
8
8
  isUnlocked: boolean
9
9
  isReady: boolean
10
10
  isBooted: boolean
11
+ screenState?: {
12
+ type: string
13
+ options: any
14
+ }
15
+ isRefresh: boolean
16
+ backRefresh: boolean
17
+ wallRefresh: boolean
18
+ wallTabRefresh: boolean
19
+ unlockRefres: boolean
20
+ unlockRead: boolean
21
+ layerState: boolean
22
+ isUnlockTimeRefres: boolean
23
+ infiniteListScrollOffset: number
24
+ infiniteListScrollDirection: 'up' | 'down'
25
+ infiniteListScrollActiveTime: number
26
+ isScrollViewTop: number
27
+ isScrollViewBot: number
28
+ isBiometricsSupported: boolean
29
+ hasBiometricsKey: boolean
30
+ wallTabFocusRefresh: 0
31
+ goBackRefresh: 0
32
+ switchChainModalVisible: boolean
33
+ isLockedOverlayVisible: boolean
11
34
  }
12
35
 
13
36
  export const initialState: GlobalState = {
@@ -15,6 +38,26 @@ export const initialState: GlobalState = {
15
38
  isUnlocked: false,
16
39
  isReady: false,
17
40
  isBooted: false,
41
+ screenState: undefined,
42
+ isRefresh: false,
43
+ backRefresh: false,
44
+ wallRefresh: false,
45
+ wallTabRefresh: false,
46
+ unlockRefres: false,
47
+ unlockRead: false,
48
+ layerState: false,
49
+ isUnlockTimeRefres: false,
50
+ infiniteListScrollOffset: 0,
51
+ infiniteListScrollDirection: 'down',
52
+ infiniteListScrollActiveTime: 0,
53
+ isScrollViewTop: 0,
54
+ isScrollViewBot: 0,
55
+ isBiometricsSupported: false,
56
+ hasBiometricsKey: false,
57
+ wallTabFocusRefresh: 0,
58
+ goBackRefresh: 0,
59
+ switchChainModalVisible: false,
60
+ isLockedOverlayVisible: false,
18
61
  }
19
62
 
20
63
  const reducers: SliceCaseReducers<GlobalState> = {
@@ -26,6 +69,29 @@ const reducers: SliceCaseReducers<GlobalState> = {
26
69
  isUnlocked?: boolean
27
70
  isReady?: boolean
28
71
  isBooted?: boolean
72
+ screenState?: {
73
+ type: string
74
+ options: any
75
+ }
76
+ isRefresh?: boolean
77
+ backRefresh?: boolean
78
+ wallRefresh?: boolean
79
+ wallTabRefresh?: boolean
80
+ unlockRefres?: boolean
81
+ layerState?: boolean
82
+ unlockRead?: boolean
83
+ isUnlockTimeRefres?: boolean
84
+ infiniteListScrollOffset?: number
85
+ infiniteListScrollDirection?: 'up' | 'down'
86
+ infiniteListScrollActiveTime?: number
87
+ isScrollViewTop?: number
88
+ isScrollViewBot?: number
89
+ isBiometricsSupported?: boolean
90
+ hasBiometricsKey?: boolean
91
+ wallTabFocusRefresh?: number
92
+ goBackRefresh?: number
93
+ switchChainModalVisible?: boolean
94
+ lockedOverlayVisible?: boolean
29
95
  }>
30
96
  ) => {
31
97
  const { payload } = action
@@ -4,4 +4,5 @@ export { globalActions } from './global'
4
4
  export { keyringsActions } from './keyrings'
5
5
  export { settingsActions } from './settings'
6
6
  export { transactionsActions } from './transactions'
7
+ export { browserActions, WalletTabScreenTabKey } from './browser'
7
8
  export { uiActions } from './ui'
@@ -17,7 +17,6 @@ export interface BitcoinTx {
17
17
  psbtHex: string
18
18
  feeRate: number
19
19
  toDomain: string
20
- enableRBF: boolean
21
20
  }
22
21
 
23
22
  export interface OrdinalsTx {
@@ -34,7 +33,6 @@ export interface OrdinalsTx {
34
33
  feeRate: number
35
34
  toDomain: string
36
35
  outputValue: number
37
- enableRBF: boolean
38
36
  }
39
37
 
40
38
  export interface RunesTx {
@@ -50,7 +48,6 @@ export interface RunesTx {
50
48
  feeRate: number
51
49
  toDomain: string
52
50
  outputValue: number
53
- enableRBF: boolean
54
51
  runeid?: string
55
52
  runeAmount?: string
56
53
  }
@@ -80,7 +77,6 @@ export const initialState: TransactionsState = {
80
77
  psbtHex: '',
81
78
  feeRate: 5,
82
79
  toDomain: '',
83
- enableRBF: false,
84
80
  },
85
81
  ordinalsTx: {
86
82
  fromAddress: '',
@@ -113,7 +109,6 @@ export const initialState: TransactionsState = {
113
109
  feeRate: 5,
114
110
  toDomain: '',
115
111
  outputValue: 10000,
116
- enableRBF: false,
117
112
  },
118
113
 
119
114
  runesTx: {
@@ -129,7 +124,6 @@ export const initialState: TransactionsState = {
129
124
  feeRate: 5,
130
125
  toDomain: '',
131
126
  outputValue: 10000,
132
- enableRBF: false,
133
127
  },
134
128
  utxos: [],
135
129
  spendUnavailableUtxos: [],
@@ -158,7 +152,6 @@ const slice: Slice<TransactionsState> = createSlice({
158
152
  psbtHex?: string
159
153
  feeRate?: number
160
154
  toDomain?: string
161
- enableRBF?: boolean
162
155
  }
163
156
  }
164
157
  ) {
@@ -182,7 +175,6 @@ const slice: Slice<TransactionsState> = createSlice({
182
175
  feeRate?: number
183
176
  toDomain?: string
184
177
  outputValue?: number
185
- enableRBF?: boolean
186
178
  }
187
179
  }
188
180
  ) {
@@ -206,7 +198,6 @@ const slice: Slice<TransactionsState> = createSlice({
206
198
  feeRate?: number
207
199
  toDomain?: string
208
200
  outputValue?: number
209
- enableRBF?: boolean
210
201
  runeid?: string
211
202
  runeAmount?: string
212
203
  }
@@ -1,20 +1,30 @@
1
- import { Inscription } from '@unisat/wallet-shared'
2
1
  import { createSlice, Slice } from '@reduxjs/toolkit'
2
+ import { Inscription } from '@unisat/wallet-shared'
3
3
 
4
4
  import { updateVersion } from '../actions/global'
5
5
  import {
6
6
  AlkanesAssetTabKey,
7
7
  AssetTabKey,
8
8
  CATAssetTabKey,
9
+ MoreAssetTabKey,
9
10
  NavigationSource,
10
11
  OrdinalsAssetTabKey,
11
12
  } from '../types'
12
13
 
14
+ export enum WallettopTabScreenTabKey {
15
+ Ordinals,
16
+ Atomicals,
17
+ Runes,
18
+ CAT20,
19
+ Alkanes,
20
+ }
21
+
13
22
  export interface UIState {
14
23
  assetTabKey: AssetTabKey
15
24
  ordinalsAssetTabKey: OrdinalsAssetTabKey
16
25
  catAssetTabKey: CATAssetTabKey
17
26
  alkanesAssetTabKey: AlkanesAssetTabKey
27
+ moreAssetTabKey: MoreAssetTabKey
18
28
  uiTxCreateScreen: {
19
29
  toInfo: {
20
30
  address: string
@@ -23,7 +33,21 @@ export interface UIState {
23
33
  }
24
34
  inputAmount: string
25
35
  enableRBF: boolean
36
+ }
37
+ addressInput: {
38
+ address: string
39
+ domain: string
40
+ inscription?: Inscription
41
+ }
42
+ amountInput: {
43
+ amount: string
44
+ }
45
+ feeRateBar: {
26
46
  feeRate: number
47
+ feeRateInputVal: string
48
+ enableLowFeeRate: boolean
49
+ feeOptionIndex: number
50
+ showCustomInput: boolean
27
51
  }
28
52
  babylonSendScreen: {
29
53
  inputAmount: string
@@ -31,6 +55,11 @@ export interface UIState {
31
55
  }
32
56
  navigationSource: NavigationSource
33
57
  isBalanceHidden: boolean
58
+ balanceDetailExpanded: boolean
59
+
60
+ walletTopTabScreen: {
61
+ toptabKey: WallettopTabScreenTabKey
62
+ }
34
63
  }
35
64
 
36
65
  export const initialState: UIState = {
@@ -38,14 +67,28 @@ export const initialState: UIState = {
38
67
  ordinalsAssetTabKey: OrdinalsAssetTabKey.ALL,
39
68
  catAssetTabKey: CATAssetTabKey.CAT20,
40
69
  alkanesAssetTabKey: AlkanesAssetTabKey.TOKEN,
70
+ moreAssetTabKey: MoreAssetTabKey.ALKANES_TOKEN,
41
71
  uiTxCreateScreen: {
42
72
  toInfo: {
43
73
  address: '',
44
74
  domain: '',
45
75
  },
46
76
  inputAmount: '',
47
- enableRBF: false,
77
+ enableRBF: true,
78
+ },
79
+ addressInput: {
80
+ address: '',
81
+ domain: '',
82
+ },
83
+ amountInput: {
84
+ amount: '',
85
+ },
86
+ feeRateBar: {
48
87
  feeRate: 1,
88
+ feeRateInputVal: '',
89
+ enableLowFeeRate: false,
90
+ feeOptionIndex: 1, // Default to AVG
91
+ showCustomInput: false,
49
92
  },
50
93
  babylonSendScreen: {
51
94
  inputAmount: '',
@@ -53,6 +96,11 @@ export const initialState: UIState = {
53
96
  },
54
97
  navigationSource: NavigationSource.NORMAL,
55
98
  isBalanceHidden: false,
99
+ balanceDetailExpanded: true,
100
+
101
+ walletTopTabScreen: {
102
+ toptabKey: WallettopTabScreenTabKey.Ordinals,
103
+ },
56
104
  }
57
105
 
58
106
  const slice: Slice<UIState> = createSlice({
@@ -70,6 +118,7 @@ const slice: Slice<UIState> = createSlice({
70
118
  ordinalsAssetTabKey?: OrdinalsAssetTabKey
71
119
  catAssetTabKey?: CATAssetTabKey
72
120
  alkanesAssetTabKey?: AlkanesAssetTabKey
121
+ moreAssetTabKey?: MoreAssetTabKey
73
122
  }
74
123
  }
75
124
  ) {
@@ -87,6 +136,9 @@ const slice: Slice<UIState> = createSlice({
87
136
  if (payload.alkanesAssetTabKey !== undefined) {
88
137
  state.alkanesAssetTabKey = payload.alkanesAssetTabKey
89
138
  }
139
+ if (payload.moreAssetTabKey !== undefined) {
140
+ state.moreAssetTabKey = payload.moreAssetTabKey
141
+ }
90
142
  return state
91
143
  },
92
144
  updateTxCreateScreen(
@@ -100,7 +152,6 @@ const slice: Slice<UIState> = createSlice({
100
152
  }
101
153
  inputAmount?: string
102
154
  enableRBF?: boolean
103
- feeRate?: number
104
155
  }
105
156
  }
106
157
  ) {
@@ -113,10 +164,82 @@ const slice: Slice<UIState> = createSlice({
113
164
  if (action.payload.enableRBF !== undefined) {
114
165
  state.uiTxCreateScreen.enableRBF = action.payload.enableRBF
115
166
  }
167
+
168
+ state.uiTxCreateScreen = { ...state.uiTxCreateScreen }
169
+ },
170
+ updateFeeRateBar(
171
+ state,
172
+ action: {
173
+ payload: {
174
+ feeRate?: number
175
+ feeRateInputVal?: string
176
+ enableLowFeeRate?: boolean
177
+ feeOptionIndex?: number
178
+ showCustomInput?: boolean
179
+ }
180
+ }
181
+ ) {
116
182
  if (action.payload.feeRate !== undefined) {
117
- state.uiTxCreateScreen.feeRate = action.payload.feeRate
183
+ state.feeRateBar.feeRate = action.payload.feeRate
184
+ }
185
+ if (action.payload.feeRateInputVal !== undefined) {
186
+ state.feeRateBar.feeRateInputVal = action.payload.feeRateInputVal
187
+ }
188
+ if (action.payload.enableLowFeeRate !== undefined) {
189
+ state.feeRateBar.enableLowFeeRate = action.payload.enableLowFeeRate
118
190
  }
191
+ if (action.payload.feeOptionIndex !== undefined) {
192
+ state.feeRateBar.feeOptionIndex = action.payload.feeOptionIndex
193
+ }
194
+ if (action.payload.showCustomInput !== undefined) {
195
+ state.feeRateBar.showCustomInput = action.payload.showCustomInput
196
+ }
197
+ state.feeRateBar = { ...state.feeRateBar }
198
+ },
199
+ resetFeeRateBar(state) {
200
+ state.feeRateBar = initialState.feeRateBar
119
201
  },
202
+
203
+ updateAddressInput(
204
+ state,
205
+ action: {
206
+ payload: {
207
+ address?: string
208
+ domain?: string
209
+ }
210
+ }
211
+ ) {
212
+ if (action.payload.address !== undefined) {
213
+ state.addressInput.address = action.payload.address
214
+ }
215
+ if (action.payload.domain !== undefined) {
216
+ state.addressInput.domain = action.payload.domain
217
+ }
218
+ state.addressInput = { ...state.addressInput }
219
+ },
220
+
221
+ resetAddressInput(state) {
222
+ state.addressInput = initialState.addressInput
223
+ },
224
+
225
+ updateAmountInput(
226
+ state,
227
+ action: {
228
+ payload: {
229
+ amount?: string
230
+ }
231
+ }
232
+ ) {
233
+ if (action.payload.amount !== undefined) {
234
+ state.amountInput.amount = action.payload.amount
235
+ }
236
+ state.amountInput = { ...state.amountInput }
237
+ },
238
+
239
+ resetAmountInput(state) {
240
+ state.amountInput = initialState.amountInput
241
+ },
242
+
120
243
  resetTxCreateScreen(state) {
121
244
  state.uiTxCreateScreen = initialState.uiTxCreateScreen
122
245
  },
@@ -145,6 +268,9 @@ const slice: Slice<UIState> = createSlice({
145
268
  setBalanceHidden(state, action: { payload: boolean }) {
146
269
  state.isBalanceHidden = action.payload
147
270
  },
271
+ setBalanceDetailExpanded(state, action: { payload: boolean }) {
272
+ state.balanceDetailExpanded = action.payload
273
+ },
148
274
  },
149
275
  extraReducers: builder => {
150
276
  builder.addCase(updateVersion, state => {
@@ -161,8 +287,19 @@ const slice: Slice<UIState> = createSlice({
161
287
  if (!state.alkanesAssetTabKey) {
162
288
  state.alkanesAssetTabKey = AlkanesAssetTabKey.TOKEN
163
289
  }
290
+ if (state.moreAssetTabKey === undefined) {
291
+ state.moreAssetTabKey = MoreAssetTabKey.ALKANES_TOKEN
292
+ }
293
+ if (state.assetTabKey === (4 as AssetTabKey)) {
294
+ state.assetTabKey = AssetTabKey.MORE
295
+ }
164
296
  if (!state.uiTxCreateScreen) {
165
297
  state.uiTxCreateScreen = initialState.uiTxCreateScreen
298
+ } else if (state.uiTxCreateScreen.enableRBF === undefined) {
299
+ state.uiTxCreateScreen.enableRBF = true
300
+ }
301
+ if (!state.feeRateBar) {
302
+ state.feeRateBar = initialState.feeRateBar
166
303
  }
167
304
  if (!state.babylonSendScreen) {
168
305
  state.babylonSendScreen = initialState.babylonSendScreen
@@ -170,6 +307,9 @@ const slice: Slice<UIState> = createSlice({
170
307
  if (state.isBalanceHidden === undefined) {
171
308
  state.isBalanceHidden = false
172
309
  }
310
+ if (state.balanceDetailExpanded === undefined) {
311
+ state.balanceDetailExpanded = true
312
+ }
173
313
  })
174
314
  },
175
315
  })
@@ -1,3 +1,3 @@
1
1
  export * from './ui'
2
2
 
3
- export type TabOption = 'home' | 'discover' | 'settings'
3
+ export type TabOption = 'home' | 'discover' | 'settings' | 'app'
package/src/types/ui.ts CHANGED
@@ -3,7 +3,7 @@ export enum AssetTabKey {
3
3
  ATOMICALS = 1, // IGNORED
4
4
  RUNES = 2,
5
5
  CAT = 3,
6
- ALKANES = 4,
6
+ MORE = 4,
7
7
  }
8
8
 
9
9
  export enum OrdinalsAssetTabKey {
@@ -24,6 +24,11 @@ export enum AlkanesAssetTabKey {
24
24
  COLLECTION,
25
25
  }
26
26
 
27
+ export enum MoreAssetTabKey {
28
+ ALKANES_TOKEN,
29
+ ALKANES_COLLECTION,
30
+ }
31
+
27
32
  export enum NavigationSource {
28
33
  BACK,
29
34
  NORMAL,
@@ -0,0 +1,107 @@
1
+ export { useAddressTypeScreenLogic } from './useAddressTypeScreenLogic'
2
+ export { useAlkanesListLogic } from './useAlkanesListLogic'
3
+ export { useAmountInputLogic } from './useAmountInputLogic'
4
+ export { useAnnouncementCardLogic } from './useAnnouncementCardLogic'
5
+ export {
6
+ BRC20SendTabKey,
7
+ useBRC20SendScreenLogic,
8
+ useBRC20SendScreenLogicStep1,
9
+ useBRC20SendScreenLogicStep2,
10
+ useBRC20SendScreenLogicStep3,
11
+ useTransferableListLogic,
12
+ type BRC20SendStepParams,
13
+ type ContextData,
14
+ type UpdateContextDataParams,
15
+ } from './useBRC20SendScreenLogic'
16
+ export { BRC20SingleStepKey, useBRC20SingleStepScreenLogic } from './useBRC20SingleStepScreenLogic'
17
+ export {
18
+ type BRC20OutWalletBalanceItem,
19
+ BRC20TokenScreenTabKey,
20
+ useBRC20TokenHistoryLogic,
21
+ useBRC20TokenScreenLogic,
22
+ } from './useBRC20TokenScreenLogic'
23
+ export { useEditWalletNameScreenLogic } from './useEditWalletNameScreenLogic'
24
+ export { useFeeRateBarLogic } from './useFeeRateBarLogic'
25
+ export { useLockTimePageLogic } from './useLockTimePageLogic'
26
+ export { useNotificationsLogic, useUnreadNotificationsCount } from './useNotificationsLogic'
27
+ export { useSendOrdinalsInscriptionScreenLogic } from './useSendOrdinalsInscriptionScreenLogic'
28
+ export { useTxCreateScreenLogic } from './useTxCreateScreenLogic'
29
+
30
+ export {
31
+ useBRC20InscribeTransferLogic,
32
+ useBRC20InscribeTransferLogicStep1,
33
+ useBRC20InscribeTransferLogicStep2,
34
+ useBRC20InscribeTransferLogicStep3,
35
+ useBRC20InscribeTransferLogicStep4,
36
+ type BRC20InscribeTransferParams,
37
+ } from './useBRC20InscribeTransferLogic'
38
+
39
+ export { useAlkanesNFTScreenLogic } from './useAlkanesNFTScreenLogic'
40
+ export { useAlkanesTokenScreenLogic } from './useAlkanesTokenScreenLogic'
41
+ export { useCreateWalletLogicImportWordsStep } from './useCreateWalletLogicImportWordsStep'
42
+ export { useOrdinalsInscriptionScreenLogic } from './useOrdinalsInscriptionScreenLogic'
43
+
44
+ export { useRunesTokenScreenLogic } from './useRunesTokenScreenLogic'
45
+
46
+ export { useBRC20BalanceCardLogic, type BRC20BalanceCardProps } from './useBRC20BalanceCardLogic'
47
+
48
+ export { useExportMnemonicsScreenLogic } from './useExportMnemonicsScreenLogic'
49
+ export { useExportPrivateKeyScreenLogic } from './useExportPrivateKeyScreenLogic'
50
+ export { useSendRunesScreenLogic } from './useSendRunesScreenLogic'
51
+
52
+ export { useEditContactScreenLogic } from './useEditContactScreenLogic'
53
+
54
+ export { useEditAccountNameScreenLogic } from './useEditAccountNameScreenLogic'
55
+
56
+ export { useAlkanesCollectionListLogic } from './useAlkanesCollectionListLogic'
57
+ export { useBRC20ListLogic } from './useBRC20ListLogic'
58
+
59
+ export { useInscriptionListLogic } from './useInscriptionListLogic'
60
+ export { useRunesListLogic } from './useRunesListLogic'
61
+
62
+ export { useCAT20ListLogic } from './useCAT20ListLogic'
63
+ export { SendCAT20ScreenStep, useSendCAT20ScreenLogic } from './useSendCAT20ScreenLogic'
64
+ export { SendCAT721ScreenStep, useSendCAT721ScreenLogic } from './useSendCAT721ScreenLogic'
65
+
66
+ export { useAlkanesNFTListLogic } from './useAlkanesNFTListLogic'
67
+ export { useBRC20ProgListLogic } from './useBRC20ProgListLogic'
68
+ export { useCAT721ListLogic } from './useCAT721ListLogic'
69
+
70
+ export { useCAT20TokenScreenLogic } from './useCAT20TokenScreenLogic'
71
+
72
+ export { useSplitOrdinalsInscriptionScreenLogic } from './useSplitOrdinalsInscriptionScreenLogic'
73
+
74
+ export { useCreatePasswordScreenLogic } from './useCreatePasswordScreenLogic'
75
+ export {
76
+ SendAlkanesNFTScreenStep,
77
+ useSendAlkanesNFTScreenLogic,
78
+ } from './useSendAlkanesNFTScreenLogic'
79
+ export { SendAlkanesScreenStep, useSendAlkanesScreenLogic } from './useSendAlkanesScreenLogic'
80
+
81
+ export { useRunesBalanceCardLogic, type RunesBalanceCardProps } from './useRunesBalanceCardLogic'
82
+
83
+ export { useCAT20BalanceCardLogic, type CAT20BalanceCardProps } from './useCAT20BalanceCardLogic'
84
+
85
+ export {
86
+ useAlkanesBalanceCardLogic,
87
+ type AlkanesBalanceCardProps,
88
+ } from './useAlkanesBalanceCardLogic'
89
+
90
+ export { useCAT721NFTScreenLogic } from './useCAT721NFTScreenLogic'
91
+
92
+ export { useSignMessageLogic, type SignMessageProps } from './useSignMessageLogic'
93
+ export { useSignPsbtLogic, type SignPsbtProps } from './useSignPsbtLogic'
94
+ export type { PsbtLocalInfo } from '@unisat/wallet-shared'
95
+
96
+ export { useTxConfirmScreenLogic } from './useTxConfirmScreenLogic'
97
+ export { useTxFailScreenLogic } from './useTxFailScreenLogic'
98
+ export { useTxSuccessScreenLogic } from './useTxSuccessScreenLogic'
99
+
100
+ export {
101
+ useActionOverviewSectionLogic,
102
+ type ActionOverviewSectionProps,
103
+ } from './useActionOverviewSectionLogic'
104
+ export { useSettingsTabScreenLogic, type SettingsItemType } from './useSettingsTabScreenLogic'
105
+
106
+ export { useBalanceCardLogic } from './useBalanceCardLogic'
107
+ export { useBtcDisplayLogic } from './useBtcDisplayLogic'
@@ -0,0 +1,150 @@
1
+ import {
2
+ DecodedPsbt,
3
+ Inscription,
4
+ PsbtActionDetailType,
5
+ PsbtActionInfo,
6
+ PsbtActionType,
7
+ } from '@unisat/wallet-shared'
8
+ import { useMemo } from 'react'
9
+ import { useI18n } from 'src/context'
10
+ import { useChain, useCurrentAddress } from 'src/hooks'
11
+
12
+ export interface ActionOverviewSectionProps {
13
+ action: PsbtActionInfo
14
+ decodedPsbt: DecodedPsbt
15
+ }
16
+
17
+ export function useActionOverviewSectionLogic({ action, decodedPsbt }: ActionOverviewSectionProps) {
18
+ const { t } = useI18n()
19
+
20
+ const chain = useChain()
21
+
22
+ const currentAddress = useCurrentAddress()
23
+
24
+ const spendSatoshis = useMemo(() => {
25
+ const inValue = decodedPsbt.inputInfos
26
+ .filter(v => v.address === currentAddress)
27
+ .reduce((pre, cur) => cur.value + pre, 0)
28
+ const outValue = decodedPsbt.outputInfos
29
+ .filter(v => v.address === currentAddress)
30
+ .reduce((pre, cur) => cur.value + pre, 0)
31
+ const spend = inValue - outValue
32
+ return spend
33
+ }, [decodedPsbt, currentAddress])
34
+
35
+ const spendingInscriptionCount = useMemo(() => {
36
+ let count = 0
37
+ decodedPsbt.inputInfos.forEach(inputInfo => {
38
+ if (inputInfo.address === currentAddress) {
39
+ inputInfo.inscriptions.forEach(inscription => {
40
+ const inscriptionInfo: Inscription = decodedPsbt.inscriptions[inscription.inscriptionId]
41
+ if (inscriptionInfo.brc20 && inscriptionInfo.brc20.op === 'transfer') {
42
+ // skip brc20
43
+ } else {
44
+ count++
45
+ }
46
+ })
47
+ }
48
+ })
49
+ return count
50
+ }, [decodedPsbt, currentAddress])
51
+
52
+ const spendingBrc20Count = useMemo(() => {
53
+ let count = 0
54
+ decodedPsbt.inputInfos.forEach(inputInfo => {
55
+ if (inputInfo.address === currentAddress) {
56
+ inputInfo.inscriptions.forEach(inscription => {
57
+ const inscriptionInfo: Inscription = decodedPsbt.inscriptions[inscription.inscriptionId]
58
+ if (inscriptionInfo.brc20 && inscriptionInfo.brc20.op === 'transfer') {
59
+ count++
60
+ }
61
+ })
62
+ }
63
+ })
64
+ return count
65
+ }, [decodedPsbt, currentAddress])
66
+
67
+ const spendingRunesCount = useMemo(() => {
68
+ const runeMap: { [key: string]: string } = {}
69
+ decodedPsbt.inputInfos.forEach(inputInfo => {
70
+ if (inputInfo.address === currentAddress) {
71
+ inputInfo.runes.forEach(rune => {
72
+ runeMap[rune.runeid] = rune.runeid
73
+ })
74
+ }
75
+ })
76
+ return Object.keys(runeMap).length
77
+ }, [decodedPsbt, currentAddress])
78
+
79
+ const spendingAlkanesCount = useMemo(() => {
80
+ const alkaneMap: { [key: string]: string } = {}
81
+ decodedPsbt.inputInfos.forEach(inputInfo => {
82
+ if (inputInfo.address === currentAddress) {
83
+ inputInfo.alkanes.forEach(alkane => {
84
+ alkaneMap[alkane.alkaneid] = alkane.alkaneid
85
+ })
86
+ }
87
+ })
88
+ return Object.keys(alkaneMap).length
89
+ }, [decodedPsbt, currentAddress])
90
+
91
+ if (!action) {
92
+ action = {
93
+ name: '',
94
+ description: '',
95
+ type: PsbtActionType.DEFAULT,
96
+ }
97
+ }
98
+
99
+ if (action.details?.length === 0) {
100
+ action.details = []
101
+ }
102
+
103
+ if (action.type === PsbtActionType.DEFAULT) {
104
+ action.name = t('sign_transaction')
105
+ action.description = ''
106
+ action.details = []
107
+
108
+ if (
109
+ spendingInscriptionCount > 0 ||
110
+ spendingBrc20Count > 0 ||
111
+ spendingAlkanesCount > 0 ||
112
+ spendingRunesCount > 0
113
+ ) {
114
+ action.details.push({
115
+ type: PsbtActionDetailType.MULTIASSETS,
116
+ label: t('spending_assets'),
117
+ value: {
118
+ inscriptionCount: spendingInscriptionCount,
119
+ brc20Count: spendingBrc20Count,
120
+ runesCount: spendingRunesCount,
121
+ alkanesCount: spendingAlkanesCount,
122
+ },
123
+ })
124
+ }
125
+ }
126
+
127
+ const commonDetails: any[] = []
128
+ if (spendSatoshis > 0) {
129
+ commonDetails.push({
130
+ type: PsbtActionDetailType.SATOSHIS,
131
+ label: t('spending_amount'),
132
+ value: `${spendSatoshis}`,
133
+ })
134
+ }
135
+
136
+ if (spendSatoshis < 0) {
137
+ commonDetails.push({
138
+ type: PsbtActionDetailType.SATOSHIS,
139
+ label: t('receive'),
140
+ value: `${-spendSatoshis}`,
141
+ })
142
+ }
143
+
144
+ return {
145
+ decodedPsbt,
146
+ action,
147
+ commonDetails,
148
+ chain,
149
+ }
150
+ }