@unisat/wallet-state 1.0.5 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +0 -5
- package/lib/actions/global.d.ts +2 -0
- package/lib/actions/global.d.ts.map +1 -0
- package/lib/context/ApprovalContext.d.ts +9 -0
- package/lib/context/ApprovalContext.d.ts.map +1 -0
- package/lib/context/DeviceContext.d.ts +17 -0
- package/lib/context/DeviceContext.d.ts.map +1 -0
- package/lib/context/I18nContext.d.ts +13 -0
- package/lib/context/I18nContext.d.ts.map +1 -0
- package/lib/context/NavigationContext.d.ts +218 -0
- package/lib/context/NavigationContext.d.ts.map +1 -0
- package/lib/context/PriceContext.d.ts +13 -0
- package/lib/context/PriceContext.d.ts.map +1 -0
- package/lib/context/StorageContext.d.ts +60 -0
- package/lib/context/StorageContext.d.ts.map +1 -0
- package/lib/context/ToolsContext.d.ts +17 -0
- package/lib/context/ToolsContext.d.ts.map +1 -0
- package/lib/context/WalletContext.d.ts +493 -0
- package/lib/context/WalletContext.d.ts.map +1 -0
- package/lib/context/index.d.ts +9 -0
- package/lib/context/index.d.ts.map +1 -0
- package/lib/hooks/accounts.d.ts +34 -0
- package/lib/hooks/accounts.d.ts.map +1 -0
- package/lib/hooks/base.d.ts +14 -0
- package/lib/hooks/base.d.ts.map +1 -0
- package/lib/hooks/browser.d.ts +32 -0
- package/lib/hooks/browser.d.ts.map +1 -0
- package/lib/hooks/discovery.d.ts +17 -0
- package/lib/hooks/discovery.d.ts.map +1 -0
- package/lib/hooks/global.d.ts +43 -0
- package/lib/hooks/global.d.ts.map +1 -0
- package/lib/hooks/index.d.ts +10 -0
- package/lib/hooks/index.d.ts.map +1 -0
- package/lib/hooks/keyrings.d.ts +5 -0
- package/lib/hooks/keyrings.d.ts.map +1 -0
- package/lib/hooks/settings.d.ts +43 -0
- package/lib/hooks/settings.d.ts.map +1 -0
- package/lib/hooks/transactions.d.ts +67 -0
- package/lib/hooks/transactions.d.ts.map +1 -0
- package/lib/hooks/ui.d.ts +112 -0
- package/lib/hooks/ui.d.ts.map +1 -0
- package/lib/index.d.mts +2072 -199
- package/lib/index.d.ts +31 -946
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +7176 -582
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +6971 -525
- package/lib/index.mjs.map +1 -1
- package/lib/reducers/accounts.d.ts +49 -0
- package/lib/reducers/accounts.d.ts.map +1 -0
- package/lib/reducers/browser.d.ts +49 -0
- package/lib/reducers/browser.d.ts.map +1 -0
- package/lib/reducers/discovery.d.ts +22 -0
- package/lib/reducers/discovery.d.ts.map +1 -0
- package/lib/reducers/global.d.ts +35 -0
- package/lib/reducers/global.d.ts.map +1 -0
- package/lib/reducers/index.d.ts +9 -0
- package/lib/reducers/index.d.ts.map +1 -0
- package/lib/reducers/keyrings.d.ts +10 -0
- package/lib/reducers/keyrings.d.ts.map +1 -0
- package/lib/reducers/settings.d.ts +16 -0
- package/lib/reducers/settings.d.ts.map +1 -0
- package/lib/reducers/transactions.d.ts +61 -0
- package/lib/reducers/transactions.d.ts.map +1 -0
- package/lib/reducers/ui.d.ts +55 -0
- package/lib/reducers/ui.d.ts.map +1 -0
- package/lib/types/index.d.mts +7 -3
- package/lib/types/index.d.ts +3 -30
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js +7 -1
- package/lib/types/index.js.map +1 -1
- package/lib/types/index.mjs +7 -2
- package/lib/types/index.mjs.map +1 -1
- package/lib/types/ui.d.ts +31 -0
- package/lib/types/ui.d.ts.map +1 -0
- package/lib/ui-hooks/index.d.ts +55 -0
- package/lib/ui-hooks/index.d.ts.map +1 -0
- package/lib/ui-hooks/useActionOverviewSectionLogic.d.ts +12 -0
- package/lib/ui-hooks/useActionOverviewSectionLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useAddressTypeScreenLogic.d.ts +19 -0
- package/lib/ui-hooks/useAddressTypeScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useAlkanesBalanceCardLogic.d.ts +19 -0
- package/lib/ui-hooks/useAlkanesBalanceCardLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useAlkanesCollectionListLogic.d.ts +11 -0
- package/lib/ui-hooks/useAlkanesCollectionListLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useAlkanesListLogic.d.ts +14 -0
- package/lib/ui-hooks/useAlkanesListLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useAlkanesNFTListLogic.d.ts +11 -0
- package/lib/ui-hooks/useAlkanesNFTListLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useAlkanesNFTScreenLogic.d.ts +9 -0
- package/lib/ui-hooks/useAlkanesNFTScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useAlkanesTokenScreenLogic.d.ts +22 -0
- package/lib/ui-hooks/useAlkanesTokenScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useAmountInputLogic.d.ts +22 -0
- package/lib/ui-hooks/useAmountInputLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useAnnouncementCardLogic.d.ts +11 -0
- package/lib/ui-hooks/useAnnouncementCardLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useBRC20BalanceCardLogic.d.ts +26 -0
- package/lib/ui-hooks/useBRC20BalanceCardLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useBRC20InscribeTransferLogic.d.ts +103 -0
- package/lib/ui-hooks/useBRC20InscribeTransferLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useBRC20ListLogic.d.ts +14 -0
- package/lib/ui-hooks/useBRC20ListLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useBRC20ProgListLogic.d.ts +14 -0
- package/lib/ui-hooks/useBRC20ProgListLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useBRC20SendScreenLogic.d.ts +67 -0
- package/lib/ui-hooks/useBRC20SendScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useBRC20SingleStepScreenLogic.d.ts +36 -0
- package/lib/ui-hooks/useBRC20SingleStepScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useBRC20TokenScreenLogic.d.ts +75 -0
- package/lib/ui-hooks/useBRC20TokenScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useBalanceCardLogic.d.ts +26 -0
- package/lib/ui-hooks/useBalanceCardLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useBtcDisplayLogic.d.ts +5 -0
- package/lib/ui-hooks/useBtcDisplayLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useCAT20BalanceCardLogic.d.ts +20 -0
- package/lib/ui-hooks/useCAT20BalanceCardLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useCAT20ListLogic.d.ts +14 -0
- package/lib/ui-hooks/useCAT20ListLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useCAT20TokenScreenLogic.d.ts +19 -0
- package/lib/ui-hooks/useCAT20TokenScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useCAT721ListLogic.d.ts +11 -0
- package/lib/ui-hooks/useCAT721ListLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useCAT721NFTScreenLogic.d.ts +9 -0
- package/lib/ui-hooks/useCAT721NFTScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useCreatePasswordScreenLogic.d.ts +27 -0
- package/lib/ui-hooks/useCreatePasswordScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useCreateWalletLogicImportWordsStep.d.ts +78 -0
- package/lib/ui-hooks/useCreateWalletLogicImportWordsStep.d.ts.map +1 -0
- package/lib/ui-hooks/useEditAccountNameScreenLogic.d.ts +18 -0
- package/lib/ui-hooks/useEditAccountNameScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useEditContactScreenLogic.d.ts +24 -0
- package/lib/ui-hooks/useEditContactScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useEditWalletNameScreenLogic.d.ts +15 -0
- package/lib/ui-hooks/useEditWalletNameScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useExportMnemonicsScreenLogic.d.ts +18 -0
- package/lib/ui-hooks/useExportMnemonicsScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useExportPrivateKeyScreenLogic.d.ts +17 -0
- package/lib/ui-hooks/useExportPrivateKeyScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useFeeRateBarLogic.d.ts +34 -0
- package/lib/ui-hooks/useFeeRateBarLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useInfiniteList.d.ts +19 -0
- package/lib/ui-hooks/useInfiniteList.d.ts.map +1 -0
- package/lib/ui-hooks/useInscriptionListLogic.d.ts +11 -0
- package/lib/ui-hooks/useInscriptionListLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useLockTimePageLogic.d.ts +11 -0
- package/lib/ui-hooks/useLockTimePageLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useNotificationsLogic.d.ts +14 -0
- package/lib/ui-hooks/useNotificationsLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useOrdinalsInscriptionScreenLogic.d.ts +27 -0
- package/lib/ui-hooks/useOrdinalsInscriptionScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useRunesBalanceCardLogic.d.ts +19 -0
- package/lib/ui-hooks/useRunesBalanceCardLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useRunesListLogic.d.ts +14 -0
- package/lib/ui-hooks/useRunesListLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useRunesTokenScreenLogic.d.ts +22 -0
- package/lib/ui-hooks/useRunesTokenScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useSecurityCardLogic.d.ts +1 -0
- package/lib/ui-hooks/useSecurityCardLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useSendAlkanesNFTScreenLogic.d.ts +32 -0
- package/lib/ui-hooks/useSendAlkanesNFTScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useSendAlkanesScreenLogic.d.ts +37 -0
- package/lib/ui-hooks/useSendAlkanesScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useSendCAT20ScreenLogic.d.ts +44 -0
- package/lib/ui-hooks/useSendCAT20ScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useSendCAT721ScreenLogic.d.ts +40 -0
- package/lib/ui-hooks/useSendCAT721ScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useSendOrdinalsInscriptionScreenLogic.d.ts +22 -0
- package/lib/ui-hooks/useSendOrdinalsInscriptionScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useSendRunesScreenLogic.d.ts +30 -0
- package/lib/ui-hooks/useSendRunesScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useSettingsTabScreenLogic.d.ts +72 -0
- package/lib/ui-hooks/useSettingsTabScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useSignMessageLogic.d.ts +54 -0
- package/lib/ui-hooks/useSignMessageLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useSignPsbtLogic.d.ts +82 -0
- package/lib/ui-hooks/useSignPsbtLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useSplitOrdinalsInscriptionScreenLogic.d.ts +15 -0
- package/lib/ui-hooks/useSplitOrdinalsInscriptionScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useTxConfirmScreenLogic.d.ts +8 -0
- package/lib/ui-hooks/useTxConfirmScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useTxCreateScreenLogic.d.ts +28 -0
- package/lib/ui-hooks/useTxCreateScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useTxFailScreenLogic.d.ts +7 -0
- package/lib/ui-hooks/useTxFailScreenLogic.d.ts.map +1 -0
- package/lib/ui-hooks/useTxSuccessScreenLogic.d.ts +8 -0
- package/lib/ui-hooks/useTxSuccessScreenLogic.d.ts.map +1 -0
- package/lib/updater/accounts.d.ts +2 -0
- package/lib/updater/accounts.d.ts.map +1 -0
- package/lib/updater/index.d.ts +2 -0
- package/lib/updater/index.d.ts.map +1 -0
- package/lib/utils/bitcoin-utils.d.ts +7 -0
- package/lib/utils/bitcoin-utils.d.ts.map +1 -0
- package/lib/utils/eventBus.d.ts +12 -0
- package/lib/utils/eventBus.d.ts.map +1 -0
- package/lib/utils/password-utils.d.ts +12 -0
- package/lib/utils/password-utils.d.ts.map +1 -0
- package/lib/utils/ui-utils.d.ts +4 -0
- package/lib/utils/ui-utils.d.ts.map +1 -0
- package/package.json +19 -15
- package/src/.DS_Store +0 -0
- package/src/context/ApprovalContext.tsx +27 -0
- package/src/context/DeviceContext.tsx +36 -0
- package/src/context/I18nContext.tsx +14 -172
- package/src/context/NavigationContext.tsx +305 -0
- package/src/context/PriceContext.tsx +2 -2
- package/src/context/StorageContext.tsx +393 -0
- package/src/context/ToolsContext.tsx +50 -0
- package/src/context/WalletContext.tsx +170 -126
- package/src/context/index.ts +17 -2
- package/src/hooks/accounts.ts +11 -5
- package/src/hooks/browser.ts +11 -0
- package/src/hooks/global.ts +170 -7
- package/src/hooks/index.ts +1 -2
- package/src/hooks/settings.ts +38 -37
- package/src/hooks/transactions.ts +45 -151
- package/src/hooks/ui.ts +239 -35
- package/src/index.ts +33 -24
- package/src/reducers/accounts.ts +22 -2
- package/src/reducers/browser.ts +223 -0
- package/src/reducers/global.ts +67 -1
- package/src/reducers/index.ts +1 -0
- package/src/reducers/transactions.ts +0 -9
- package/src/reducers/ui.ts +144 -4
- package/src/types/index.ts +1 -1
- package/src/types/ui.ts +6 -1
- package/src/ui-hooks/index.ts +107 -0
- package/src/ui-hooks/useActionOverviewSectionLogic.ts +150 -0
- package/src/ui-hooks/useAddressTypeScreenLogic.ts +160 -0
- package/src/ui-hooks/useAlkanesBalanceCardLogic.ts +41 -0
- package/src/ui-hooks/useAlkanesCollectionListLogic.ts +68 -0
- package/src/ui-hooks/useAlkanesListLogic.ts +69 -0
- package/src/ui-hooks/useAlkanesNFTListLogic.ts +42 -0
- package/src/ui-hooks/useAlkanesNFTScreenLogic.ts +45 -0
- package/src/ui-hooks/useAlkanesTokenScreenLogic.ts +138 -0
- package/src/ui-hooks/useAmountInputLogic.ts +80 -0
- package/src/ui-hooks/useAnnouncementCardLogic.ts +91 -0
- package/src/ui-hooks/useBRC20BalanceCardLogic.ts +115 -0
- package/src/ui-hooks/useBRC20InscribeTransferLogic.ts +418 -0
- package/src/ui-hooks/useBRC20ListLogic.ts +79 -0
- package/src/ui-hooks/useBRC20ProgListLogic.ts +81 -0
- package/src/ui-hooks/useBRC20SendScreenLogic.ts +424 -0
- package/src/ui-hooks/useBRC20SingleStepScreenLogic.ts +208 -0
- package/src/ui-hooks/useBRC20TokenScreenLogic.ts +489 -0
- package/src/ui-hooks/useBalanceCardLogic.ts +164 -0
- package/src/ui-hooks/useBtcDisplayLogic.ts +16 -0
- package/src/ui-hooks/useCAT20BalanceCardLogic.ts +35 -0
- package/src/ui-hooks/useCAT20ListLogic.ts +83 -0
- package/src/ui-hooks/useCAT20TokenScreenLogic.ts +127 -0
- package/src/ui-hooks/useCAT721ListLogic.ts +68 -0
- package/src/ui-hooks/useCAT721NFTScreenLogic.ts +37 -0
- package/src/ui-hooks/useCreatePasswordScreenLogic.ts +92 -0
- package/src/ui-hooks/useCreateWalletLogicImportWordsStep.ts +299 -0
- package/src/ui-hooks/useEditAccountNameScreenLogic.ts +71 -0
- package/src/ui-hooks/useEditContactScreenLogic.ts +162 -0
- package/src/ui-hooks/useEditWalletNameScreenLogic.ts +60 -0
- package/src/ui-hooks/useExportMnemonicsScreenLogic.ts +75 -0
- package/src/ui-hooks/useExportPrivateKeyScreenLogic.ts +64 -0
- package/src/ui-hooks/useFeeRateBarLogic.ts +303 -0
- package/src/ui-hooks/useInfiniteList.ts +85 -0
- package/src/ui-hooks/useInscriptionListLogic.ts +68 -0
- package/src/ui-hooks/useLockTimePageLogic.ts +43 -0
- package/src/ui-hooks/useNotificationsLogic.ts +115 -0
- package/src/ui-hooks/useOrdinalsInscriptionScreenLogic.ts +130 -0
- package/src/ui-hooks/useRunesBalanceCardLogic.ts +44 -0
- package/src/ui-hooks/useRunesListLogic.ts +74 -0
- package/src/ui-hooks/useRunesTokenScreenLogic.ts +156 -0
- package/src/ui-hooks/useSecurityCardLogic.ts +0 -0
- package/src/ui-hooks/useSendAlkanesNFTScreenLogic.ts +160 -0
- package/src/ui-hooks/useSendAlkanesScreenLogic.ts +208 -0
- package/src/ui-hooks/useSendCAT20ScreenLogic.ts +297 -0
- package/src/ui-hooks/useSendCAT721ScreenLogic.ts +205 -0
- package/src/ui-hooks/useSendOrdinalsInscriptionScreenLogic.ts +152 -0
- package/src/ui-hooks/useSendRunesScreenLogic.ts +189 -0
- package/src/ui-hooks/useSettingsTabScreenLogic.ts +211 -0
- package/src/ui-hooks/useSignMessageLogic.ts +302 -0
- package/src/ui-hooks/useSignPsbtLogic.ts +517 -0
- package/src/ui-hooks/useSplitOrdinalsInscriptionScreenLogic.ts +109 -0
- package/src/ui-hooks/useTxConfirmScreenLogic.ts +47 -0
- package/src/ui-hooks/useTxCreateScreenLogic.ts +177 -0
- package/src/ui-hooks/useTxFailScreenLogic.ts +26 -0
- package/src/ui-hooks/useTxSuccessScreenLogic.ts +33 -0
- package/src/updater/accounts.ts +11 -11
- package/src/utils/bitcoin-utils.ts +17 -8
- package/src/utils/eventBus.ts +2 -1
- package/src/utils/password-utils.ts +78 -0
- package/src/utils/ui-utils.ts +28 -0
- package/src/hooks/approval.ts +0 -72
- package/src/hooks/i18n.ts +0 -53
- package/src/utils/i18n.ts +0 -41
|
@@ -1,23 +1,14 @@
|
|
|
1
1
|
import { useCallback, useMemo } from 'react'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { ToAddressInfo, ToSignData, UnspentOutput } from '@unisat/wallet-shared'
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
import { AppState } from '..'
|
|
5
|
+
import { numUtils, timeUtils } from '@unisat/base-utils'
|
|
6
|
+
import { AppState, useI18n, useTools } from '..'
|
|
7
|
+
import { useWallet } from '../context/WalletContext'
|
|
9
8
|
import { useAccountAddress, useCurrentAccount } from '../hooks/accounts'
|
|
10
9
|
import { accountActions } from '../reducers/accounts'
|
|
11
|
-
import { useAppDispatch, useAppSelector } from './base'
|
|
12
10
|
import { transactionsActions } from '../reducers/transactions'
|
|
13
|
-
import {
|
|
14
|
-
import { useWallet } from '../context/WalletContext'
|
|
15
|
-
|
|
16
|
-
function useTools() {
|
|
17
|
-
return {
|
|
18
|
-
showLoading: (show: boolean) => {},
|
|
19
|
-
}
|
|
20
|
-
}
|
|
11
|
+
import { useAppDispatch, useAppSelector } from './base'
|
|
21
12
|
|
|
22
13
|
export function useTransactionsState(): AppState['transactions'] {
|
|
23
14
|
return useAppSelector(state => state.transactions)
|
|
@@ -34,26 +25,25 @@ export function usePrepareSendBTCCallback() {
|
|
|
34
25
|
const fromAddress = useAccountAddress()
|
|
35
26
|
const utxos = useUtxos()
|
|
36
27
|
const fetchUtxos = useFetchUtxosCallback()
|
|
37
|
-
|
|
38
|
-
const btcUnit = useBTCUnit()
|
|
28
|
+
|
|
39
29
|
const { t } = useI18n()
|
|
40
30
|
return useCallback(
|
|
41
31
|
async ({
|
|
42
32
|
toAddressInfo,
|
|
43
33
|
toAmount,
|
|
44
34
|
feeRate,
|
|
45
|
-
enableRBF,
|
|
46
35
|
memo,
|
|
47
36
|
memos,
|
|
48
37
|
disableAutoAdjust,
|
|
38
|
+
enableRBF,
|
|
49
39
|
}: {
|
|
50
40
|
toAddressInfo: ToAddressInfo
|
|
51
41
|
toAmount: number
|
|
52
42
|
feeRate?: number
|
|
53
|
-
enableRBF: boolean
|
|
54
43
|
memo?: string
|
|
55
44
|
memos?: string[]
|
|
56
45
|
disableAutoAdjust?: boolean
|
|
46
|
+
enableRBF?: boolean
|
|
57
47
|
}) => {
|
|
58
48
|
let _utxos: UnspentOutput[] = utxos
|
|
59
49
|
if (_utxos.length === 0) {
|
|
@@ -70,47 +60,28 @@ export function usePrepareSendBTCCallback() {
|
|
|
70
60
|
const summary = await wallet.getFeeSummary()
|
|
71
61
|
feeRate = summary.list[1]!.feeRate
|
|
72
62
|
}
|
|
73
|
-
let res:
|
|
74
|
-
psbtHex: string
|
|
75
|
-
rawtx: string
|
|
76
|
-
fee: number
|
|
77
|
-
}
|
|
63
|
+
let res: ToSignData
|
|
78
64
|
|
|
79
65
|
if (safeBalance === toAmount && !disableAutoAdjust) {
|
|
80
|
-
res = await wallet.
|
|
66
|
+
res = await wallet.createSendAllBTCPsbt({
|
|
81
67
|
to: toAddressInfo.address,
|
|
82
68
|
btcUtxos: _utxos,
|
|
83
|
-
enableRBF,
|
|
84
69
|
feeRate,
|
|
70
|
+
enableRBF,
|
|
85
71
|
})
|
|
86
72
|
} else {
|
|
87
|
-
res = await wallet.
|
|
73
|
+
res = await wallet.createSendBTCPsbt({
|
|
88
74
|
to: toAddressInfo.address,
|
|
89
75
|
amount: toAmount,
|
|
90
76
|
btcUtxos: _utxos,
|
|
91
|
-
enableRBF,
|
|
92
77
|
feeRate,
|
|
78
|
+
enableRBF,
|
|
93
79
|
memo: memo!,
|
|
94
80
|
memos: memos!,
|
|
95
81
|
})
|
|
96
82
|
}
|
|
97
83
|
|
|
98
|
-
|
|
99
|
-
(transactionsActions as any).updateBitcoinTx({
|
|
100
|
-
rawtx: res.rawtx,
|
|
101
|
-
psbtHex: res.psbtHex,
|
|
102
|
-
fromAddress,
|
|
103
|
-
feeRate,
|
|
104
|
-
enableRBF,
|
|
105
|
-
})
|
|
106
|
-
)
|
|
107
|
-
const rawTxInfo: RawTxInfo = {
|
|
108
|
-
psbtHex: res.psbtHex,
|
|
109
|
-
rawtx: res.rawtx,
|
|
110
|
-
toAddressInfo,
|
|
111
|
-
fee: res.fee,
|
|
112
|
-
}
|
|
113
|
-
return rawTxInfo
|
|
84
|
+
return res
|
|
114
85
|
},
|
|
115
86
|
[dispatch, wallet, fromAddress, utxos, fetchUtxos]
|
|
116
87
|
)
|
|
@@ -119,46 +90,31 @@ export function usePrepareSendBTCCallback() {
|
|
|
119
90
|
export function usePrepareSendBypassHeadOffsetsCallback() {
|
|
120
91
|
const dispatch = useAppDispatch()
|
|
121
92
|
const wallet = useWallet()
|
|
122
|
-
const fromAddress = useAccountAddress()
|
|
123
|
-
const account = useCurrentAccount()
|
|
124
|
-
const btcUnit = useBTCUnit()
|
|
125
93
|
return useCallback(
|
|
126
94
|
async ({
|
|
127
95
|
toAddressInfo,
|
|
128
96
|
toAmount,
|
|
129
97
|
feeRate,
|
|
98
|
+
enableRBF,
|
|
130
99
|
}: {
|
|
131
100
|
toAddressInfo: ToAddressInfo
|
|
132
101
|
toAmount: number
|
|
133
102
|
feeRate: number
|
|
103
|
+
enableRBF?: boolean
|
|
134
104
|
}) => {
|
|
135
|
-
const res = await wallet.
|
|
105
|
+
const res = await wallet.createSendBTCOffsetPsbt(
|
|
136
106
|
[
|
|
137
107
|
{
|
|
138
108
|
address: toAddressInfo.address,
|
|
139
109
|
satoshis: toAmount,
|
|
140
110
|
},
|
|
141
111
|
],
|
|
142
|
-
feeRate
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
dispatch(
|
|
146
|
-
(transactionsActions as any).updateBitcoinTx({
|
|
147
|
-
rawtx: res.rawtx,
|
|
148
|
-
psbtHex: res.psbtHex,
|
|
149
|
-
fromAddress,
|
|
150
|
-
feeRate,
|
|
151
|
-
})
|
|
112
|
+
feeRate,
|
|
113
|
+
enableRBF
|
|
152
114
|
)
|
|
153
|
-
|
|
154
|
-
psbtHex: res.psbtHex,
|
|
155
|
-
rawtx: res.rawtx,
|
|
156
|
-
toAddressInfo,
|
|
157
|
-
fee: res.fee,
|
|
158
|
-
}
|
|
159
|
-
return rawTxInfo
|
|
115
|
+
return res
|
|
160
116
|
},
|
|
161
|
-
[dispatch, wallet
|
|
117
|
+
[dispatch, wallet]
|
|
162
118
|
)
|
|
163
119
|
}
|
|
164
120
|
|
|
@@ -196,7 +152,7 @@ export function usePushBitcoinTxCallback() {
|
|
|
196
152
|
|
|
197
153
|
return ret
|
|
198
154
|
},
|
|
199
|
-
[dispatch, wallet]
|
|
155
|
+
[dispatch, wallet, tools]
|
|
200
156
|
)
|
|
201
157
|
}
|
|
202
158
|
|
|
@@ -211,7 +167,6 @@ export function usePrepareSendOrdinalsInscriptionCallback() {
|
|
|
211
167
|
const fromAddress = useAccountAddress()
|
|
212
168
|
const utxos = useUtxos()
|
|
213
169
|
const fetchUtxos = useFetchUtxosCallback()
|
|
214
|
-
const account = useCurrentAccount()
|
|
215
170
|
return useCallback(
|
|
216
171
|
async ({
|
|
217
172
|
toAddressInfo,
|
|
@@ -224,7 +179,7 @@ export function usePrepareSendOrdinalsInscriptionCallback() {
|
|
|
224
179
|
inscriptionId: string
|
|
225
180
|
feeRate?: number
|
|
226
181
|
outputValue?: number
|
|
227
|
-
enableRBF
|
|
182
|
+
enableRBF?: boolean
|
|
228
183
|
}) => {
|
|
229
184
|
if (!feeRate) {
|
|
230
185
|
const summary = await wallet.getFeeSummary()
|
|
@@ -236,31 +191,16 @@ export function usePrepareSendOrdinalsInscriptionCallback() {
|
|
|
236
191
|
btcUtxos = await fetchUtxos()
|
|
237
192
|
}
|
|
238
193
|
|
|
239
|
-
const
|
|
194
|
+
const toSignData = await wallet.createSendInscriptionPsbt({
|
|
240
195
|
to: toAddressInfo.address,
|
|
241
196
|
inscriptionId,
|
|
242
197
|
feeRate,
|
|
243
198
|
outputValue: outputValue!,
|
|
244
|
-
enableRBF,
|
|
245
199
|
btcUtxos,
|
|
200
|
+
enableRBF,
|
|
246
201
|
})
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
rawtx: res.rawtx,
|
|
250
|
-
psbtHex: res.psbtHex,
|
|
251
|
-
fromAddress,
|
|
252
|
-
// inscription,
|
|
253
|
-
feeRate,
|
|
254
|
-
outputValue,
|
|
255
|
-
enableRBF,
|
|
256
|
-
})
|
|
257
|
-
)
|
|
258
|
-
const rawTxInfo: RawTxInfo = {
|
|
259
|
-
psbtHex: res.psbtHex,
|
|
260
|
-
rawtx: res.rawtx,
|
|
261
|
-
toAddressInfo,
|
|
262
|
-
}
|
|
263
|
-
return rawTxInfo
|
|
202
|
+
|
|
203
|
+
return toSignData
|
|
264
204
|
},
|
|
265
205
|
[dispatch, wallet, fromAddress, utxos]
|
|
266
206
|
)
|
|
@@ -272,7 +212,6 @@ export function usePrepareSendOrdinalsInscriptionsCallback() {
|
|
|
272
212
|
const fromAddress = useAccountAddress()
|
|
273
213
|
const fetchUtxos = useFetchUtxosCallback()
|
|
274
214
|
const utxos = useUtxos()
|
|
275
|
-
const account = useCurrentAccount()
|
|
276
215
|
return useCallback(
|
|
277
216
|
async ({
|
|
278
217
|
toAddressInfo,
|
|
@@ -283,7 +222,7 @@ export function usePrepareSendOrdinalsInscriptionsCallback() {
|
|
|
283
222
|
toAddressInfo: ToAddressInfo
|
|
284
223
|
inscriptionIds: string[]
|
|
285
224
|
feeRate?: number
|
|
286
|
-
enableRBF
|
|
225
|
+
enableRBF?: boolean
|
|
287
226
|
}) => {
|
|
288
227
|
if (!feeRate) {
|
|
289
228
|
const summary = await wallet.getFeeSummary()
|
|
@@ -294,28 +233,15 @@ export function usePrepareSendOrdinalsInscriptionsCallback() {
|
|
|
294
233
|
if (btcUtxos.length === 0) {
|
|
295
234
|
btcUtxos = await fetchUtxos()
|
|
296
235
|
}
|
|
297
|
-
const res = await wallet.
|
|
236
|
+
const res = await wallet.createSendMultipleInscriptionsPsbt({
|
|
298
237
|
to: toAddressInfo.address,
|
|
299
238
|
inscriptionIds,
|
|
300
239
|
feeRate,
|
|
301
|
-
enableRBF,
|
|
302
240
|
btcUtxos,
|
|
241
|
+
enableRBF,
|
|
303
242
|
})
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
rawtx: res.rawtx,
|
|
307
|
-
psbtHex: res.psbtHex,
|
|
308
|
-
fromAddress,
|
|
309
|
-
feeRate,
|
|
310
|
-
enableRBF,
|
|
311
|
-
})
|
|
312
|
-
)
|
|
313
|
-
const rawTxInfo: RawTxInfo = {
|
|
314
|
-
psbtHex: res.psbtHex,
|
|
315
|
-
rawtx: res.rawtx,
|
|
316
|
-
toAddressInfo,
|
|
317
|
-
}
|
|
318
|
-
return rawTxInfo
|
|
243
|
+
|
|
244
|
+
return res
|
|
319
245
|
},
|
|
320
246
|
[dispatch, wallet, fromAddress, utxos]
|
|
321
247
|
)
|
|
@@ -338,39 +264,22 @@ export function useCreateSplitTxCallback() {
|
|
|
338
264
|
inscriptionId: string
|
|
339
265
|
feeRate: number
|
|
340
266
|
outputValue: number
|
|
341
|
-
enableRBF
|
|
267
|
+
enableRBF?: boolean
|
|
342
268
|
}) => {
|
|
343
269
|
let btcUtxos = utxos
|
|
344
270
|
if (btcUtxos.length === 0) {
|
|
345
271
|
btcUtxos = await fetchUtxos()
|
|
346
272
|
}
|
|
347
273
|
|
|
348
|
-
const res = await wallet.
|
|
274
|
+
const res = await wallet.createSplitInscriptionPsbt({
|
|
349
275
|
inscriptionId,
|
|
350
276
|
feeRate,
|
|
351
277
|
outputValue,
|
|
352
|
-
enableRBF,
|
|
353
278
|
btcUtxos,
|
|
279
|
+
enableRBF,
|
|
354
280
|
})
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
rawtx: res.rawtx,
|
|
358
|
-
psbtHex: res.psbtHex,
|
|
359
|
-
fromAddress,
|
|
360
|
-
// inscription,
|
|
361
|
-
enableRBF,
|
|
362
|
-
feeRate,
|
|
363
|
-
outputValue,
|
|
364
|
-
})
|
|
365
|
-
)
|
|
366
|
-
const rawTxInfo: RawTxInfo = {
|
|
367
|
-
psbtHex: res.psbtHex,
|
|
368
|
-
rawtx: res.rawtx,
|
|
369
|
-
toAddressInfo: {
|
|
370
|
-
address: fromAddress,
|
|
371
|
-
},
|
|
372
|
-
}
|
|
373
|
-
return { rawTxInfo, splitedCount: res.splitedCount }
|
|
281
|
+
|
|
282
|
+
return res
|
|
374
283
|
},
|
|
375
284
|
[dispatch, wallet, fromAddress, utxos]
|
|
376
285
|
)
|
|
@@ -499,7 +408,7 @@ export function usePrepareSendRunesCallback() {
|
|
|
499
408
|
runeAmount: string
|
|
500
409
|
outputValue?: number
|
|
501
410
|
feeRate: number
|
|
502
|
-
enableRBF
|
|
411
|
+
enableRBF?: boolean
|
|
503
412
|
}) => {
|
|
504
413
|
if (!feeRate) {
|
|
505
414
|
const summary = await wallet.getFeeSummary()
|
|
@@ -516,35 +425,18 @@ export function usePrepareSendRunesCallback() {
|
|
|
516
425
|
assetUtxos = await fetchAssetUtxosRunes(runeid)
|
|
517
426
|
}
|
|
518
427
|
|
|
519
|
-
const
|
|
428
|
+
const toSignData = await wallet.createSendRunesPsbt({
|
|
520
429
|
to: toAddressInfo.address,
|
|
521
430
|
runeid,
|
|
522
431
|
runeAmount,
|
|
523
432
|
outputValue: outputValue!,
|
|
524
433
|
feeRate,
|
|
525
|
-
enableRBF,
|
|
526
434
|
btcUtxos,
|
|
527
435
|
assetUtxos,
|
|
436
|
+
enableRBF,
|
|
528
437
|
})
|
|
529
438
|
|
|
530
|
-
|
|
531
|
-
(transactionsActions as any).updateRunesTx({
|
|
532
|
-
rawtx: res.rawtx,
|
|
533
|
-
psbtHex: res.psbtHex,
|
|
534
|
-
fromAddress,
|
|
535
|
-
feeRate,
|
|
536
|
-
enableRBF,
|
|
537
|
-
runeid,
|
|
538
|
-
runeAmount,
|
|
539
|
-
outputValue,
|
|
540
|
-
})
|
|
541
|
-
)
|
|
542
|
-
const rawTxInfo: RawTxInfo = {
|
|
543
|
-
psbtHex: res.psbtHex,
|
|
544
|
-
rawtx: res.rawtx,
|
|
545
|
-
toAddressInfo,
|
|
546
|
-
}
|
|
547
|
-
return rawTxInfo
|
|
439
|
+
return toSignData
|
|
548
440
|
},
|
|
549
441
|
[dispatch, wallet, fromAddress, utxos, assetUtxosRunes, fetchAssetUtxosRunes, account]
|
|
550
442
|
)
|
|
@@ -564,13 +456,15 @@ export function usePrepareSendAlkanesCallback() {
|
|
|
564
456
|
alkaneid: string,
|
|
565
457
|
amount: string,
|
|
566
458
|
feeRate: number,
|
|
567
|
-
|
|
459
|
+
type: 'ft' | 'nft',
|
|
460
|
+
enableRBF?: boolean
|
|
568
461
|
) => {
|
|
569
|
-
return await wallet.
|
|
462
|
+
return await wallet.createSendAlkanesPsbt({
|
|
570
463
|
to: toAddressInfo.address,
|
|
571
464
|
alkaneid,
|
|
572
465
|
amount,
|
|
573
466
|
feeRate,
|
|
467
|
+
type,
|
|
574
468
|
enableRBF,
|
|
575
469
|
})
|
|
576
470
|
},
|