@unisat/wallet-state 1.1.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.mts +87 -18
- package/lib/index.d.ts +87 -18
- package/lib/index.js +516 -175
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +514 -178
- package/lib/index.mjs.map +1 -1
- package/lib/types/index.d.mts +6 -2
- package/lib/types/index.d.ts +6 -2
- 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/package.json +4 -4
- package/src/context/NavigationContext.tsx +1 -0
- package/src/context/WalletContext.tsx +56 -23
- package/src/hooks/accounts.ts +7 -2
- package/src/hooks/settings.ts +10 -0
- package/src/hooks/transactions.ts +75 -10
- package/src/hooks/ui.ts +83 -63
- package/src/reducers/accounts.ts +3 -0
- package/src/reducers/ui.ts +21 -0
- package/src/types/ui.ts +6 -1
- package/src/ui-hooks/useAddressTypeScreenLogic.ts +22 -8
- package/src/ui-hooks/useAlkanesNFTScreenLogic.ts +3 -2
- package/src/ui-hooks/useAlkanesTokenScreenLogic.ts +12 -2
- package/src/ui-hooks/useBRC20InscribeTransferLogic.ts +30 -10
- package/src/ui-hooks/useBRC20ListLogic.ts +6 -2
- package/src/ui-hooks/useBRC20ProgListLogic.ts +7 -3
- package/src/ui-hooks/useBRC20SendScreenLogic.ts +19 -6
- package/src/ui-hooks/useBRC20TokenScreenLogic.ts +48 -25
- package/src/ui-hooks/useCAT20TokenScreenLogic.ts +16 -2
- package/src/ui-hooks/useCAT721NFTScreenLogic.ts +3 -1
- package/src/ui-hooks/useEditAccountNameScreenLogic.ts +4 -4
- package/src/ui-hooks/useEditWalletNameScreenLogic.ts +5 -3
- package/src/ui-hooks/useOrdinalsInscriptionScreenLogic.ts +3 -2
- package/src/ui-hooks/useRunesTokenScreenLogic.ts +11 -2
- package/src/ui-hooks/useSendAlkanesNFTScreenLogic.ts +24 -2
- package/src/ui-hooks/useSendAlkanesScreenLogic.ts +17 -1
- package/src/ui-hooks/useSendOrdinalsInscriptionScreenLogic.ts +17 -5
- package/src/ui-hooks/useSendRunesScreenLogic.ts +18 -1
- package/src/ui-hooks/useSettingsTabScreenLogic.ts +18 -3
- package/src/ui-hooks/useSignMessageLogic.ts +37 -16
- package/src/ui-hooks/useSignPsbtLogic.ts +31 -15
- package/src/ui-hooks/useSplitOrdinalsInscriptionScreenLogic.ts +15 -1
- package/src/ui-hooks/useTxCreateScreenLogic.ts +17 -1
package/lib/index.mjs
CHANGED
|
@@ -2,8 +2,8 @@ import { save, load } from 'redux-localstorage-simple';
|
|
|
2
2
|
import { createAction, createSlice, configureStore } from '@reduxjs/toolkit';
|
|
3
3
|
import { setupListeners } from '@reduxjs/toolkit/dist/query/react/index.js';
|
|
4
4
|
import { ChainType, AddressType, NetworkType } from '@unisat/wallet-types';
|
|
5
|
-
import { DEFAULT_LOCKTIME_ID, FALLBACK_LOCALE, CHAINS_MAP, CAT_VERSION, PlatformEnv, BUS_METHODS, getAccountDerivationPath, AnnouncementLinkType, getAutoLockTimes, COIN_DUST, RESTORE_WALLETS, WordsType, ADDRESS_TYPES as ADDRESS_TYPES$1, SignState, PsbtActionType, PsbtActionDetailType, RestoreWalletType, OW_HD_PATH, FEEDBACK_URL } from '@unisat/wallet-shared';
|
|
6
|
-
import React, { createContext, useContext, useCallback, useState, useEffect,
|
|
5
|
+
import { DEFAULT_LOCKTIME_ID, FALLBACK_LOCALE, getAccountCapabilities, CHAINS_MAP, CAT_VERSION, PlatformEnv, BUS_METHODS, getAccountDerivationPath, AnnouncementLinkType, MAX_ALIAS_NAME_LENGTH, getAutoLockTimes, COIN_DUST, RESTORE_WALLETS, WordsType, ADDRESS_TYPES as ADDRESS_TYPES$1, SignState, AccountSignMethod, PsbtActionType, PsbtActionDetailType, RestoreWalletType, OW_HD_PATH, FEEDBACK_URL } from '@unisat/wallet-shared';
|
|
6
|
+
import React, { createContext, useContext, useMemo, useCallback, useState, useEffect, useRef, startTransition } from 'react';
|
|
7
7
|
import { jsx } from 'react/jsx-runtime';
|
|
8
8
|
import compareVersions from 'compare-versions';
|
|
9
9
|
import { BABYLON_CONFIG_MAP } from '@unisat/babylon-service/types';
|
|
@@ -122,6 +122,9 @@ var slice = createSlice({
|
|
|
122
122
|
setAddressSummary(state, action) {
|
|
123
123
|
state.addressSummary = action.payload;
|
|
124
124
|
},
|
|
125
|
+
setModelPopover(state, action) {
|
|
126
|
+
state.molelsPopover = action.payload;
|
|
127
|
+
},
|
|
125
128
|
expireBalance(state) {
|
|
126
129
|
const balance = state.balanceMap[state.current.address];
|
|
127
130
|
if (balance) {
|
|
@@ -534,7 +537,7 @@ var AssetTabKey = /* @__PURE__ */ ((AssetTabKey2) => {
|
|
|
534
537
|
AssetTabKey2[AssetTabKey2["ATOMICALS"] = 1] = "ATOMICALS";
|
|
535
538
|
AssetTabKey2[AssetTabKey2["RUNES"] = 2] = "RUNES";
|
|
536
539
|
AssetTabKey2[AssetTabKey2["CAT"] = 3] = "CAT";
|
|
537
|
-
AssetTabKey2[AssetTabKey2["
|
|
540
|
+
AssetTabKey2[AssetTabKey2["MORE"] = 4] = "MORE";
|
|
538
541
|
return AssetTabKey2;
|
|
539
542
|
})(AssetTabKey || {});
|
|
540
543
|
var OrdinalsAssetTabKey = /* @__PURE__ */ ((OrdinalsAssetTabKey2) => {
|
|
@@ -555,6 +558,11 @@ var AlkanesAssetTabKey = /* @__PURE__ */ ((AlkanesAssetTabKey2) => {
|
|
|
555
558
|
AlkanesAssetTabKey2[AlkanesAssetTabKey2["COLLECTION"] = 1] = "COLLECTION";
|
|
556
559
|
return AlkanesAssetTabKey2;
|
|
557
560
|
})(AlkanesAssetTabKey || {});
|
|
561
|
+
var MoreAssetTabKey = /* @__PURE__ */ ((MoreAssetTabKey2) => {
|
|
562
|
+
MoreAssetTabKey2[MoreAssetTabKey2["ALKANES_TOKEN"] = 0] = "ALKANES_TOKEN";
|
|
563
|
+
MoreAssetTabKey2[MoreAssetTabKey2["ALKANES_COLLECTION"] = 1] = "ALKANES_COLLECTION";
|
|
564
|
+
return MoreAssetTabKey2;
|
|
565
|
+
})(MoreAssetTabKey || {});
|
|
558
566
|
var NavigationSource = /* @__PURE__ */ ((NavigationSource2) => {
|
|
559
567
|
NavigationSource2[NavigationSource2["BACK"] = 0] = "BACK";
|
|
560
568
|
NavigationSource2[NavigationSource2["NORMAL"] = 1] = "NORMAL";
|
|
@@ -567,12 +575,14 @@ var initialState7 = {
|
|
|
567
575
|
ordinalsAssetTabKey: 0 /* ALL */,
|
|
568
576
|
catAssetTabKey: 0 /* CAT20 */,
|
|
569
577
|
alkanesAssetTabKey: 0 /* TOKEN */,
|
|
578
|
+
moreAssetTabKey: 0 /* ALKANES_TOKEN */,
|
|
570
579
|
uiTxCreateScreen: {
|
|
571
580
|
toInfo: {
|
|
572
581
|
address: "",
|
|
573
582
|
domain: ""
|
|
574
583
|
},
|
|
575
|
-
inputAmount: ""
|
|
584
|
+
inputAmount: "",
|
|
585
|
+
enableRBF: true
|
|
576
586
|
},
|
|
577
587
|
addressInput: {
|
|
578
588
|
address: "",
|
|
@@ -621,6 +631,9 @@ var slice7 = createSlice({
|
|
|
621
631
|
if (payload.alkanesAssetTabKey !== void 0) {
|
|
622
632
|
state.alkanesAssetTabKey = payload.alkanesAssetTabKey;
|
|
623
633
|
}
|
|
634
|
+
if (payload.moreAssetTabKey !== void 0) {
|
|
635
|
+
state.moreAssetTabKey = payload.moreAssetTabKey;
|
|
636
|
+
}
|
|
624
637
|
return state;
|
|
625
638
|
},
|
|
626
639
|
updateTxCreateScreen(state, action) {
|
|
@@ -630,6 +643,9 @@ var slice7 = createSlice({
|
|
|
630
643
|
if (action.payload.inputAmount !== void 0) {
|
|
631
644
|
state.uiTxCreateScreen.inputAmount = action.payload.inputAmount;
|
|
632
645
|
}
|
|
646
|
+
if (action.payload.enableRBF !== void 0) {
|
|
647
|
+
state.uiTxCreateScreen.enableRBF = action.payload.enableRBF;
|
|
648
|
+
}
|
|
633
649
|
state.uiTxCreateScreen = { ...state.uiTxCreateScreen };
|
|
634
650
|
},
|
|
635
651
|
updateFeeRateBar(state, action) {
|
|
@@ -712,8 +728,16 @@ var slice7 = createSlice({
|
|
|
712
728
|
if (!state.alkanesAssetTabKey) {
|
|
713
729
|
state.alkanesAssetTabKey = 0 /* TOKEN */;
|
|
714
730
|
}
|
|
731
|
+
if (state.moreAssetTabKey === void 0) {
|
|
732
|
+
state.moreAssetTabKey = 0 /* ALKANES_TOKEN */;
|
|
733
|
+
}
|
|
734
|
+
if (state.assetTabKey === 4) {
|
|
735
|
+
state.assetTabKey = 4 /* MORE */;
|
|
736
|
+
}
|
|
715
737
|
if (!state.uiTxCreateScreen) {
|
|
716
738
|
state.uiTxCreateScreen = initialState7.uiTxCreateScreen;
|
|
739
|
+
} else if (state.uiTxCreateScreen.enableRBF === void 0) {
|
|
740
|
+
state.uiTxCreateScreen.enableRBF = true;
|
|
717
741
|
}
|
|
718
742
|
if (!state.feeRateBar) {
|
|
719
743
|
state.feeRateBar = initialState7.feeRateBar;
|
|
@@ -1052,6 +1076,10 @@ function useCurrentAddress() {
|
|
|
1052
1076
|
const accountsState = useAccountsState();
|
|
1053
1077
|
return accountsState.current.address;
|
|
1054
1078
|
}
|
|
1079
|
+
function useCurrentAccountCapabilities() {
|
|
1080
|
+
const currentAccount = useCurrentAccount();
|
|
1081
|
+
return useMemo(() => getAccountCapabilities(currentAccount), [currentAccount]);
|
|
1082
|
+
}
|
|
1055
1083
|
function useAccounts() {
|
|
1056
1084
|
const accountsState = useAccountsState();
|
|
1057
1085
|
return accountsState.accounts;
|
|
@@ -1352,6 +1380,14 @@ function useBRC20TokenInfoExplorerUrl(ticker) {
|
|
|
1352
1380
|
const chain = useChain();
|
|
1353
1381
|
return `${chain.unisatExplorerUrl}/brc20/${encodeURIComponent(ticker)}`;
|
|
1354
1382
|
}
|
|
1383
|
+
function useRunesTokenInfoExplorerUrl(runeId) {
|
|
1384
|
+
const chain = useChain();
|
|
1385
|
+
return `${chain.unisatExplorerUrl}/runes/detail/${encodeURIComponent(runeId)}`;
|
|
1386
|
+
}
|
|
1387
|
+
function useAlkanesTokenInfoExplorerUrl(alkaneId) {
|
|
1388
|
+
const chain = useChain();
|
|
1389
|
+
return `${chain.unisatExplorerUrl}/alkanes/detail/${encodeURIComponent(alkaneId)}`;
|
|
1390
|
+
}
|
|
1355
1391
|
function useUnisatWebsite() {
|
|
1356
1392
|
const chainType = useChainType();
|
|
1357
1393
|
return CHAINS_MAP[chainType].unisatUrl;
|
|
@@ -2089,6 +2125,7 @@ function usePrepareSendBTCCallback() {
|
|
|
2089
2125
|
const fromAddress = useAccountAddress();
|
|
2090
2126
|
const utxos = useUtxos();
|
|
2091
2127
|
const fetchUtxos = useFetchUtxosCallback();
|
|
2128
|
+
const accountCapabilities = useCurrentAccountCapabilities();
|
|
2092
2129
|
const { t } = useI18n();
|
|
2093
2130
|
return useCallback(
|
|
2094
2131
|
async ({
|
|
@@ -2097,8 +2134,12 @@ function usePrepareSendBTCCallback() {
|
|
|
2097
2134
|
feeRate,
|
|
2098
2135
|
memo,
|
|
2099
2136
|
memos,
|
|
2100
|
-
disableAutoAdjust
|
|
2137
|
+
disableAutoAdjust,
|
|
2138
|
+
enableRBF
|
|
2101
2139
|
}) => {
|
|
2140
|
+
if (!accountCapabilities.canCreateSigningRequest) {
|
|
2141
|
+
throw new Error(t("not_supported"));
|
|
2142
|
+
}
|
|
2102
2143
|
let _utxos = utxos;
|
|
2103
2144
|
if (_utxos.length === 0) {
|
|
2104
2145
|
_utxos = await fetchUtxos();
|
|
@@ -2116,7 +2157,8 @@ function usePrepareSendBTCCallback() {
|
|
|
2116
2157
|
res = await wallet.createSendAllBTCPsbt({
|
|
2117
2158
|
to: toAddressInfo.address,
|
|
2118
2159
|
btcUtxos: _utxos,
|
|
2119
|
-
feeRate
|
|
2160
|
+
feeRate,
|
|
2161
|
+
enableRBF
|
|
2120
2162
|
});
|
|
2121
2163
|
} else {
|
|
2122
2164
|
res = await wallet.createSendBTCPsbt({
|
|
@@ -2124,24 +2166,31 @@ function usePrepareSendBTCCallback() {
|
|
|
2124
2166
|
amount: toAmount,
|
|
2125
2167
|
btcUtxos: _utxos,
|
|
2126
2168
|
feeRate,
|
|
2169
|
+
enableRBF,
|
|
2127
2170
|
memo,
|
|
2128
2171
|
memos
|
|
2129
2172
|
});
|
|
2130
2173
|
}
|
|
2131
2174
|
return res;
|
|
2132
2175
|
},
|
|
2133
|
-
[dispatch, wallet, fromAddress, utxos, fetchUtxos]
|
|
2176
|
+
[dispatch, wallet, fromAddress, utxos, fetchUtxos, accountCapabilities.canCreateSigningRequest, t]
|
|
2134
2177
|
);
|
|
2135
2178
|
}
|
|
2136
2179
|
function usePrepareSendBypassHeadOffsetsCallback() {
|
|
2137
2180
|
const dispatch = useAppDispatch();
|
|
2138
2181
|
const wallet = useWallet();
|
|
2182
|
+
const accountCapabilities = useCurrentAccountCapabilities();
|
|
2183
|
+
const { t } = useI18n();
|
|
2139
2184
|
return useCallback(
|
|
2140
2185
|
async ({
|
|
2141
2186
|
toAddressInfo,
|
|
2142
2187
|
toAmount,
|
|
2143
|
-
feeRate
|
|
2188
|
+
feeRate,
|
|
2189
|
+
enableRBF
|
|
2144
2190
|
}) => {
|
|
2191
|
+
if (!accountCapabilities.canCreateSigningRequest) {
|
|
2192
|
+
throw new Error(t("not_supported"));
|
|
2193
|
+
}
|
|
2145
2194
|
const res = await wallet.createSendBTCOffsetPsbt(
|
|
2146
2195
|
[
|
|
2147
2196
|
{
|
|
@@ -2149,11 +2198,12 @@ function usePrepareSendBypassHeadOffsetsCallback() {
|
|
|
2149
2198
|
satoshis: toAmount
|
|
2150
2199
|
}
|
|
2151
2200
|
],
|
|
2152
|
-
feeRate
|
|
2201
|
+
feeRate,
|
|
2202
|
+
enableRBF
|
|
2153
2203
|
);
|
|
2154
2204
|
return res;
|
|
2155
2205
|
},
|
|
2156
|
-
[dispatch, wallet]
|
|
2206
|
+
[dispatch, wallet, accountCapabilities.canCreateSigningRequest, t]
|
|
2157
2207
|
);
|
|
2158
2208
|
}
|
|
2159
2209
|
function usePushBitcoinTxCallback() {
|
|
@@ -2201,13 +2251,19 @@ function usePrepareSendOrdinalsInscriptionCallback() {
|
|
|
2201
2251
|
const fromAddress = useAccountAddress();
|
|
2202
2252
|
const utxos = useUtxos();
|
|
2203
2253
|
const fetchUtxos = useFetchUtxosCallback();
|
|
2254
|
+
const accountCapabilities = useCurrentAccountCapabilities();
|
|
2255
|
+
const { t } = useI18n();
|
|
2204
2256
|
return useCallback(
|
|
2205
2257
|
async ({
|
|
2206
2258
|
toAddressInfo,
|
|
2207
2259
|
inscriptionId,
|
|
2208
2260
|
feeRate,
|
|
2209
|
-
outputValue
|
|
2261
|
+
outputValue,
|
|
2262
|
+
enableRBF
|
|
2210
2263
|
}) => {
|
|
2264
|
+
if (!accountCapabilities.canCreateSigningRequest) {
|
|
2265
|
+
throw new Error(t("not_supported"));
|
|
2266
|
+
}
|
|
2211
2267
|
if (!feeRate) {
|
|
2212
2268
|
const summary = await wallet.getFeeSummary();
|
|
2213
2269
|
feeRate = summary.list[1].feeRate;
|
|
@@ -2221,11 +2277,12 @@ function usePrepareSendOrdinalsInscriptionCallback() {
|
|
|
2221
2277
|
inscriptionId,
|
|
2222
2278
|
feeRate,
|
|
2223
2279
|
outputValue,
|
|
2224
|
-
btcUtxos
|
|
2280
|
+
btcUtxos,
|
|
2281
|
+
enableRBF
|
|
2225
2282
|
});
|
|
2226
2283
|
return toSignData;
|
|
2227
2284
|
},
|
|
2228
|
-
[dispatch, wallet, fromAddress, utxos]
|
|
2285
|
+
[dispatch, wallet, fromAddress, utxos, accountCapabilities.canCreateSigningRequest, t]
|
|
2229
2286
|
);
|
|
2230
2287
|
}
|
|
2231
2288
|
function usePrepareSendOrdinalsInscriptionsCallback() {
|
|
@@ -2234,12 +2291,18 @@ function usePrepareSendOrdinalsInscriptionsCallback() {
|
|
|
2234
2291
|
const fromAddress = useAccountAddress();
|
|
2235
2292
|
const fetchUtxos = useFetchUtxosCallback();
|
|
2236
2293
|
const utxos = useUtxos();
|
|
2294
|
+
const accountCapabilities = useCurrentAccountCapabilities();
|
|
2295
|
+
const { t } = useI18n();
|
|
2237
2296
|
return useCallback(
|
|
2238
2297
|
async ({
|
|
2239
2298
|
toAddressInfo,
|
|
2240
2299
|
inscriptionIds,
|
|
2241
|
-
feeRate
|
|
2300
|
+
feeRate,
|
|
2301
|
+
enableRBF
|
|
2242
2302
|
}) => {
|
|
2303
|
+
if (!accountCapabilities.canCreateSigningRequest) {
|
|
2304
|
+
throw new Error(t("not_supported"));
|
|
2305
|
+
}
|
|
2243
2306
|
if (!feeRate) {
|
|
2244
2307
|
const summary = await wallet.getFeeSummary();
|
|
2245
2308
|
feeRate = summary.list[1].feeRate;
|
|
@@ -2252,11 +2315,12 @@ function usePrepareSendOrdinalsInscriptionsCallback() {
|
|
|
2252
2315
|
to: toAddressInfo.address,
|
|
2253
2316
|
inscriptionIds,
|
|
2254
2317
|
feeRate,
|
|
2255
|
-
btcUtxos
|
|
2318
|
+
btcUtxos,
|
|
2319
|
+
enableRBF
|
|
2256
2320
|
});
|
|
2257
2321
|
return res;
|
|
2258
2322
|
},
|
|
2259
|
-
[dispatch, wallet, fromAddress, utxos]
|
|
2323
|
+
[dispatch, wallet, fromAddress, utxos, accountCapabilities.canCreateSigningRequest, t]
|
|
2260
2324
|
);
|
|
2261
2325
|
}
|
|
2262
2326
|
function useCreateSplitTxCallback() {
|
|
@@ -2266,12 +2330,18 @@ function useCreateSplitTxCallback() {
|
|
|
2266
2330
|
const utxos = useUtxos();
|
|
2267
2331
|
const fetchUtxos = useFetchUtxosCallback();
|
|
2268
2332
|
useCurrentAccount();
|
|
2333
|
+
const accountCapabilities = useCurrentAccountCapabilities();
|
|
2334
|
+
const { t } = useI18n();
|
|
2269
2335
|
return useCallback(
|
|
2270
2336
|
async ({
|
|
2271
2337
|
inscriptionId,
|
|
2272
2338
|
feeRate,
|
|
2273
|
-
outputValue
|
|
2339
|
+
outputValue,
|
|
2340
|
+
enableRBF
|
|
2274
2341
|
}) => {
|
|
2342
|
+
if (!accountCapabilities.canCreateSigningRequest) {
|
|
2343
|
+
throw new Error(t("not_supported"));
|
|
2344
|
+
}
|
|
2275
2345
|
let btcUtxos = utxos;
|
|
2276
2346
|
if (btcUtxos.length === 0) {
|
|
2277
2347
|
btcUtxos = await fetchUtxos();
|
|
@@ -2280,11 +2350,12 @@ function useCreateSplitTxCallback() {
|
|
|
2280
2350
|
inscriptionId,
|
|
2281
2351
|
feeRate,
|
|
2282
2352
|
outputValue,
|
|
2283
|
-
btcUtxos
|
|
2353
|
+
btcUtxos,
|
|
2354
|
+
enableRBF
|
|
2284
2355
|
});
|
|
2285
2356
|
return res;
|
|
2286
2357
|
},
|
|
2287
|
-
[dispatch, wallet, fromAddress, utxos]
|
|
2358
|
+
[dispatch, wallet, fromAddress, utxos, accountCapabilities.canCreateSigningRequest, t]
|
|
2288
2359
|
);
|
|
2289
2360
|
}
|
|
2290
2361
|
function usePushOrdinalsTxCallback() {
|
|
@@ -2383,14 +2454,20 @@ function usePrepareSendRunesCallback() {
|
|
|
2383
2454
|
const assetUtxosRunes = useAssetUtxosRunes();
|
|
2384
2455
|
const fetchAssetUtxosRunes = useFetchAssetUtxosRunesCallback();
|
|
2385
2456
|
const account = useCurrentAccount();
|
|
2457
|
+
const accountCapabilities = useCurrentAccountCapabilities();
|
|
2458
|
+
const { t } = useI18n();
|
|
2386
2459
|
return useCallback(
|
|
2387
2460
|
async ({
|
|
2388
2461
|
toAddressInfo,
|
|
2389
2462
|
runeid,
|
|
2390
2463
|
runeAmount,
|
|
2391
2464
|
outputValue,
|
|
2392
|
-
feeRate
|
|
2465
|
+
feeRate,
|
|
2466
|
+
enableRBF
|
|
2393
2467
|
}) => {
|
|
2468
|
+
if (!accountCapabilities.canCreateSigningRequest) {
|
|
2469
|
+
throw new Error(t("not_supported"));
|
|
2470
|
+
}
|
|
2394
2471
|
if (!feeRate) {
|
|
2395
2472
|
const summary = await wallet.getFeeSummary();
|
|
2396
2473
|
feeRate = summary.list[1].feeRate;
|
|
@@ -2410,11 +2487,22 @@ function usePrepareSendRunesCallback() {
|
|
|
2410
2487
|
outputValue,
|
|
2411
2488
|
feeRate,
|
|
2412
2489
|
btcUtxos,
|
|
2413
|
-
assetUtxos
|
|
2490
|
+
assetUtxos,
|
|
2491
|
+
enableRBF
|
|
2414
2492
|
});
|
|
2415
2493
|
return toSignData;
|
|
2416
2494
|
},
|
|
2417
|
-
[
|
|
2495
|
+
[
|
|
2496
|
+
dispatch,
|
|
2497
|
+
wallet,
|
|
2498
|
+
fromAddress,
|
|
2499
|
+
utxos,
|
|
2500
|
+
assetUtxosRunes,
|
|
2501
|
+
fetchAssetUtxosRunes,
|
|
2502
|
+
account,
|
|
2503
|
+
accountCapabilities.canCreateSigningRequest,
|
|
2504
|
+
t
|
|
2505
|
+
]
|
|
2418
2506
|
);
|
|
2419
2507
|
}
|
|
2420
2508
|
function useRunesTx() {
|
|
@@ -2424,17 +2512,23 @@ function useRunesTx() {
|
|
|
2424
2512
|
function usePrepareSendAlkanesCallback() {
|
|
2425
2513
|
const wallet = useWallet();
|
|
2426
2514
|
const account = useCurrentAccount();
|
|
2515
|
+
const accountCapabilities = useCurrentAccountCapabilities();
|
|
2516
|
+
const { t } = useI18n();
|
|
2427
2517
|
const callback = useCallback(
|
|
2428
|
-
async (toAddressInfo, alkaneid, amount, feeRate, type) => {
|
|
2518
|
+
async (toAddressInfo, alkaneid, amount, feeRate, type, enableRBF) => {
|
|
2519
|
+
if (!accountCapabilities.canCreateSigningRequest) {
|
|
2520
|
+
throw new Error(t("not_supported"));
|
|
2521
|
+
}
|
|
2429
2522
|
return await wallet.createSendAlkanesPsbt({
|
|
2430
2523
|
to: toAddressInfo.address,
|
|
2431
2524
|
alkaneid,
|
|
2432
2525
|
amount,
|
|
2433
2526
|
feeRate,
|
|
2434
|
-
type
|
|
2527
|
+
type,
|
|
2528
|
+
enableRBF
|
|
2435
2529
|
});
|
|
2436
2530
|
},
|
|
2437
|
-
[wallet, account]
|
|
2531
|
+
[wallet, account, accountCapabilities.canCreateSigningRequest, t]
|
|
2438
2532
|
);
|
|
2439
2533
|
return callback;
|
|
2440
2534
|
}
|
|
@@ -2457,23 +2551,32 @@ function useAlkanesAssetTabKey() {
|
|
|
2457
2551
|
const uiState = useUIState();
|
|
2458
2552
|
return uiState.alkanesAssetTabKey;
|
|
2459
2553
|
}
|
|
2554
|
+
function useMoreAssetTabKey() {
|
|
2555
|
+
const uiState = useUIState();
|
|
2556
|
+
return uiState.moreAssetTabKey;
|
|
2557
|
+
}
|
|
2460
2558
|
function useUiTxCreateScreen() {
|
|
2461
2559
|
const uiState = useUIState();
|
|
2462
2560
|
return uiState.uiTxCreateScreen;
|
|
2463
2561
|
}
|
|
2464
2562
|
function useUpdateUiTxCreateScreen() {
|
|
2465
2563
|
const dispatch = useAppDispatch();
|
|
2466
|
-
return (
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2564
|
+
return useCallback(
|
|
2565
|
+
({
|
|
2566
|
+
toInfo,
|
|
2567
|
+
inputAmount,
|
|
2568
|
+
enableRBF
|
|
2569
|
+
}) => {
|
|
2570
|
+
dispatch(
|
|
2571
|
+
uiActions.updateTxCreateScreen({
|
|
2572
|
+
toInfo,
|
|
2573
|
+
inputAmount,
|
|
2574
|
+
enableRBF
|
|
2575
|
+
})
|
|
2576
|
+
);
|
|
2577
|
+
},
|
|
2578
|
+
[dispatch]
|
|
2579
|
+
);
|
|
2477
2580
|
}
|
|
2478
2581
|
function useFeeRateBar() {
|
|
2479
2582
|
const uiState = useUIState();
|
|
@@ -2481,29 +2584,32 @@ function useFeeRateBar() {
|
|
|
2481
2584
|
}
|
|
2482
2585
|
function useUpdateFeeRateBar() {
|
|
2483
2586
|
const dispatch = useAppDispatch();
|
|
2484
|
-
return (
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2587
|
+
return useCallback(
|
|
2588
|
+
({
|
|
2589
|
+
feeRate,
|
|
2590
|
+
feeRateInputVal,
|
|
2591
|
+
enableLowFeeRate,
|
|
2592
|
+
feeOptionIndex,
|
|
2593
|
+
showCustomInput
|
|
2594
|
+
}) => {
|
|
2595
|
+
dispatch(
|
|
2596
|
+
uiActions.updateFeeRateBar({
|
|
2597
|
+
feeRate,
|
|
2598
|
+
feeRateInputVal,
|
|
2599
|
+
enableLowFeeRate,
|
|
2600
|
+
feeOptionIndex,
|
|
2601
|
+
showCustomInput
|
|
2602
|
+
})
|
|
2603
|
+
);
|
|
2604
|
+
},
|
|
2605
|
+
[dispatch]
|
|
2606
|
+
);
|
|
2501
2607
|
}
|
|
2502
2608
|
function useResetFeeRateBar() {
|
|
2503
2609
|
const dispatch = useAppDispatch();
|
|
2504
|
-
return () => {
|
|
2610
|
+
return useCallback(() => {
|
|
2505
2611
|
dispatch(uiActions.resetFeeRateBar());
|
|
2506
|
-
};
|
|
2612
|
+
}, [dispatch]);
|
|
2507
2613
|
}
|
|
2508
2614
|
function useAddressInput() {
|
|
2509
2615
|
const uiState = useUIState();
|
|
@@ -2511,20 +2617,23 @@ function useAddressInput() {
|
|
|
2511
2617
|
}
|
|
2512
2618
|
function useUpdateAddressInput() {
|
|
2513
2619
|
const dispatch = useAppDispatch();
|
|
2514
|
-
return (
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2620
|
+
return useCallback(
|
|
2621
|
+
({ address, domain }) => {
|
|
2622
|
+
dispatch(
|
|
2623
|
+
uiActions.updateAddressInput({
|
|
2624
|
+
address,
|
|
2625
|
+
domain
|
|
2626
|
+
})
|
|
2627
|
+
);
|
|
2628
|
+
},
|
|
2629
|
+
[dispatch]
|
|
2630
|
+
);
|
|
2522
2631
|
}
|
|
2523
2632
|
function useResetAddressInput() {
|
|
2524
2633
|
const dispatch = useAppDispatch();
|
|
2525
|
-
return () => {
|
|
2634
|
+
return useCallback(() => {
|
|
2526
2635
|
dispatch(uiActions.resetAddressInput());
|
|
2527
|
-
};
|
|
2636
|
+
}, [dispatch]);
|
|
2528
2637
|
}
|
|
2529
2638
|
function useAmountInput() {
|
|
2530
2639
|
const uiState = useUIState();
|
|
@@ -2532,32 +2641,35 @@ function useAmountInput() {
|
|
|
2532
2641
|
}
|
|
2533
2642
|
function useUpdateAmountInput() {
|
|
2534
2643
|
const dispatch = useAppDispatch();
|
|
2535
|
-
return (
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2644
|
+
return useCallback(
|
|
2645
|
+
({ amount }) => {
|
|
2646
|
+
dispatch(
|
|
2647
|
+
uiActions.updateAmountInput({
|
|
2648
|
+
amount
|
|
2649
|
+
})
|
|
2650
|
+
);
|
|
2651
|
+
},
|
|
2652
|
+
[dispatch]
|
|
2653
|
+
);
|
|
2542
2654
|
}
|
|
2543
2655
|
function useResetAmountInput() {
|
|
2544
2656
|
const dispatch = useAppDispatch();
|
|
2545
|
-
return () => {
|
|
2657
|
+
return useCallback(() => {
|
|
2546
2658
|
dispatch(uiActions.resetAmountInput());
|
|
2547
|
-
};
|
|
2659
|
+
}, [dispatch]);
|
|
2548
2660
|
}
|
|
2549
2661
|
function useResetTxState() {
|
|
2550
2662
|
const dispatch = useAppDispatch();
|
|
2551
|
-
return () => {
|
|
2663
|
+
return useCallback(() => {
|
|
2552
2664
|
dispatch(uiActions.resetTxCreateScreen());
|
|
2553
2665
|
dispatch(uiActions.resetFeeRateBar());
|
|
2554
|
-
};
|
|
2666
|
+
}, [dispatch]);
|
|
2555
2667
|
}
|
|
2556
2668
|
function useResetUiTxCreateScreen() {
|
|
2557
2669
|
const dispatch = useAppDispatch();
|
|
2558
|
-
return () => {
|
|
2670
|
+
return useCallback(() => {
|
|
2559
2671
|
dispatch(uiActions.resetTxCreateScreen());
|
|
2560
|
-
};
|
|
2672
|
+
}, [dispatch]);
|
|
2561
2673
|
}
|
|
2562
2674
|
var useThrottle = (callback, delay, lastCallRef) => {
|
|
2563
2675
|
return useCallback(
|
|
@@ -2593,7 +2705,7 @@ function getSupportedAssets(chainType, address) {
|
|
|
2593
2705
|
}
|
|
2594
2706
|
if (chainType === ChainType.BITCOIN_MAINNET || chainType === ChainType.BITCOIN_SIGNET) {
|
|
2595
2707
|
assets.alkanes = true;
|
|
2596
|
-
assetTabKeys.push(4 /*
|
|
2708
|
+
assetTabKeys.push(4 /* MORE */);
|
|
2597
2709
|
}
|
|
2598
2710
|
if (chainType === ChainType.BITCOIN_MAINNET || chainType === ChainType.BITCOIN_SIGNET) {
|
|
2599
2711
|
assets.brc20Prog = true;
|
|
@@ -2844,6 +2956,10 @@ function useAddressTypeScreenLogic() {
|
|
|
2844
2956
|
const wallet = useWallet();
|
|
2845
2957
|
const currentKeyring = useCurrentKeyring();
|
|
2846
2958
|
const account = useCurrentAccount();
|
|
2959
|
+
const currentKeyringCapabilities = useMemo(
|
|
2960
|
+
() => getAccountCapabilities({ type: currentKeyring.type }),
|
|
2961
|
+
[currentKeyring.type]
|
|
2962
|
+
);
|
|
2847
2963
|
const nav = useNavigation();
|
|
2848
2964
|
useAppDispatch();
|
|
2849
2965
|
const reloadAccounts = useReloadAccounts();
|
|
@@ -2881,7 +2997,7 @@ function useAddressTypeScreenLogic() {
|
|
|
2881
2997
|
loadAddresses();
|
|
2882
2998
|
}, []);
|
|
2883
2999
|
const addressTypes = useMemo(() => {
|
|
2884
|
-
if (
|
|
3000
|
+
if (!currentKeyringCapabilities.canChangeAddressType) {
|
|
2885
3001
|
return ADDRESS_TYPES.filter((v) => v.value === currentKeyring.addressType);
|
|
2886
3002
|
}
|
|
2887
3003
|
if (currentKeyring.type === KeyringType.HdKeyring) {
|
|
@@ -2906,7 +3022,14 @@ function useAddressTypeScreenLogic() {
|
|
|
2906
3022
|
(a, b) => a.displayIndex - b.displayIndex
|
|
2907
3023
|
);
|
|
2908
3024
|
}
|
|
2909
|
-
}, [
|
|
3025
|
+
}, [
|
|
3026
|
+
currentKeyring.type,
|
|
3027
|
+
currentKeyring.addressType,
|
|
3028
|
+
currentKeyringCapabilities.canChangeAddressType,
|
|
3029
|
+
currentKeyring.accountIndexDerivation,
|
|
3030
|
+
addressAssets,
|
|
3031
|
+
addresses
|
|
3032
|
+
]);
|
|
2910
3033
|
const items = useMemo(() => {
|
|
2911
3034
|
return addressTypes.map((v) => {
|
|
2912
3035
|
const address = addresses[v.value];
|
|
@@ -2915,7 +3038,11 @@ function useAddressTypeScreenLogic() {
|
|
|
2915
3038
|
satoshis: 0,
|
|
2916
3039
|
total_inscription: 0
|
|
2917
3040
|
};
|
|
2918
|
-
const derivedPath = getAccountDerivationPath(
|
|
3041
|
+
const derivedPath = getAccountDerivationPath(
|
|
3042
|
+
v.hdPath,
|
|
3043
|
+
account.index || 0,
|
|
3044
|
+
currentKeyring.accountIndexDerivation
|
|
3045
|
+
);
|
|
2919
3046
|
let name = `${v.name} (${derivedPath})`;
|
|
2920
3047
|
if (currentKeyring.type === KeyringType.SimpleKeyring) {
|
|
2921
3048
|
name = `${v.name}`;
|
|
@@ -2934,8 +3061,8 @@ function useAddressTypeScreenLogic() {
|
|
|
2934
3061
|
if (item.value == currentKeyring.addressType) {
|
|
2935
3062
|
return;
|
|
2936
3063
|
}
|
|
2937
|
-
if (
|
|
2938
|
-
tools.toastError(t("
|
|
3064
|
+
if (!currentKeyringCapabilities.canChangeAddressType) {
|
|
3065
|
+
tools.toastError(t("not_supported"));
|
|
2939
3066
|
return;
|
|
2940
3067
|
}
|
|
2941
3068
|
await wallet.changeAddressType(item.value);
|
|
@@ -3204,6 +3331,7 @@ var BRC20SendTabKey = /* @__PURE__ */ ((BRC20SendTabKey2) => {
|
|
|
3204
3331
|
})(BRC20SendTabKey || {});
|
|
3205
3332
|
function useBRC20SendScreenLogic() {
|
|
3206
3333
|
const nav = useNavigation();
|
|
3334
|
+
const wallet = useWallet();
|
|
3207
3335
|
const props = nav.getRouteState();
|
|
3208
3336
|
const tokenBalance = props.tokenBalance;
|
|
3209
3337
|
const selectedInscriptionIds = props.selectedInscriptionIds || [];
|
|
@@ -3215,6 +3343,7 @@ function useBRC20SendScreenLogic() {
|
|
|
3215
3343
|
transferableList: [],
|
|
3216
3344
|
inscriptionIdSet: new Set(selectedInscriptionIds),
|
|
3217
3345
|
receiver: "",
|
|
3346
|
+
enableRBF: true,
|
|
3218
3347
|
rawTxInfo: {
|
|
3219
3348
|
psbtHex: "",
|
|
3220
3349
|
rawtx: ""
|
|
@@ -3254,6 +3383,11 @@ function useBRC20SendScreenLogic() {
|
|
|
3254
3383
|
updateContextData({ tabKey: key });
|
|
3255
3384
|
};
|
|
3256
3385
|
const { t } = useI18n();
|
|
3386
|
+
useEffect(() => {
|
|
3387
|
+
wallet.getEnableRBF().then((enableRBF) => {
|
|
3388
|
+
updateContextData({ enableRBF });
|
|
3389
|
+
});
|
|
3390
|
+
}, [wallet, updateContextData]);
|
|
3257
3391
|
return {
|
|
3258
3392
|
t,
|
|
3259
3393
|
contextData,
|
|
@@ -3325,14 +3459,16 @@ function useBRC20SendScreenLogicStep2({
|
|
|
3325
3459
|
toAddressInfo: { address: contextData.receiver, domain: "" },
|
|
3326
3460
|
inscriptionId: inscriptionIds[0],
|
|
3327
3461
|
feeRate: feeRateBar.feeRate,
|
|
3328
|
-
outputValue: getAddressUtxoDust(contextData.receiver)
|
|
3462
|
+
outputValue: getAddressUtxoDust(contextData.receiver),
|
|
3463
|
+
enableRBF: contextData.enableRBF
|
|
3329
3464
|
});
|
|
3330
3465
|
nav.navigate("TxConfirmScreen", { toSignData });
|
|
3331
3466
|
} else {
|
|
3332
3467
|
const toSignData = await prepareSendOrdinalsInscriptions({
|
|
3333
3468
|
toAddressInfo: { address: contextData.receiver, domain: "" },
|
|
3334
3469
|
inscriptionIds,
|
|
3335
|
-
feeRate: feeRateBar.feeRate
|
|
3470
|
+
feeRate: feeRateBar.feeRate,
|
|
3471
|
+
enableRBF: contextData.enableRBF
|
|
3336
3472
|
});
|
|
3337
3473
|
nav.navigate("TxConfirmScreen", { toSignData });
|
|
3338
3474
|
}
|
|
@@ -3415,12 +3551,13 @@ function useTransferableListLogic({ contextData, updateContextData }) {
|
|
|
3415
3551
|
const fetchData = async () => {
|
|
3416
3552
|
try {
|
|
3417
3553
|
setLoading(true);
|
|
3418
|
-
const { list, total: total2 } = await wallet.getBRC20TransferableList(
|
|
3419
|
-
currentAccount.address,
|
|
3420
|
-
contextData.tokenBalance.ticker,
|
|
3421
|
-
|
|
3422
|
-
pagination.
|
|
3423
|
-
|
|
3554
|
+
const { list, total: total2 } = await wallet.getBRC20TransferableList({
|
|
3555
|
+
address: currentAccount.address,
|
|
3556
|
+
ticker: contextData.tokenBalance.ticker,
|
|
3557
|
+
tickerHex: contextData.tokenBalance.tickerHex,
|
|
3558
|
+
currentPage: pagination.currentPage,
|
|
3559
|
+
pageSize: pagination.pageSize
|
|
3560
|
+
});
|
|
3424
3561
|
setItems(list);
|
|
3425
3562
|
setTotal(total2);
|
|
3426
3563
|
} catch (e) {
|
|
@@ -3707,6 +3844,7 @@ var BRC20TokenScreenTabKey = /* @__PURE__ */ ((BRC20TokenScreenTabKey2) => {
|
|
|
3707
3844
|
BRC20TokenScreenTabKey2["HISTORY"] = "history";
|
|
3708
3845
|
return BRC20TokenScreenTabKey2;
|
|
3709
3846
|
})(BRC20TokenScreenTabKey || {});
|
|
3847
|
+
var INSWAP_SWAP_ANCHOR = "#swap";
|
|
3710
3848
|
function useBRC20TokenHistoryLogic(props) {
|
|
3711
3849
|
const wallet = useWallet();
|
|
3712
3850
|
const { t } = useI18n();
|
|
@@ -3828,6 +3966,7 @@ function useBRC20TokenScreenLogic() {
|
|
|
3828
3966
|
const [tokenSummary, setTokenSummary] = useState({
|
|
3829
3967
|
tokenBalance: {
|
|
3830
3968
|
ticker,
|
|
3969
|
+
tickerHex: Buffer.from(ticker).toString("hex"),
|
|
3831
3970
|
overallBalance: "",
|
|
3832
3971
|
availableBalance: "",
|
|
3833
3972
|
transferableBalance: "",
|
|
@@ -3850,11 +3989,15 @@ function useBRC20TokenScreenLogic() {
|
|
|
3850
3989
|
});
|
|
3851
3990
|
const wallet = useWallet();
|
|
3852
3991
|
const account = useCurrentAccount();
|
|
3992
|
+
const accountCapabilities = useCurrentAccountCapabilities();
|
|
3853
3993
|
const [loading, setLoading] = useState(true);
|
|
3854
3994
|
const [deployInscription, setDeployInscription] = useState();
|
|
3855
3995
|
const resetTxState = useResetTxState();
|
|
3856
3996
|
useEffect(() => {
|
|
3857
|
-
wallet.getBRC20Summary(
|
|
3997
|
+
wallet.getBRC20Summary({
|
|
3998
|
+
address: account.address,
|
|
3999
|
+
ticker
|
|
4000
|
+
}).then((tokenSummary2) => {
|
|
3858
4001
|
if (tokenSummary2.tokenInfo.holder == account.address) {
|
|
3859
4002
|
wallet.getInscriptionInfo(tokenSummary2.tokenInfo.inscriptionId).then((data) => {
|
|
3860
4003
|
setDeployInscription(data);
|
|
@@ -3887,11 +4030,11 @@ function useBRC20TokenScreenLogic() {
|
|
|
3887
4030
|
}, [tokenSummary]);
|
|
3888
4031
|
const enableTransfer = useMemo(() => {
|
|
3889
4032
|
let enable = false;
|
|
3890
|
-
if (tokenSummary.tokenBalance.overallBalance !== "0" && tokenSummary.tokenBalance.overallBalance !== "") {
|
|
4033
|
+
if (accountCapabilities.canCreateSigningRequest && tokenSummary.tokenBalance.overallBalance !== "0" && tokenSummary.tokenBalance.overallBalance !== "") {
|
|
3891
4034
|
enable = true;
|
|
3892
4035
|
}
|
|
3893
4036
|
return enable;
|
|
3894
|
-
}, [tokenSummary]);
|
|
4037
|
+
}, [accountCapabilities.canCreateSigningRequest, tokenSummary]);
|
|
3895
4038
|
const tools = useTools();
|
|
3896
4039
|
const chainType = useChainType();
|
|
3897
4040
|
const chain = useChain();
|
|
@@ -3926,6 +4069,10 @@ function useBRC20TokenScreenLogic() {
|
|
|
3926
4069
|
return items;
|
|
3927
4070
|
}
|
|
3928
4071
|
}, [t, enableHistory]);
|
|
4072
|
+
const showSwapBalance = chain.isFractal;
|
|
4073
|
+
const showProgBalance = chain.enableBrc20Prog;
|
|
4074
|
+
const swapSiteEnabled = chain.enum === ChainType.FRACTAL_BITCOIN_MAINNET;
|
|
4075
|
+
const progSiteEnabled = chain.enum === ChainType.BITCOIN_MAINNET;
|
|
3929
4076
|
const onSwapBalance = tokenSummary?.tokenBalance?.swapBalance;
|
|
3930
4077
|
const onProgBalance = tokenSummary?.tokenBalance?.progBalance;
|
|
3931
4078
|
const inWalletBalance = tokenSummary?.tokenBalance?.overallBalance;
|
|
@@ -3937,14 +4084,14 @@ function useBRC20TokenScreenLogic() {
|
|
|
3937
4084
|
amount: inWalletBalance || "0"
|
|
3938
4085
|
}
|
|
3939
4086
|
];
|
|
3940
|
-
if (
|
|
4087
|
+
if (showSwapBalance) {
|
|
3941
4088
|
items.push({
|
|
3942
4089
|
key: "swap",
|
|
3943
4090
|
label: t("brc20_on_swap"),
|
|
3944
4091
|
amount: onSwapBalance
|
|
3945
4092
|
});
|
|
3946
4093
|
}
|
|
3947
|
-
if (
|
|
4094
|
+
if (showProgBalance) {
|
|
3948
4095
|
items.push({
|
|
3949
4096
|
key: "prog",
|
|
3950
4097
|
label: t("brc20_on_prog"),
|
|
@@ -3959,47 +4106,61 @@ function useBRC20TokenScreenLogic() {
|
|
|
3959
4106
|
}
|
|
3960
4107
|
return new BigNumber(inWalletBalance).plus(new BigNumber(onSwapBalance || 0)).plus(new BigNumber(onProgBalance || 0)).toString();
|
|
3961
4108
|
}, [onSwapBalance, onProgBalance, inWalletBalance]);
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
4109
|
+
const brc20prog_ticker = encodeURIComponent(ticker);
|
|
4110
|
+
const ensureSiteEnabled = (enabled) => {
|
|
4111
|
+
if (!enabled) {
|
|
4112
|
+
tools.toastError(t("not_supported"));
|
|
4113
|
+
return false;
|
|
4114
|
+
}
|
|
4115
|
+
return true;
|
|
4116
|
+
};
|
|
3969
4117
|
const onClickWrapBrc20Prog = () => {
|
|
3970
|
-
|
|
4118
|
+
if (!ensureSiteEnabled(progSiteEnabled))
|
|
4119
|
+
return;
|
|
4120
|
+
const url = `https://link.unisat.space/btc/wrap?tick=${brc20prog_ticker}`;
|
|
3971
4121
|
nav.navToUrl(url);
|
|
3972
4122
|
};
|
|
3973
4123
|
const onClickUnwrapBrc20Prog = () => {
|
|
3974
|
-
|
|
4124
|
+
if (!ensureSiteEnabled(progSiteEnabled))
|
|
4125
|
+
return;
|
|
4126
|
+
const url = `https://link.unisat.space/btc/wrap?action=unwrap&tick=${brc20prog_ticker}`;
|
|
3975
4127
|
nav.navToUrl(url);
|
|
3976
4128
|
};
|
|
3977
4129
|
const onClickSendBrc20Prog = () => {
|
|
3978
|
-
|
|
4130
|
+
if (!ensureSiteEnabled(progSiteEnabled))
|
|
4131
|
+
return;
|
|
4132
|
+
const url = `https://bestinslot.xyz/brc2.0/${brc20prog_ticker}/transfer`;
|
|
3979
4133
|
nav.navToUrl(url);
|
|
3980
4134
|
};
|
|
4135
|
+
const inswap_ticker = encodeURIComponent(ticker);
|
|
3981
4136
|
const onClickSwapInSwap = () => {
|
|
3982
|
-
|
|
4137
|
+
if (!ensureSiteEnabled(swapSiteEnabled))
|
|
4138
|
+
return;
|
|
4139
|
+
const url = `https://inswap.cc/swap/pools?q=${inswap_ticker}`;
|
|
3983
4140
|
nav.navToUrl(url);
|
|
3984
4141
|
};
|
|
3985
4142
|
const onClickAddLiquidityInSwap = () => {
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
const onClickRemoveLiquidityInSwap = () => {
|
|
3990
|
-
const url = `https://inswap.cc/swap/pools?t0=${encodeURIComponent(ticker)}&t1=sFB___000&action=remove`;
|
|
4143
|
+
if (!ensureSiteEnabled(swapSiteEnabled))
|
|
4144
|
+
return;
|
|
4145
|
+
const url = `https://inswap.cc/swap/pools?q=${inswap_ticker}`;
|
|
3991
4146
|
nav.navToUrl(url);
|
|
3992
4147
|
};
|
|
3993
4148
|
const onClickWrapInSwap = () => {
|
|
3994
|
-
|
|
4149
|
+
if (!ensureSiteEnabled(swapSiteEnabled))
|
|
4150
|
+
return;
|
|
4151
|
+
const url = `https://inswap.cc/swap?tab=deposit&t=${inswap_ticker}${INSWAP_SWAP_ANCHOR}`;
|
|
3995
4152
|
nav.navToUrl(url);
|
|
3996
4153
|
};
|
|
3997
4154
|
const onClickUnwrapInSwap = () => {
|
|
3998
|
-
|
|
4155
|
+
if (!ensureSiteEnabled(swapSiteEnabled))
|
|
4156
|
+
return;
|
|
4157
|
+
const url = `https://inswap.cc/swap?tab=withdraw&t=${inswap_ticker}${INSWAP_SWAP_ANCHOR}`;
|
|
3999
4158
|
nav.navToUrl(url);
|
|
4000
4159
|
};
|
|
4001
4160
|
const onClickSendInSwap = () => {
|
|
4002
|
-
|
|
4161
|
+
if (!ensureSiteEnabled(swapSiteEnabled))
|
|
4162
|
+
return;
|
|
4163
|
+
const url = `https://inswap.cc/swap/assets/account?tab=assets&t=${inswap_ticker}&action=send`;
|
|
4003
4164
|
nav.navToUrl(url);
|
|
4004
4165
|
};
|
|
4005
4166
|
const onClickMint = () => {
|
|
@@ -4029,7 +4190,6 @@ function useBRC20TokenScreenLogic() {
|
|
|
4029
4190
|
onProgBalance,
|
|
4030
4191
|
inWalletBalance,
|
|
4031
4192
|
outWalletBalanceItems,
|
|
4032
|
-
hasOutWalletBalance,
|
|
4033
4193
|
enableHistory,
|
|
4034
4194
|
enableTrade,
|
|
4035
4195
|
enableMint,
|
|
@@ -4046,12 +4206,13 @@ function useBRC20TokenScreenLogic() {
|
|
|
4046
4206
|
tools,
|
|
4047
4207
|
isBrc20Prog,
|
|
4048
4208
|
iconInfo,
|
|
4209
|
+
showProgBalance,
|
|
4210
|
+
showSwapBalance,
|
|
4049
4211
|
onClickWrapBrc20Prog,
|
|
4050
4212
|
onClickUnwrapBrc20Prog,
|
|
4051
4213
|
onClickSendBrc20Prog,
|
|
4052
4214
|
onClickSwapInSwap,
|
|
4053
4215
|
onClickAddLiquidityInSwap,
|
|
4054
|
-
onClickRemoveLiquidityInSwap,
|
|
4055
4216
|
onClickWrapInSwap,
|
|
4056
4217
|
onClickUnwrapInSwap,
|
|
4057
4218
|
onClickSendInSwap,
|
|
@@ -4089,14 +4250,14 @@ function useEditWalletNameScreenLogic() {
|
|
|
4089
4250
|
return true;
|
|
4090
4251
|
}, [alianName]);
|
|
4091
4252
|
const truncatedTitle = useMemo(() => {
|
|
4092
|
-
if (keyring.alianName && keyring.alianName.length >
|
|
4093
|
-
return keyring.alianName.slice(0,
|
|
4253
|
+
if (keyring.alianName && keyring.alianName.length > MAX_ALIAS_NAME_LENGTH) {
|
|
4254
|
+
return keyring.alianName.slice(0, MAX_ALIAS_NAME_LENGTH) + "...";
|
|
4094
4255
|
}
|
|
4095
4256
|
return keyring.alianName || "";
|
|
4096
4257
|
}, [keyring.alianName]);
|
|
4097
4258
|
const onInputChange = (e) => {
|
|
4098
4259
|
const value = typeof e === "string" ? e : e.target.value;
|
|
4099
|
-
if (value.length <=
|
|
4260
|
+
if (value.length <= MAX_ALIAS_NAME_LENGTH) {
|
|
4100
4261
|
setAlianName(value);
|
|
4101
4262
|
}
|
|
4102
4263
|
};
|
|
@@ -4483,13 +4644,23 @@ function useSendOrdinalsInscriptionScreenLogic() {
|
|
|
4483
4644
|
const { feeRate } = useFeeRateBar();
|
|
4484
4645
|
const defaultOutputValue = inscription ? inscription.outputValue : 1e4;
|
|
4485
4646
|
const [outputValue, setOutputValue] = useState(defaultOutputValue);
|
|
4647
|
+
const [enableRBF, setEnableRBF] = useState(true);
|
|
4486
4648
|
const [inscriptions, setInscriptions] = useState([]);
|
|
4487
4649
|
const wallet = useWallet();
|
|
4650
|
+
useEffect(() => {
|
|
4651
|
+
wallet.getEnableRBF().then((enableRBF2) => {
|
|
4652
|
+
setEnableRBF(enableRBF2);
|
|
4653
|
+
});
|
|
4654
|
+
}, [wallet]);
|
|
4488
4655
|
useEffect(() => {
|
|
4489
4656
|
wallet.getInscriptionUtxoDetail(inscription.inscriptionId).then((v) => {
|
|
4490
4657
|
setInscriptions(v.inscriptions);
|
|
4491
4658
|
});
|
|
4492
4659
|
}, []);
|
|
4660
|
+
const onEnableRBFChange = (value) => {
|
|
4661
|
+
setEnableRBF(value);
|
|
4662
|
+
wallet.setEnableRBF(value);
|
|
4663
|
+
};
|
|
4493
4664
|
const minOutputValue = useMemo(() => {
|
|
4494
4665
|
if (toInfo.address) {
|
|
4495
4666
|
return getAddressUtxoDust(toInfo.address);
|
|
@@ -4538,7 +4709,8 @@ function useSendOrdinalsInscriptionScreenLogic() {
|
|
|
4538
4709
|
toAddressInfo: toInfo,
|
|
4539
4710
|
inscriptionId: inscription.inscriptionId,
|
|
4540
4711
|
feeRate,
|
|
4541
|
-
outputValue
|
|
4712
|
+
outputValue,
|
|
4713
|
+
enableRBF
|
|
4542
4714
|
}).then((toSignData) => {
|
|
4543
4715
|
nav.navigate("TxConfirmScreen", { toSignData });
|
|
4544
4716
|
}).catch((e) => {
|
|
@@ -4551,6 +4723,8 @@ function useSendOrdinalsInscriptionScreenLogic() {
|
|
|
4551
4723
|
onAddressInputChange,
|
|
4552
4724
|
toInfo,
|
|
4553
4725
|
outputValue,
|
|
4726
|
+
enableRBF,
|
|
4727
|
+
setEnableRBF: onEnableRBFChange,
|
|
4554
4728
|
minOutputValue,
|
|
4555
4729
|
defaultOutputValue,
|
|
4556
4730
|
setOutputValue,
|
|
@@ -4572,10 +4746,12 @@ function useTxCreateScreenLogic() {
|
|
|
4572
4746
|
const feeRateBarState = useFeeRateBar();
|
|
4573
4747
|
const toInfo = uiState.toInfo;
|
|
4574
4748
|
const inputAmount = uiState.inputAmount;
|
|
4749
|
+
const enableRBF = uiState.enableRBF;
|
|
4575
4750
|
const feeRate = feeRateBarState.feeRate;
|
|
4576
4751
|
const [error, setError] = useState("");
|
|
4577
4752
|
const [autoAdjust, setAutoAdjust] = useState(false);
|
|
4578
4753
|
const fetchUtxos = useFetchUtxosCallback();
|
|
4754
|
+
const wallet = useWallet();
|
|
4579
4755
|
const tools = useTools();
|
|
4580
4756
|
useEffect(() => {
|
|
4581
4757
|
tools.showLoading(true);
|
|
@@ -4583,6 +4759,11 @@ function useTxCreateScreenLogic() {
|
|
|
4583
4759
|
tools.showLoading(false);
|
|
4584
4760
|
});
|
|
4585
4761
|
}, []);
|
|
4762
|
+
useEffect(() => {
|
|
4763
|
+
wallet.getEnableRBF().then((enableRBF2) => {
|
|
4764
|
+
setUiState({ enableRBF: enableRBF2 });
|
|
4765
|
+
});
|
|
4766
|
+
}, [wallet, setUiState]);
|
|
4586
4767
|
const prepareSendBTC = usePrepareSendBTCCallback();
|
|
4587
4768
|
const toSatoshis = useMemo(() => {
|
|
4588
4769
|
if (!inputAmount)
|
|
@@ -4639,8 +4820,12 @@ function useTxCreateScreenLogic() {
|
|
|
4639
4820
|
setAutoAdjust(true);
|
|
4640
4821
|
setUiState({ inputAmount: availableAmount.toString() });
|
|
4641
4822
|
};
|
|
4823
|
+
const onRBFChange = (value) => {
|
|
4824
|
+
setUiState({ enableRBF: value });
|
|
4825
|
+
wallet.setEnableRBF(value);
|
|
4826
|
+
};
|
|
4642
4827
|
const onClickNext = () => {
|
|
4643
|
-
prepareSendBTC({ toAddressInfo: toInfo, toAmount: toSatoshis, feeRate }).then((toSignData) => {
|
|
4828
|
+
prepareSendBTC({ toAddressInfo: toInfo, toAmount: toSatoshis, feeRate, enableRBF }).then((toSignData) => {
|
|
4644
4829
|
nav.navigate("TxConfirmScreen", {
|
|
4645
4830
|
toSignData
|
|
4646
4831
|
});
|
|
@@ -4658,6 +4843,8 @@ function useTxCreateScreenLogic() {
|
|
|
4658
4843
|
inputAmount,
|
|
4659
4844
|
onAmountInputChange,
|
|
4660
4845
|
onAmountMaxClick,
|
|
4846
|
+
enableRBF,
|
|
4847
|
+
onRBFChange,
|
|
4661
4848
|
showUnavailable,
|
|
4662
4849
|
availableAmount,
|
|
4663
4850
|
unavailableAmount,
|
|
@@ -4677,14 +4864,12 @@ function useBRC20InscribeTransferLogic() {
|
|
|
4677
4864
|
const [contextData, setContextData] = useState({
|
|
4678
4865
|
step: 0 /* STEP1 */,
|
|
4679
4866
|
ticker,
|
|
4680
|
-
isApproval: false
|
|
4867
|
+
isApproval: false,
|
|
4868
|
+
enableRBF: true
|
|
4681
4869
|
});
|
|
4682
|
-
const updateContextData = useCallback(
|
|
4683
|
-
(
|
|
4684
|
-
|
|
4685
|
-
},
|
|
4686
|
-
[contextData, setContextData]
|
|
4687
|
-
);
|
|
4870
|
+
const updateContextData = useCallback((params) => {
|
|
4871
|
+
setContextData((prev) => Object.assign({}, prev, params));
|
|
4872
|
+
}, []);
|
|
4688
4873
|
return {
|
|
4689
4874
|
contextData,
|
|
4690
4875
|
updateContextData
|
|
@@ -4720,6 +4905,11 @@ function useBRC20InscribeTransferLogicStep1(params) {
|
|
|
4720
4905
|
setInputDisabled(true);
|
|
4721
4906
|
}
|
|
4722
4907
|
}, []);
|
|
4908
|
+
useEffect(() => {
|
|
4909
|
+
wallet.getEnableRBF().then((enableRBF) => {
|
|
4910
|
+
updateContextData({ enableRBF });
|
|
4911
|
+
});
|
|
4912
|
+
}, []);
|
|
4723
4913
|
useEffect(() => {
|
|
4724
4914
|
setInputError("");
|
|
4725
4915
|
setInputErrorAvailable("");
|
|
@@ -4766,7 +4956,10 @@ function useBRC20InscribeTransferLogicStep1(params) {
|
|
|
4766
4956
|
}, [inputAmount, feeRateBarState.feeRate, outputValue, contextData.tokenBalance]);
|
|
4767
4957
|
useEffect(() => {
|
|
4768
4958
|
fetchUtxos();
|
|
4769
|
-
wallet.getBRC20Summary(
|
|
4959
|
+
wallet.getBRC20Summary({
|
|
4960
|
+
address: account.address,
|
|
4961
|
+
ticker: contextData.ticker
|
|
4962
|
+
}).then((v) => {
|
|
4770
4963
|
updateContextData({ tokenBalance: v.tokenBalance, tokenInfo: v.tokenInfo });
|
|
4771
4964
|
setTimeout(() => {
|
|
4772
4965
|
setLoading(false);
|
|
@@ -4789,7 +4982,8 @@ function useBRC20InscribeTransferLogicStep1(params) {
|
|
|
4789
4982
|
const toSignData = await prepareSendBypassHeadOffsets({
|
|
4790
4983
|
toAddressInfo: { address: order.payAddress, domain: "" },
|
|
4791
4984
|
toAmount: order.totalFee,
|
|
4792
|
-
feeRate: feeRateBarState.feeRate
|
|
4985
|
+
feeRate: feeRateBarState.feeRate,
|
|
4986
|
+
enableRBF: contextData.enableRBF
|
|
4793
4987
|
});
|
|
4794
4988
|
updateContextData({ order, amount, toSignData, step: 1 /* STEP2 */ });
|
|
4795
4989
|
} catch (e) {
|
|
@@ -4811,6 +5005,11 @@ function useBRC20InscribeTransferLogicStep1(params) {
|
|
|
4811
5005
|
defaultOutputValue,
|
|
4812
5006
|
setOutputValue,
|
|
4813
5007
|
disabled,
|
|
5008
|
+
enableRBF: contextData.enableRBF,
|
|
5009
|
+
setEnableRBF: (value) => {
|
|
5010
|
+
updateContextData({ enableRBF: value });
|
|
5011
|
+
wallet.setEnableRBF(value);
|
|
5012
|
+
},
|
|
4814
5013
|
loadingOnly,
|
|
4815
5014
|
handleCancel
|
|
4816
5015
|
};
|
|
@@ -4888,9 +5087,11 @@ function useBRC20InscribeTransferLogicStep3(params) {
|
|
|
4888
5087
|
const onSignPsbtHandleConfirm = async (signedDatas) => {
|
|
4889
5088
|
tools.showLoading(true);
|
|
4890
5089
|
try {
|
|
4891
|
-
const { success,
|
|
5090
|
+
const { success, error } = await pushBitcoinTx(signedDatas[0].psbtHex);
|
|
4892
5091
|
if (success) {
|
|
4893
|
-
|
|
5092
|
+
updateContextData({
|
|
5093
|
+
step: 3 /* STEP4 */
|
|
5094
|
+
});
|
|
4894
5095
|
} else {
|
|
4895
5096
|
throw new Error(error);
|
|
4896
5097
|
}
|
|
@@ -4934,7 +5135,10 @@ function useBRC20InscribeTransferLogicStep4(params) {
|
|
|
4934
5135
|
}, []);
|
|
4935
5136
|
const onClickConfirm = () => {
|
|
4936
5137
|
tools.showLoading(true);
|
|
4937
|
-
wallet.getBRC20Summary(
|
|
5138
|
+
wallet.getBRC20Summary({
|
|
5139
|
+
address: currentAccount.address,
|
|
5140
|
+
ticker: tokenBalance.ticker
|
|
5141
|
+
}).then((v) => {
|
|
4938
5142
|
if (contextData.isApproval) {
|
|
4939
5143
|
resolveApproval({
|
|
4940
5144
|
inscriptionId: result.inscriptionId,
|
|
@@ -4965,6 +5169,7 @@ function useAlkanesNFTScreenLogic() {
|
|
|
4965
5169
|
const { alkanesInfo } = nav.getRouteState();
|
|
4966
5170
|
const { t } = useI18n();
|
|
4967
5171
|
const resetTxState = useResetTxState();
|
|
5172
|
+
const accountCapabilities = useCurrentAccountCapabilities();
|
|
4968
5173
|
const [availableUtxo, setAvailableUtxo] = useState(0);
|
|
4969
5174
|
const wallet = useWallet();
|
|
4970
5175
|
useEffect(() => {
|
|
@@ -4983,7 +5188,7 @@ function useAlkanesNFTScreenLogic() {
|
|
|
4983
5188
|
alkanesInfo
|
|
4984
5189
|
});
|
|
4985
5190
|
};
|
|
4986
|
-
const disabledSend = availableUtxo <= 0;
|
|
5191
|
+
const disabledSend = !accountCapabilities.canCreateSigningRequest || availableUtxo <= 0;
|
|
4987
5192
|
return {
|
|
4988
5193
|
alkanesInfo,
|
|
4989
5194
|
t,
|
|
@@ -5027,6 +5232,7 @@ function useAlkanesTokenScreenLogic() {
|
|
|
5027
5232
|
});
|
|
5028
5233
|
const wallet = useWallet();
|
|
5029
5234
|
const account = useCurrentAccount();
|
|
5235
|
+
const accountCapabilities = useCurrentAccountCapabilities();
|
|
5030
5236
|
const [loading, setLoading] = useState(true);
|
|
5031
5237
|
const [warning, setWarning] = useState(false);
|
|
5032
5238
|
const { t } = useI18n();
|
|
@@ -5042,11 +5248,11 @@ function useAlkanesTokenScreenLogic() {
|
|
|
5042
5248
|
}, [tokenSummary.mintUrl]);
|
|
5043
5249
|
const enableTransfer = useMemo(() => {
|
|
5044
5250
|
let enable = false;
|
|
5045
|
-
if (tokenSummary.tokenBalance.amount !== "0") {
|
|
5251
|
+
if (accountCapabilities.canCreateSigningRequest && tokenSummary.tokenBalance.amount !== "0") {
|
|
5046
5252
|
enable = true;
|
|
5047
5253
|
}
|
|
5048
5254
|
return enable;
|
|
5049
|
-
}, [tokenSummary]);
|
|
5255
|
+
}, [accountCapabilities.canCreateSigningRequest, tokenSummary]);
|
|
5050
5256
|
const tools = useTools();
|
|
5051
5257
|
const enableTrade = useMemo(() => {
|
|
5052
5258
|
return tokenSummary.tradeUrl && tokenSummary.tradeUrl.trim() !== "";
|
|
@@ -5076,6 +5282,10 @@ function useAlkanesTokenScreenLogic() {
|
|
|
5076
5282
|
tokenSummary.tokenBalance.name,
|
|
5077
5283
|
tokenSummary.tokenBalance.alkaneid
|
|
5078
5284
|
);
|
|
5285
|
+
const alkanesExplorerUrl = useAlkanesTokenInfoExplorerUrl(tokenSummary.tokenInfo.alkaneid);
|
|
5286
|
+
const onClickViewOnExplorer = () => {
|
|
5287
|
+
nav.navToUrl(alkanesExplorerUrl);
|
|
5288
|
+
};
|
|
5079
5289
|
return {
|
|
5080
5290
|
tokenSummary,
|
|
5081
5291
|
loading,
|
|
@@ -5089,6 +5299,7 @@ function useAlkanesTokenScreenLogic() {
|
|
|
5089
5299
|
onClickMint,
|
|
5090
5300
|
onClickSend,
|
|
5091
5301
|
onClickTrade,
|
|
5302
|
+
onClickViewOnExplorer,
|
|
5092
5303
|
iconInfo
|
|
5093
5304
|
};
|
|
5094
5305
|
}
|
|
@@ -5305,6 +5516,7 @@ function useOrdinalsInscriptionScreenLogic() {
|
|
|
5305
5516
|
const [isLoadingDetails, setIsLoadingDetails] = useState(false);
|
|
5306
5517
|
const [isInitialLoading, setIsInitialLoading] = useState(!props.inscription);
|
|
5307
5518
|
const currentAccount = useCurrentAccount();
|
|
5519
|
+
const accountCapabilities = useCurrentAccountCapabilities();
|
|
5308
5520
|
const resetTxState = useResetTxState();
|
|
5309
5521
|
const { t } = useI18n();
|
|
5310
5522
|
const [isNeedToSplit, setIsNeedToSplit] = useState(false);
|
|
@@ -5367,7 +5579,7 @@ function useOrdinalsInscriptionScreenLogic() {
|
|
|
5367
5579
|
nav.navigate("SendOrdinalsInscriptionScreen", { inscription, inscriptionId });
|
|
5368
5580
|
};
|
|
5369
5581
|
const isUnconfirmed = inscription ? inscription.timestamp == 0 : false;
|
|
5370
|
-
const withSend = inscription ? currentAccount.address === inscription.address : false;
|
|
5582
|
+
const withSend = inscription ? accountCapabilities.canCreateSigningRequest && currentAccount.address === inscription.address : false;
|
|
5371
5583
|
const children = inscription ? inscription.children || [] : [];
|
|
5372
5584
|
const parents = inscription ? inscription.parents || [] : [];
|
|
5373
5585
|
const hasProvenance = children.length > 0 || parents.length > 0;
|
|
@@ -5438,6 +5650,7 @@ function useRunesTokenScreenLogic() {
|
|
|
5438
5650
|
});
|
|
5439
5651
|
const wallet = useWallet();
|
|
5440
5652
|
const account = useCurrentAccount();
|
|
5653
|
+
const accountCapabilities = useCurrentAccountCapabilities();
|
|
5441
5654
|
const [loading, setLoading] = useState(true);
|
|
5442
5655
|
const { t } = useI18n();
|
|
5443
5656
|
useEffect(() => {
|
|
@@ -5449,11 +5662,11 @@ function useRunesTokenScreenLogic() {
|
|
|
5449
5662
|
const enableMint = tokenSummary.runeInfo.mintable;
|
|
5450
5663
|
const enableTransfer = useMemo(() => {
|
|
5451
5664
|
let enable = false;
|
|
5452
|
-
if (tokenSummary.runeBalance.amount !== "0") {
|
|
5665
|
+
if (accountCapabilities.canCreateSigningRequest && tokenSummary.runeBalance.amount !== "0") {
|
|
5453
5666
|
enable = true;
|
|
5454
5667
|
}
|
|
5455
5668
|
return enable;
|
|
5456
|
-
}, [tokenSummary]);
|
|
5669
|
+
}, [accountCapabilities.canCreateSigningRequest, tokenSummary]);
|
|
5457
5670
|
const tools = useTools();
|
|
5458
5671
|
const ordinalsWebsite = useOrdinalsWebsite();
|
|
5459
5672
|
const resetTxState = useResetTxState();
|
|
@@ -5469,6 +5682,7 @@ function useRunesTokenScreenLogic() {
|
|
|
5469
5682
|
const iconInfo = useRunesIconInfo(tokenSummary.runeInfo.spacedRune);
|
|
5470
5683
|
const inscribeUrl = useRunesInscribeUrl(tokenSummary.runeInfo.rune);
|
|
5471
5684
|
const marketPlaceUrl = useRunesMarketUrl(tokenSummary.runeInfo.spacedRune);
|
|
5685
|
+
const runesExplorerUrl = useRunesTokenInfoExplorerUrl(tokenSummary.runeInfo.runeid);
|
|
5472
5686
|
const onClickMint = () => {
|
|
5473
5687
|
nav.navToUrl(inscribeUrl);
|
|
5474
5688
|
};
|
|
@@ -5484,6 +5698,9 @@ function useRunesTokenScreenLogic() {
|
|
|
5484
5698
|
nav.navToUrl(marketPlaceUrl);
|
|
5485
5699
|
}
|
|
5486
5700
|
};
|
|
5701
|
+
const onClickViewOnExplorer = () => {
|
|
5702
|
+
nav.navToUrl(runesExplorerUrl);
|
|
5703
|
+
};
|
|
5487
5704
|
return {
|
|
5488
5705
|
runeid,
|
|
5489
5706
|
tokenSummary,
|
|
@@ -5498,7 +5715,8 @@ function useRunesTokenScreenLogic() {
|
|
|
5498
5715
|
enableTransfer,
|
|
5499
5716
|
onClickSend,
|
|
5500
5717
|
enableTrade,
|
|
5501
|
-
onClickTrade
|
|
5718
|
+
onClickTrade,
|
|
5719
|
+
onClickViewOnExplorer
|
|
5502
5720
|
};
|
|
5503
5721
|
}
|
|
5504
5722
|
function useBRC20BalanceCardLogic(props) {
|
|
@@ -5714,6 +5932,7 @@ function useSendRunesScreenLogic() {
|
|
|
5714
5932
|
const defaultOutputValue = 546;
|
|
5715
5933
|
const currentAccount = useCurrentAccount();
|
|
5716
5934
|
const [outputValue, setOutputValue] = useState(defaultOutputValue);
|
|
5935
|
+
const [enableRBF, setEnableRBF] = useState(true);
|
|
5717
5936
|
const minOutputValue = useMemo(() => {
|
|
5718
5937
|
if (toInfo.address) {
|
|
5719
5938
|
const dust1 = getAddressUtxoDust(currentAccount.address);
|
|
@@ -5724,6 +5943,7 @@ function useSendRunesScreenLogic() {
|
|
|
5724
5943
|
}
|
|
5725
5944
|
}, [toInfo.address, currentAccount.address]);
|
|
5726
5945
|
const fetchUtxos = useFetchUtxosCallback();
|
|
5946
|
+
const wallet = useWallet();
|
|
5727
5947
|
const fetchAssetUtxosRunes = useFetchAssetUtxosRunesCallback();
|
|
5728
5948
|
const tools = useTools();
|
|
5729
5949
|
useEffect(() => {
|
|
@@ -5748,6 +5968,11 @@ function useSendRunesScreenLogic() {
|
|
|
5748
5968
|
}, []);
|
|
5749
5969
|
const prepareSendRunes = usePrepareSendRunesCallback();
|
|
5750
5970
|
const { feeRate } = useFeeRateBar();
|
|
5971
|
+
useEffect(() => {
|
|
5972
|
+
wallet.getEnableRBF().then((enableRBF2) => {
|
|
5973
|
+
setEnableRBF(enableRBF2);
|
|
5974
|
+
});
|
|
5975
|
+
}, [wallet]);
|
|
5751
5976
|
useEffect(() => {
|
|
5752
5977
|
setError("");
|
|
5753
5978
|
setDisabled(true);
|
|
@@ -5786,6 +6011,10 @@ function useSendRunesScreenLogic() {
|
|
|
5786
6011
|
const onClickBack = () => {
|
|
5787
6012
|
nav.goBack();
|
|
5788
6013
|
};
|
|
6014
|
+
const onEnableRBFChange = (value) => {
|
|
6015
|
+
setEnableRBF(value);
|
|
6016
|
+
wallet.setEnableRBF(value);
|
|
6017
|
+
};
|
|
5789
6018
|
const onClickNext = () => {
|
|
5790
6019
|
const runeAmount = bnUtils.fromDecimalAmount(inputAmount, runeInfo.divisibility);
|
|
5791
6020
|
prepareSendRunes({
|
|
@@ -5793,7 +6022,8 @@ function useSendRunesScreenLogic() {
|
|
|
5793
6022
|
runeid: runeInfo.runeid,
|
|
5794
6023
|
runeAmount,
|
|
5795
6024
|
outputValue,
|
|
5796
|
-
feeRate
|
|
6025
|
+
feeRate,
|
|
6026
|
+
enableRBF
|
|
5797
6027
|
}).then((toSignData) => {
|
|
5798
6028
|
nav.navigate("TxConfirmScreen", { toSignData });
|
|
5799
6029
|
}).catch((e) => {
|
|
@@ -5815,6 +6045,8 @@ function useSendRunesScreenLogic() {
|
|
|
5815
6045
|
defaultOutputValue,
|
|
5816
6046
|
minOutputValue,
|
|
5817
6047
|
setOutputValue,
|
|
6048
|
+
enableRBF,
|
|
6049
|
+
setEnableRBF: onEnableRBFChange,
|
|
5818
6050
|
t,
|
|
5819
6051
|
// actions
|
|
5820
6052
|
onClickBack,
|
|
@@ -5977,14 +6209,14 @@ function useEditAccountNameScreenLogic() {
|
|
|
5977
6209
|
}, [alianName]);
|
|
5978
6210
|
const truncatedTitle = useMemo(() => {
|
|
5979
6211
|
const name = account.alianName || "";
|
|
5980
|
-
if (name.length >
|
|
5981
|
-
return name.slice(0,
|
|
6212
|
+
if (name.length > MAX_ALIAS_NAME_LENGTH) {
|
|
6213
|
+
return name.slice(0, MAX_ALIAS_NAME_LENGTH) + "...";
|
|
5982
6214
|
}
|
|
5983
6215
|
return name;
|
|
5984
6216
|
}, [account.alianName]);
|
|
5985
6217
|
const onInputChange = (e) => {
|
|
5986
6218
|
const value = typeof e === "string" ? e : e.target.value;
|
|
5987
|
-
if (value.length <=
|
|
6219
|
+
if (value.length <= MAX_ALIAS_NAME_LENGTH) {
|
|
5988
6220
|
setAlianName(value);
|
|
5989
6221
|
}
|
|
5990
6222
|
};
|
|
@@ -6075,7 +6307,11 @@ function useBRC20ListLogic() {
|
|
|
6075
6307
|
if (currentAccount.address === "") {
|
|
6076
6308
|
return { list: [], total: 0 };
|
|
6077
6309
|
}
|
|
6078
|
-
const { list, total: total2 } = await wallet.getBRC20List(
|
|
6310
|
+
const { list, total: total2 } = await wallet.getBRC20List({
|
|
6311
|
+
address: currentAccount.address,
|
|
6312
|
+
currentPage: page,
|
|
6313
|
+
pageSize
|
|
6314
|
+
});
|
|
6079
6315
|
if (list.length > 0) {
|
|
6080
6316
|
wallet.getBrc20sPrice(list.map((item) => item.ticker)).then(updatePrices);
|
|
6081
6317
|
}
|
|
@@ -6706,7 +6942,11 @@ function useBRC20ProgListLogic() {
|
|
|
6706
6942
|
if (!supportedAssets.assets.brc20Prog || currentAccount.address === "") {
|
|
6707
6943
|
return { list: [], total: 0 };
|
|
6708
6944
|
}
|
|
6709
|
-
const { list, total: total2 } = await wallet.getBRC20ProgList(
|
|
6945
|
+
const { list, total: total2 } = await wallet.getBRC20ProgList({
|
|
6946
|
+
address: currentAccount.address,
|
|
6947
|
+
currentPage: page,
|
|
6948
|
+
pageSize
|
|
6949
|
+
});
|
|
6710
6950
|
if (list.length > 0) {
|
|
6711
6951
|
wallet.getBrc20sPrice(list.map((item) => item.ticker)).then(updatePrices);
|
|
6712
6952
|
}
|
|
@@ -6802,6 +7042,7 @@ function useCAT20TokenScreenLogic() {
|
|
|
6802
7042
|
const wallet = useWallet();
|
|
6803
7043
|
const account = useCurrentAccount();
|
|
6804
7044
|
const keyring = useCurrentKeyring();
|
|
7045
|
+
const accountCapabilities = useCurrentAccountCapabilities();
|
|
6805
7046
|
const [loading, setLoading] = useState(true);
|
|
6806
7047
|
const tools = useTools();
|
|
6807
7048
|
useEffect(() => {
|
|
@@ -6813,11 +7054,12 @@ function useCAT20TokenScreenLogic() {
|
|
|
6813
7054
|
const tokenUrl = useCAT20TokenInfoExplorerUrl(version, tokenSummary.cat20Info.tokenId);
|
|
6814
7055
|
const enableTransfer = useMemo(() => {
|
|
6815
7056
|
let enable = false;
|
|
6816
|
-
if (tokenSummary.cat20Balance && tokenSummary.cat20Balance.amount !== "0") {
|
|
7057
|
+
if (accountCapabilities.canCreateSigningRequest && tokenSummary.cat20Balance && tokenSummary.cat20Balance.amount !== "0") {
|
|
6817
7058
|
enable = true;
|
|
6818
7059
|
}
|
|
6819
7060
|
return enable;
|
|
6820
|
-
}, [tokenSummary]);
|
|
7061
|
+
}, [accountCapabilities.canCreateSigningRequest, tokenSummary]);
|
|
7062
|
+
const enableMerge = accountCapabilities.canCreateSigningRequest;
|
|
6821
7063
|
const chainType = useChainType();
|
|
6822
7064
|
const enableTrade = useMemo(() => {
|
|
6823
7065
|
if (chainType === ChainType.FRACTAL_BITCOIN_MAINNET && version === CAT_VERSION.V1) {
|
|
@@ -6832,6 +7074,10 @@ function useCAT20TokenScreenLogic() {
|
|
|
6832
7074
|
nav.goBack();
|
|
6833
7075
|
};
|
|
6834
7076
|
const onClickMerge = (e) => {
|
|
7077
|
+
if (!accountCapabilities.canCreateSigningRequest) {
|
|
7078
|
+
tools.toastError(t("not_supported"));
|
|
7079
|
+
return;
|
|
7080
|
+
}
|
|
6835
7081
|
if (keyring.type === KeyringType.KeystoneKeyring) {
|
|
6836
7082
|
tools.toastError(t("merge_utxos_is_not_supported_for_keystone_yet"));
|
|
6837
7083
|
return;
|
|
@@ -6858,18 +7104,23 @@ function useCAT20TokenScreenLogic() {
|
|
|
6858
7104
|
const onClickTrade = (e) => {
|
|
6859
7105
|
nav.navToUrl(marketPlaceUrl);
|
|
6860
7106
|
};
|
|
7107
|
+
const onClickViewOnExplorer = (e) => {
|
|
7108
|
+
nav.navToUrl(tokenUrl);
|
|
7109
|
+
};
|
|
6861
7110
|
const iconInfo = useCAT20IconInfo(tokenSummary.cat20Info.name, tokenSummary.cat20Info.tokenId);
|
|
6862
7111
|
return {
|
|
6863
7112
|
tokenSummary,
|
|
6864
7113
|
loading,
|
|
6865
7114
|
tokenUrl,
|
|
6866
7115
|
enableTransfer,
|
|
7116
|
+
enableMerge,
|
|
6867
7117
|
enableTrade,
|
|
6868
7118
|
iconInfo,
|
|
6869
7119
|
onClickMerge,
|
|
6870
7120
|
onClickSend,
|
|
6871
7121
|
onClickTrade,
|
|
6872
7122
|
onClickBack,
|
|
7123
|
+
onClickViewOnExplorer,
|
|
6873
7124
|
t
|
|
6874
7125
|
};
|
|
6875
7126
|
}
|
|
@@ -6886,15 +7137,25 @@ function useSplitOrdinalsInscriptionScreenLogic() {
|
|
|
6886
7137
|
const account = useCurrentAccount();
|
|
6887
7138
|
const minOutputValue = getAddressUtxoDust(account.address);
|
|
6888
7139
|
const [outputValue, setOutputValue] = useState(defaultOutputValue);
|
|
7140
|
+
const [enableRBF, setEnableRBF] = useState(true);
|
|
6889
7141
|
const { feeRate } = useFeeRateBar();
|
|
6890
7142
|
const [inscriptions, setInscriptions] = useState([]);
|
|
6891
7143
|
const [splitedCount, setSplitedCount] = useState(0);
|
|
6892
7144
|
const wallet = useWallet();
|
|
7145
|
+
useEffect(() => {
|
|
7146
|
+
wallet.getEnableRBF().then((enableRBF2) => {
|
|
7147
|
+
setEnableRBF(enableRBF2);
|
|
7148
|
+
});
|
|
7149
|
+
}, [wallet]);
|
|
6893
7150
|
useEffect(() => {
|
|
6894
7151
|
wallet.getInscriptionUtxoDetail(props.inscription.inscriptionId).then((v) => {
|
|
6895
7152
|
setInscriptions(v.inscriptions);
|
|
6896
7153
|
});
|
|
6897
7154
|
}, []);
|
|
7155
|
+
const onEnableRBFChange = (value) => {
|
|
7156
|
+
setEnableRBF(value);
|
|
7157
|
+
wallet.setEnableRBF(value);
|
|
7158
|
+
};
|
|
6898
7159
|
useEffect(() => {
|
|
6899
7160
|
setDisabled(true);
|
|
6900
7161
|
setError("");
|
|
@@ -6919,7 +7180,7 @@ function useSplitOrdinalsInscriptionScreenLogic() {
|
|
|
6919
7180
|
setOutputValue(value);
|
|
6920
7181
|
};
|
|
6921
7182
|
const onClickNext = () => {
|
|
6922
|
-
createSplitTx({ inscriptionId: inscription.inscriptionId, feeRate, outputValue }).then((toSignData) => {
|
|
7183
|
+
createSplitTx({ inscriptionId: inscription.inscriptionId, feeRate, outputValue, enableRBF }).then((toSignData) => {
|
|
6923
7184
|
nav.navigate("TxConfirmScreen", { toSignData });
|
|
6924
7185
|
}).catch((e) => {
|
|
6925
7186
|
console.log(e);
|
|
@@ -6931,6 +7192,8 @@ function useSplitOrdinalsInscriptionScreenLogic() {
|
|
|
6931
7192
|
inscriptions,
|
|
6932
7193
|
minOutputValue,
|
|
6933
7194
|
splitedCount,
|
|
7195
|
+
enableRBF,
|
|
7196
|
+
setEnableRBF: onEnableRBFChange,
|
|
6934
7197
|
error,
|
|
6935
7198
|
disabled,
|
|
6936
7199
|
onOutputValueChange,
|
|
@@ -7094,9 +7357,16 @@ function useSendAlkanesNFTScreenLogic() {
|
|
|
7094
7357
|
inscription: void 0
|
|
7095
7358
|
});
|
|
7096
7359
|
const [error, setError] = useState("");
|
|
7360
|
+
const [enableRBF, setEnableRBF] = useState(true);
|
|
7097
7361
|
useCurrentAccount();
|
|
7098
7362
|
const tools = useTools();
|
|
7363
|
+
const wallet = useWallet();
|
|
7099
7364
|
const { feeRate } = useFeeRateBar();
|
|
7365
|
+
useEffect(() => {
|
|
7366
|
+
wallet.getEnableRBF().then((enableRBF2) => {
|
|
7367
|
+
setEnableRBF(enableRBF2);
|
|
7368
|
+
});
|
|
7369
|
+
}, [wallet]);
|
|
7100
7370
|
useEffect(() => {
|
|
7101
7371
|
setError("");
|
|
7102
7372
|
setDisabled(true);
|
|
@@ -7118,7 +7388,14 @@ function useSendAlkanesNFTScreenLogic() {
|
|
|
7118
7388
|
const onCreateTxHandleConfirm = async () => {
|
|
7119
7389
|
tools.showLoading(true);
|
|
7120
7390
|
try {
|
|
7121
|
-
const toSignData = await prepareSendAlkanes(
|
|
7391
|
+
const toSignData = await prepareSendAlkanes(
|
|
7392
|
+
toInfo,
|
|
7393
|
+
alkanesInfo.alkaneid,
|
|
7394
|
+
"1",
|
|
7395
|
+
feeRate,
|
|
7396
|
+
"nft",
|
|
7397
|
+
enableRBF
|
|
7398
|
+
);
|
|
7122
7399
|
if (toSignData) {
|
|
7123
7400
|
transferData.current.toSignData = toSignData;
|
|
7124
7401
|
setStep(1);
|
|
@@ -7159,14 +7436,20 @@ function useSendAlkanesNFTScreenLogic() {
|
|
|
7159
7436
|
toSignDatas: [transferData.current.toSignData]
|
|
7160
7437
|
}
|
|
7161
7438
|
};
|
|
7439
|
+
const onEnableRBFChange = (value) => {
|
|
7440
|
+
setEnableRBF(value);
|
|
7441
|
+
wallet.setEnableRBF(value);
|
|
7442
|
+
};
|
|
7162
7443
|
return {
|
|
7163
7444
|
step,
|
|
7164
7445
|
t,
|
|
7165
7446
|
alkanesInfo,
|
|
7166
7447
|
toInfo,
|
|
7448
|
+
enableRBF,
|
|
7167
7449
|
disabled,
|
|
7168
7450
|
error,
|
|
7169
7451
|
setToInfo,
|
|
7452
|
+
setEnableRBF: onEnableRBFChange,
|
|
7170
7453
|
onCreateTxHandleConfirm,
|
|
7171
7454
|
onCreateTxHandleBack,
|
|
7172
7455
|
onSignPsbtHandleConfirm,
|
|
@@ -7195,6 +7478,7 @@ function useSendAlkanesScreenLogic() {
|
|
|
7195
7478
|
});
|
|
7196
7479
|
const [availableBalance, setAvailableBalance] = useState(tokenBalance.amount);
|
|
7197
7480
|
const [error, setError] = useState("");
|
|
7481
|
+
const [enableRBF, setEnableRBF] = useState(true);
|
|
7198
7482
|
const totalBalanceStr = useMemo(() => {
|
|
7199
7483
|
return bnUtils.toDecimalAmount(tokenBalance.amount, tokenBalance.divisibility);
|
|
7200
7484
|
}, [tokenBalance]);
|
|
@@ -7243,6 +7527,11 @@ function useSendAlkanesScreenLogic() {
|
|
|
7243
7527
|
});
|
|
7244
7528
|
const [step, setStep] = useState(0 /* CREATE_TX */);
|
|
7245
7529
|
const wallet = useWallet();
|
|
7530
|
+
useEffect(() => {
|
|
7531
|
+
wallet.getEnableRBF().then((enableRBF2) => {
|
|
7532
|
+
setEnableRBF(enableRBF2);
|
|
7533
|
+
});
|
|
7534
|
+
}, [wallet]);
|
|
7246
7535
|
const prepareSendAlkanes = usePrepareSendAlkanesCallback();
|
|
7247
7536
|
const pushBitcoinTx = usePushBitcoinTxCallback();
|
|
7248
7537
|
const onClickBack = () => {
|
|
@@ -7256,7 +7545,8 @@ function useSendAlkanesScreenLogic() {
|
|
|
7256
7545
|
tokenBalance.alkaneid,
|
|
7257
7546
|
bnUtils.fromDecimalAmount(inputAmount, tokenBalance.divisibility),
|
|
7258
7547
|
feeRate,
|
|
7259
|
-
"ft"
|
|
7548
|
+
"ft",
|
|
7549
|
+
enableRBF
|
|
7260
7550
|
);
|
|
7261
7551
|
if (toSignData) {
|
|
7262
7552
|
transferData.current.toSignData = toSignData;
|
|
@@ -7294,6 +7584,10 @@ function useSendAlkanesScreenLogic() {
|
|
|
7294
7584
|
const onSignPsbtHandleBack = () => {
|
|
7295
7585
|
setStep(0 /* CREATE_TX */);
|
|
7296
7586
|
};
|
|
7587
|
+
const onEnableRBFChange = (value) => {
|
|
7588
|
+
setEnableRBF(value);
|
|
7589
|
+
wallet.setEnableRBF(value);
|
|
7590
|
+
};
|
|
7297
7591
|
return {
|
|
7298
7592
|
step,
|
|
7299
7593
|
t,
|
|
@@ -7303,11 +7597,13 @@ function useSendAlkanesScreenLogic() {
|
|
|
7303
7597
|
totalBalanceStr,
|
|
7304
7598
|
availableBalanceStr,
|
|
7305
7599
|
inputAmount,
|
|
7600
|
+
enableRBF,
|
|
7306
7601
|
disabled,
|
|
7307
7602
|
error,
|
|
7308
7603
|
// actions
|
|
7309
7604
|
setToInfo,
|
|
7310
7605
|
setInputAmount,
|
|
7606
|
+
setEnableRBF: onEnableRBFChange,
|
|
7311
7607
|
onClickBack,
|
|
7312
7608
|
onClickNext,
|
|
7313
7609
|
// sign psbt actions
|
|
@@ -7393,6 +7689,7 @@ function useCAT721NFTScreenLogic() {
|
|
|
7393
7689
|
const { collectionInfo, localId, version } = nav.getRouteState();
|
|
7394
7690
|
const { t } = useI18n();
|
|
7395
7691
|
const resetTxState = useResetTxState();
|
|
7692
|
+
const accountCapabilities = useCurrentAccountCapabilities();
|
|
7396
7693
|
const onClickBack = () => {
|
|
7397
7694
|
nav.goBack();
|
|
7398
7695
|
};
|
|
@@ -7413,7 +7710,8 @@ function useCAT721NFTScreenLogic() {
|
|
|
7413
7710
|
t,
|
|
7414
7711
|
// actions
|
|
7415
7712
|
onClickBack,
|
|
7416
|
-
onClickSend
|
|
7713
|
+
onClickSend,
|
|
7714
|
+
disabledSend: !accountCapabilities.canCreateSigningRequest
|
|
7417
7715
|
};
|
|
7418
7716
|
}
|
|
7419
7717
|
function useSignMessageLogic(props) {
|
|
@@ -7429,10 +7727,10 @@ function useSignMessageLogic(props) {
|
|
|
7429
7727
|
const [loading, setLoading] = useState(false);
|
|
7430
7728
|
const [isKeystoneSigning, setIsKeystoneSigning] = useState(false);
|
|
7431
7729
|
const [isColdWalletSigning, setIsColdWalletSigning] = useState(false);
|
|
7730
|
+
const [readonlySignature, setReadonlySignature] = useState("");
|
|
7432
7731
|
const wallet = useWallet();
|
|
7433
|
-
useTools();
|
|
7434
|
-
const
|
|
7435
|
-
const keyringType = currentAccount.type;
|
|
7732
|
+
const tools = useTools();
|
|
7733
|
+
const accountCapabilities = useCurrentAccountCapabilities();
|
|
7436
7734
|
const { t } = useI18n();
|
|
7437
7735
|
const [disclaimerVisible, setDisclaimerVisible] = useState(false);
|
|
7438
7736
|
const [signingTxIndex, setSigningTxIndex] = useState(toSignMessages.length > 1 ? -1 : 0);
|
|
@@ -7450,11 +7748,11 @@ function useSignMessageLogic(props) {
|
|
|
7450
7748
|
if (toSignMessages.length <= 1) {
|
|
7451
7749
|
return;
|
|
7452
7750
|
}
|
|
7453
|
-
if (
|
|
7751
|
+
if (accountCapabilities.signMethod !== AccountSignMethod.Local) {
|
|
7454
7752
|
return;
|
|
7455
7753
|
}
|
|
7456
7754
|
setAllowQuickMultiSign(websiteResult.allowQuickMultiSign && toSignMessages.length > 1);
|
|
7457
|
-
}, [websiteResult,
|
|
7755
|
+
}, [websiteResult, accountCapabilities, toSignMessages.length]);
|
|
7458
7756
|
useAsyncEffect(async () => {
|
|
7459
7757
|
const website = session?.origin;
|
|
7460
7758
|
if (website) {
|
|
@@ -7551,12 +7849,27 @@ function useSignMessageLogic(props) {
|
|
|
7551
7849
|
}
|
|
7552
7850
|
};
|
|
7553
7851
|
const onNextStep = () => {
|
|
7554
|
-
|
|
7555
|
-
|
|
7556
|
-
|
|
7557
|
-
|
|
7558
|
-
|
|
7559
|
-
|
|
7852
|
+
switch (accountCapabilities.signMethod) {
|
|
7853
|
+
case AccountSignMethod.Keystone:
|
|
7854
|
+
setIsKeystoneSigning(true);
|
|
7855
|
+
return;
|
|
7856
|
+
case AccountSignMethod.ColdWallet:
|
|
7857
|
+
setIsColdWalletSigning(true);
|
|
7858
|
+
return;
|
|
7859
|
+
case AccountSignMethod.External:
|
|
7860
|
+
if (!readonlySignature) {
|
|
7861
|
+
tools.toastError(t("please_enter_your_signature"));
|
|
7862
|
+
return;
|
|
7863
|
+
}
|
|
7864
|
+
onSignedData({ signature: readonlySignature }, signingTxIndex);
|
|
7865
|
+
setReadonlySignature("");
|
|
7866
|
+
return;
|
|
7867
|
+
case AccountSignMethod.Local:
|
|
7868
|
+
localSign();
|
|
7869
|
+
return;
|
|
7870
|
+
case AccountSignMethod.None:
|
|
7871
|
+
default:
|
|
7872
|
+
tools.toastError(t("not_supported"));
|
|
7560
7873
|
}
|
|
7561
7874
|
};
|
|
7562
7875
|
const onSignedData = (data, signingTxIndex2) => {
|
|
@@ -7631,6 +7944,8 @@ function useSignMessageLogic(props) {
|
|
|
7631
7944
|
onKeystoneSigningBack,
|
|
7632
7945
|
onColdWalletSigningSuccess,
|
|
7633
7946
|
onColdWalletSigningBack,
|
|
7947
|
+
readonlySignature,
|
|
7948
|
+
setReadonlySignature,
|
|
7634
7949
|
onDisclaimerModalClose
|
|
7635
7950
|
};
|
|
7636
7951
|
}
|
|
@@ -7649,11 +7964,11 @@ function useSignPsbtLogic(props) {
|
|
|
7649
7964
|
const [isPsbtRiskPopoverVisible, setIsPsbtRiskPopoverVisible] = useState(false);
|
|
7650
7965
|
const [isKeystoneSigning, setIsKeystoneSigning] = useState(false);
|
|
7651
7966
|
const [isColdWalletSigning, setIsColdWalletSigning] = useState(false);
|
|
7967
|
+
const [readonlySignedPsbtHex, setReadonlySignedPsbtHex] = useState("");
|
|
7652
7968
|
const [contractPopoverData, setContractPopoverData] = useState(void 0);
|
|
7653
7969
|
const wallet = useWallet();
|
|
7654
7970
|
const tools = useTools();
|
|
7655
|
-
const
|
|
7656
|
-
const keyringType = currentAccount.type;
|
|
7971
|
+
const accountCapabilities = useCurrentAccountCapabilities();
|
|
7657
7972
|
const { t } = useI18n();
|
|
7658
7973
|
const [disclaimerVisible, setDisclaimerVisible] = useState(false);
|
|
7659
7974
|
const [localPsbtSummary, setLocalPsbtSummary] = useState(null);
|
|
@@ -7672,11 +7987,11 @@ function useSignPsbtLogic(props) {
|
|
|
7672
7987
|
if (toSignDatas.length <= 1) {
|
|
7673
7988
|
return;
|
|
7674
7989
|
}
|
|
7675
|
-
if (
|
|
7990
|
+
if (accountCapabilities.signMethod !== AccountSignMethod.Local) {
|
|
7676
7991
|
return;
|
|
7677
7992
|
}
|
|
7678
7993
|
setAllowQuickMultiSign(websiteResult.allowQuickMultiSign && toSignDatas.length > 1);
|
|
7679
|
-
}, [websiteResult,
|
|
7994
|
+
}, [websiteResult, accountCapabilities]);
|
|
7680
7995
|
useAsyncEffect(async () => {
|
|
7681
7996
|
const website = session?.origin;
|
|
7682
7997
|
if (website) {
|
|
@@ -7877,12 +8192,27 @@ function useSignPsbtLogic(props) {
|
|
|
7877
8192
|
}
|
|
7878
8193
|
};
|
|
7879
8194
|
const onNextStep = () => {
|
|
7880
|
-
|
|
7881
|
-
|
|
7882
|
-
|
|
7883
|
-
|
|
7884
|
-
|
|
7885
|
-
|
|
8195
|
+
switch (accountCapabilities.signMethod) {
|
|
8196
|
+
case AccountSignMethod.Keystone:
|
|
8197
|
+
setIsKeystoneSigning(true);
|
|
8198
|
+
return;
|
|
8199
|
+
case AccountSignMethod.ColdWallet:
|
|
8200
|
+
setIsColdWalletSigning(true);
|
|
8201
|
+
return;
|
|
8202
|
+
case AccountSignMethod.External:
|
|
8203
|
+
if (!readonlySignedPsbtHex) {
|
|
8204
|
+
tools.toastError(t("invalid_psbt"));
|
|
8205
|
+
return;
|
|
8206
|
+
}
|
|
8207
|
+
onSignedData({ psbtHex: readonlySignedPsbtHex }, signingTxIndex);
|
|
8208
|
+
setReadonlySignedPsbtHex("");
|
|
8209
|
+
return;
|
|
8210
|
+
case AccountSignMethod.Local:
|
|
8211
|
+
localSign();
|
|
8212
|
+
return;
|
|
8213
|
+
case AccountSignMethod.None:
|
|
8214
|
+
default:
|
|
8215
|
+
tools.toastError(t("not_supported"));
|
|
7886
8216
|
}
|
|
7887
8217
|
};
|
|
7888
8218
|
const onSignedData = (data, signingTxIndex2) => {
|
|
@@ -7959,6 +8289,8 @@ function useSignPsbtLogic(props) {
|
|
|
7959
8289
|
toSignDatas,
|
|
7960
8290
|
currentToSignData,
|
|
7961
8291
|
currentDecodedPsbt,
|
|
8292
|
+
readonlySignedPsbtHex,
|
|
8293
|
+
setReadonlySignedPsbtHex,
|
|
7962
8294
|
// state
|
|
7963
8295
|
networkFee,
|
|
7964
8296
|
isValid,
|
|
@@ -8199,6 +8531,10 @@ function useSettingsTabScreenLogic() {
|
|
|
8199
8531
|
const item = ADDRESS_TYPES$1[currentKeyring.addressType];
|
|
8200
8532
|
return currentKeyring.hdPath !== "" && item.hdPath !== currentKeyring.hdPath;
|
|
8201
8533
|
}, [currentKeyring]);
|
|
8534
|
+
const currentKeyringCapabilities = useMemo(
|
|
8535
|
+
() => getAccountCapabilities({ type: currentKeyring.type }),
|
|
8536
|
+
[currentKeyring.type]
|
|
8537
|
+
);
|
|
8202
8538
|
const settings_connectedSites = useMemo(() => {
|
|
8203
8539
|
const value = connected ? t("connected") : t("not_connected");
|
|
8204
8540
|
return {
|
|
@@ -8230,7 +8566,7 @@ function useSettingsTabScreenLogic() {
|
|
|
8230
8566
|
let value = "";
|
|
8231
8567
|
const item = ADDRESS_TYPES$1[currentKeyring.addressType];
|
|
8232
8568
|
const hdPath = currentKeyring.hdPath || item.hdPath;
|
|
8233
|
-
if (currentKeyring.type === KeyringType.SimpleKeyring) {
|
|
8569
|
+
if (currentKeyring.type === KeyringType.SimpleKeyring || currentKeyringCapabilities.signMethod === AccountSignMethod.External || !currentKeyringCapabilities.canChangeAddressType) {
|
|
8234
8570
|
value = `${item.name}`;
|
|
8235
8571
|
} else {
|
|
8236
8572
|
value = `${item.name} (${hdPath}/${currentAccount.index})`;
|
|
@@ -8254,7 +8590,7 @@ function useSettingsTabScreenLogic() {
|
|
|
8254
8590
|
nav.navigate("AddressTypeScreen");
|
|
8255
8591
|
}
|
|
8256
8592
|
};
|
|
8257
|
-
}, [t, isCustomHdPath]);
|
|
8593
|
+
}, [t, isCustomHdPath, currentKeyring, currentAccount.index, currentKeyringCapabilities]);
|
|
8258
8594
|
const settings_advanced = useMemo(() => {
|
|
8259
8595
|
return {
|
|
8260
8596
|
key: "settings_advanced",
|
|
@@ -8505,6 +8841,6 @@ function createAppStore() {
|
|
|
8505
8841
|
return store;
|
|
8506
8842
|
}
|
|
8507
8843
|
|
|
8508
|
-
export { AccountUpdater, AlkanesAssetTabKey, ApprovalContext, AssetTabKey, BRC20SendTabKey, BRC20SingleStepKey, BRC20TokenScreenTabKey, CATAssetTabKey, DeviceContext, I18nContext, NavigationContext, NavigationSource, OrdinalsAssetTabKey, PriceProvider, SendAlkanesNFTScreenStep, SendAlkanesScreenStep, SendCAT20ScreenStep, SendCAT721ScreenStep, StorageContext, ToolsContext, WalletProvider, WalletTabScreenTabKey, accountActions, browserActions, createAppStore, createStorageProvider, discoveryActions, getSupportedAssets, globalActions, keyringsActions, settingsActions, transactionsActions, uiActions, uiEventBus, useAccountAddress, useAccountBalance, useAccountInscriptions, useAccounts, useAccountsState, useActionOverviewSectionLogic, useAddressExplorerUrl, useAddressInput, useAddressSummary, useAddressTips, useAddressTypeScreenLogic, useAlkanesAssetTabKey, useAlkanesBalanceCardLogic, useAlkanesCollectionListLogic, useAlkanesIconInfo, useAlkanesListLogic, useAlkanesMarketPlaceWebsite, useAlkanesNFTListLogic, useAlkanesNFTScreenLogic, useAlkanesTokenScreenLogic, useAmountInput, useAmountInputLogic, useAnnouncementCardLogic, useAppDispatch, useAppList, useAppSelector, useAppSummary, useApproval, useAssetTabKey, useAssetUtxosRunes, useAsyncEffect, useAutoLockTimeId, useBRC20BalanceCardLogic, useBRC20IconInfo, useBRC20InscribeTransferLogic, useBRC20InscribeTransferLogicStep1, useBRC20InscribeTransferLogicStep2, useBRC20InscribeTransferLogicStep3, useBRC20InscribeTransferLogicStep4, useBRC20ListLogic, useBRC20MarketPlaceWebsite, useBRC20ProgListLogic, useBRC20SendScreenLogic, useBRC20SendScreenLogicStep1, useBRC20SendScreenLogicStep2, useBRC20SendScreenLogicStep3, useBRC20SingleStepScreenLogic, useBRC20TokenHistoryLogic, useBRC20TokenInfoExplorerUrl, useBRC20TokenScreenLogic, useBTCUnit, useBabylonConfig, useBackRefresh, useBalanceCardDetailExpanded, useBalanceCardLogic, useBannerList, useBitcoinTx, useBooted, useBrowserState, useBtcDisplayLogic, useCAT20BalanceCardLogic, useCAT20IconInfo, useCAT20ListLogic, useCAT20MarketPlaceWebsite, useCAT20TokenInfoExplorerUrl, useCAT20TokenScreenLogic, useCAT721ListLogic, useCAT721NFTContentBaseUrl, useCAT721NFTScreenLogic, useCATAssetTabKey, useChain, useChainType, useChangeAddressFlagCallback, useChangeChainTypeCallback, useChangeLocaleCallback, useChangeNetworkTypeCallback, useCreateAccountCallback, useCreateColdWalletCallback, useCreatePasswordScreenLogic, useCreateSplitTxCallback, useCreateWalletLogicImportWordsStep, useCurrentAccount, useCurrentAddress, useCurrentKeyring, useDeveloperMode, useDevice, useDiscoveryState, useEditAccountNameScreenLogic, useEditContactScreenLogic, useEditWalletNameScreenLogic, useExportMnemonicsScreenLogic, useExportPrivateKeyScreenLogic, useFeeRateBar, useFeeRateBarLogic, useFetchAssetUtxosRunesCallback, useFetchBalanceCallback, useFetchUtxosCallback, useGetTxExplorerUrlCallback, useGlobalState, useGoBackRefresh, useHasBiometricsKey, useHasNewBanner, useHistory, useI18n, useIconBaseUrl, useImportAccountCallback, useImportAccountsFromKeystoneCallback, useInfiniteListScrollOffset, useInfiniteListScrollState, useInscriptionListLogic, useInscriptionSummary, useIsBiometricsSupported, useIsInExpandView, useIsKeystoneWallet, useIsMainnetChain, useIsReady, useIsRefresh, useIsScrollViewBot, useIsScrollViewTop, useIsUnlockTimeRefres, useIsUnlocked, useKeyrings, useKeyringsState, useLastFetchInfo, useLayerState, useLocale, useLockCallback, useLockTimePageLogic, useLockedOverlayVisible, useModelPopover, useNavigation, useNetworkType, useNotificationsLogic, useOrdinalsAssetTabKey, useOrdinalsInscriptionScreenLogic, useOrdinalsTx, useOrdinalsWebsite, usePrepareSendAlkanesCallback, usePrepareSendBTCCallback, usePrepareSendBypassHeadOffsetsCallback, usePrepareSendOrdinalsInscriptionCallback, usePrepareSendOrdinalsInscriptionsCallback, usePrepareSendRunesCallback, usePrice, usePushBitcoinTxCallback, usePushOrdinalsTxCallback, useReadApp, useReadTab, useReloadAccounts, useResetAddressInput, useResetAmountInput, useResetFeeRateBar, useResetTxState, useResetUiTxCreateScreen, useRunesBalanceCardLogic, useRunesIconInfo, useRunesInscribeUrl, useRunesListLogic, useRunesMarketUrl, useRunesTokenScreenLogic, useRunesTx, useSafeBalance, useScreenState, useSendAlkanesNFTScreenLogic, useSendAlkanesScreenLogic, useSendCAT20ScreenLogic, useSendCAT721ScreenLogic, useSendOrdinalsInscriptionScreenLogic, useSendRunesScreenLogic, useSetCurrentAccountCallback, useSetDeveloperModeCallback, useSetLockedOverlayVisibleCallback, useSetSpendUnavailableUtxosCallback, useSetTabCallback, useSettingsState, useSettingsTabScreenLogic, useSignMessageLogic, useSignPsbtLogic, useSkipVersionCallback, useSpendUnavailableUtxos, useSplitOrdinalsInscriptionScreenLogic, useStorage, useSupportedAssets, useSwitchChainModalVisible, useTab, useThrottle, useToggleBalanceCardDetailExpanded, useTools, useTransactionsState, useTransferableListLogic, useTxConfirmScreenLogic, useTxCreateScreenLogic, useTxExplorerUrl, useTxFailScreenLogic, useTxSuccessScreenLogic, useUIState, useUiTxCreateScreen, useUnisatWebsite, useUnlockCallback, useUnlockRead, useUnlockRefresh, useUnreadAppSummary, useUnreadNotificationsCount, useUpdateAddressInput, useUpdateAmountInput, useUpdateFeeRateBar, useUpdateScreenStateCallback, useUpdateUiTxCreateScreen, useUtxos, useVersionInfo, useWallRefresh, useWallTabFocusRefresh, useWallTabRefresh, useWallet, useWalletConfig, useWalletTabScreenState, useWalletTopTabScreenState };
|
|
8844
|
+
export { AccountUpdater, AlkanesAssetTabKey, ApprovalContext, AssetTabKey, BRC20SendTabKey, BRC20SingleStepKey, BRC20TokenScreenTabKey, CATAssetTabKey, DeviceContext, I18nContext, MoreAssetTabKey, NavigationContext, NavigationSource, OrdinalsAssetTabKey, PriceProvider, SendAlkanesNFTScreenStep, SendAlkanesScreenStep, SendCAT20ScreenStep, SendCAT721ScreenStep, StorageContext, ToolsContext, WalletProvider, WalletTabScreenTabKey, accountActions, browserActions, createAppStore, createStorageProvider, discoveryActions, getSupportedAssets, globalActions, keyringsActions, settingsActions, transactionsActions, uiActions, uiEventBus, useAccountAddress, useAccountBalance, useAccountInscriptions, useAccounts, useAccountsState, useActionOverviewSectionLogic, useAddressExplorerUrl, useAddressInput, useAddressSummary, useAddressTips, useAddressTypeScreenLogic, useAlkanesAssetTabKey, useAlkanesBalanceCardLogic, useAlkanesCollectionListLogic, useAlkanesIconInfo, useAlkanesListLogic, useAlkanesMarketPlaceWebsite, useAlkanesNFTListLogic, useAlkanesNFTScreenLogic, useAlkanesTokenInfoExplorerUrl, useAlkanesTokenScreenLogic, useAmountInput, useAmountInputLogic, useAnnouncementCardLogic, useAppDispatch, useAppList, useAppSelector, useAppSummary, useApproval, useAssetTabKey, useAssetUtxosRunes, useAsyncEffect, useAutoLockTimeId, useBRC20BalanceCardLogic, useBRC20IconInfo, useBRC20InscribeTransferLogic, useBRC20InscribeTransferLogicStep1, useBRC20InscribeTransferLogicStep2, useBRC20InscribeTransferLogicStep3, useBRC20InscribeTransferLogicStep4, useBRC20ListLogic, useBRC20MarketPlaceWebsite, useBRC20ProgListLogic, useBRC20SendScreenLogic, useBRC20SendScreenLogicStep1, useBRC20SendScreenLogicStep2, useBRC20SendScreenLogicStep3, useBRC20SingleStepScreenLogic, useBRC20TokenHistoryLogic, useBRC20TokenInfoExplorerUrl, useBRC20TokenScreenLogic, useBTCUnit, useBabylonConfig, useBackRefresh, useBalanceCardDetailExpanded, useBalanceCardLogic, useBannerList, useBitcoinTx, useBooted, useBrowserState, useBtcDisplayLogic, useCAT20BalanceCardLogic, useCAT20IconInfo, useCAT20ListLogic, useCAT20MarketPlaceWebsite, useCAT20TokenInfoExplorerUrl, useCAT20TokenScreenLogic, useCAT721ListLogic, useCAT721NFTContentBaseUrl, useCAT721NFTScreenLogic, useCATAssetTabKey, useChain, useChainType, useChangeAddressFlagCallback, useChangeChainTypeCallback, useChangeLocaleCallback, useChangeNetworkTypeCallback, useCreateAccountCallback, useCreateColdWalletCallback, useCreatePasswordScreenLogic, useCreateSplitTxCallback, useCreateWalletLogicImportWordsStep, useCurrentAccount, useCurrentAccountCapabilities, useCurrentAddress, useCurrentKeyring, useDeveloperMode, useDevice, useDiscoveryState, useEditAccountNameScreenLogic, useEditContactScreenLogic, useEditWalletNameScreenLogic, useExportMnemonicsScreenLogic, useExportPrivateKeyScreenLogic, useFeeRateBar, useFeeRateBarLogic, useFetchAssetUtxosRunesCallback, useFetchBalanceCallback, useFetchUtxosCallback, useGetTxExplorerUrlCallback, useGlobalState, useGoBackRefresh, useHasBiometricsKey, useHasNewBanner, useHistory, useI18n, useIconBaseUrl, useImportAccountCallback, useImportAccountsFromKeystoneCallback, useInfiniteListScrollOffset, useInfiniteListScrollState, useInscriptionListLogic, useInscriptionSummary, useIsBiometricsSupported, useIsInExpandView, useIsKeystoneWallet, useIsMainnetChain, useIsReady, useIsRefresh, useIsScrollViewBot, useIsScrollViewTop, useIsUnlockTimeRefres, useIsUnlocked, useKeyrings, useKeyringsState, useLastFetchInfo, useLayerState, useLocale, useLockCallback, useLockTimePageLogic, useLockedOverlayVisible, useModelPopover, useMoreAssetTabKey, useNavigation, useNetworkType, useNotificationsLogic, useOrdinalsAssetTabKey, useOrdinalsInscriptionScreenLogic, useOrdinalsTx, useOrdinalsWebsite, usePrepareSendAlkanesCallback, usePrepareSendBTCCallback, usePrepareSendBypassHeadOffsetsCallback, usePrepareSendOrdinalsInscriptionCallback, usePrepareSendOrdinalsInscriptionsCallback, usePrepareSendRunesCallback, usePrice, usePushBitcoinTxCallback, usePushOrdinalsTxCallback, useReadApp, useReadTab, useReloadAccounts, useResetAddressInput, useResetAmountInput, useResetFeeRateBar, useResetTxState, useResetUiTxCreateScreen, useRunesBalanceCardLogic, useRunesIconInfo, useRunesInscribeUrl, useRunesListLogic, useRunesMarketUrl, useRunesTokenInfoExplorerUrl, useRunesTokenScreenLogic, useRunesTx, useSafeBalance, useScreenState, useSendAlkanesNFTScreenLogic, useSendAlkanesScreenLogic, useSendCAT20ScreenLogic, useSendCAT721ScreenLogic, useSendOrdinalsInscriptionScreenLogic, useSendRunesScreenLogic, useSetCurrentAccountCallback, useSetDeveloperModeCallback, useSetLockedOverlayVisibleCallback, useSetSpendUnavailableUtxosCallback, useSetTabCallback, useSettingsState, useSettingsTabScreenLogic, useSignMessageLogic, useSignPsbtLogic, useSkipVersionCallback, useSpendUnavailableUtxos, useSplitOrdinalsInscriptionScreenLogic, useStorage, useSupportedAssets, useSwitchChainModalVisible, useTab, useThrottle, useToggleBalanceCardDetailExpanded, useTools, useTransactionsState, useTransferableListLogic, useTxConfirmScreenLogic, useTxCreateScreenLogic, useTxExplorerUrl, useTxFailScreenLogic, useTxSuccessScreenLogic, useUIState, useUiTxCreateScreen, useUnisatWebsite, useUnlockCallback, useUnlockRead, useUnlockRefresh, useUnreadAppSummary, useUnreadNotificationsCount, useUpdateAddressInput, useUpdateAmountInput, useUpdateFeeRateBar, useUpdateScreenStateCallback, useUpdateUiTxCreateScreen, useUtxos, useVersionInfo, useWallRefresh, useWallTabFocusRefresh, useWallTabRefresh, useWallet, useWalletConfig, useWalletTabScreenState, useWalletTopTabScreenState };
|
|
8509
8845
|
//# sourceMappingURL=out.js.map
|
|
8510
8846
|
//# sourceMappingURL=index.mjs.map
|