@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.js
CHANGED
|
@@ -150,6 +150,9 @@ var slice = toolkit.createSlice({
|
|
|
150
150
|
setAddressSummary(state, action) {
|
|
151
151
|
state.addressSummary = action.payload;
|
|
152
152
|
},
|
|
153
|
+
setModelPopover(state, action) {
|
|
154
|
+
state.molelsPopover = action.payload;
|
|
155
|
+
},
|
|
153
156
|
expireBalance(state) {
|
|
154
157
|
const balance = state.balanceMap[state.current.address];
|
|
155
158
|
if (balance) {
|
|
@@ -562,7 +565,7 @@ var AssetTabKey = /* @__PURE__ */ ((AssetTabKey2) => {
|
|
|
562
565
|
AssetTabKey2[AssetTabKey2["ATOMICALS"] = 1] = "ATOMICALS";
|
|
563
566
|
AssetTabKey2[AssetTabKey2["RUNES"] = 2] = "RUNES";
|
|
564
567
|
AssetTabKey2[AssetTabKey2["CAT"] = 3] = "CAT";
|
|
565
|
-
AssetTabKey2[AssetTabKey2["
|
|
568
|
+
AssetTabKey2[AssetTabKey2["MORE"] = 4] = "MORE";
|
|
566
569
|
return AssetTabKey2;
|
|
567
570
|
})(AssetTabKey || {});
|
|
568
571
|
var OrdinalsAssetTabKey = /* @__PURE__ */ ((OrdinalsAssetTabKey2) => {
|
|
@@ -583,6 +586,11 @@ var AlkanesAssetTabKey = /* @__PURE__ */ ((AlkanesAssetTabKey2) => {
|
|
|
583
586
|
AlkanesAssetTabKey2[AlkanesAssetTabKey2["COLLECTION"] = 1] = "COLLECTION";
|
|
584
587
|
return AlkanesAssetTabKey2;
|
|
585
588
|
})(AlkanesAssetTabKey || {});
|
|
589
|
+
var MoreAssetTabKey = /* @__PURE__ */ ((MoreAssetTabKey2) => {
|
|
590
|
+
MoreAssetTabKey2[MoreAssetTabKey2["ALKANES_TOKEN"] = 0] = "ALKANES_TOKEN";
|
|
591
|
+
MoreAssetTabKey2[MoreAssetTabKey2["ALKANES_COLLECTION"] = 1] = "ALKANES_COLLECTION";
|
|
592
|
+
return MoreAssetTabKey2;
|
|
593
|
+
})(MoreAssetTabKey || {});
|
|
586
594
|
var NavigationSource = /* @__PURE__ */ ((NavigationSource2) => {
|
|
587
595
|
NavigationSource2[NavigationSource2["BACK"] = 0] = "BACK";
|
|
588
596
|
NavigationSource2[NavigationSource2["NORMAL"] = 1] = "NORMAL";
|
|
@@ -595,12 +603,14 @@ var initialState7 = {
|
|
|
595
603
|
ordinalsAssetTabKey: 0 /* ALL */,
|
|
596
604
|
catAssetTabKey: 0 /* CAT20 */,
|
|
597
605
|
alkanesAssetTabKey: 0 /* TOKEN */,
|
|
606
|
+
moreAssetTabKey: 0 /* ALKANES_TOKEN */,
|
|
598
607
|
uiTxCreateScreen: {
|
|
599
608
|
toInfo: {
|
|
600
609
|
address: "",
|
|
601
610
|
domain: ""
|
|
602
611
|
},
|
|
603
|
-
inputAmount: ""
|
|
612
|
+
inputAmount: "",
|
|
613
|
+
enableRBF: true
|
|
604
614
|
},
|
|
605
615
|
addressInput: {
|
|
606
616
|
address: "",
|
|
@@ -649,6 +659,9 @@ var slice7 = toolkit.createSlice({
|
|
|
649
659
|
if (payload.alkanesAssetTabKey !== void 0) {
|
|
650
660
|
state.alkanesAssetTabKey = payload.alkanesAssetTabKey;
|
|
651
661
|
}
|
|
662
|
+
if (payload.moreAssetTabKey !== void 0) {
|
|
663
|
+
state.moreAssetTabKey = payload.moreAssetTabKey;
|
|
664
|
+
}
|
|
652
665
|
return state;
|
|
653
666
|
},
|
|
654
667
|
updateTxCreateScreen(state, action) {
|
|
@@ -658,6 +671,9 @@ var slice7 = toolkit.createSlice({
|
|
|
658
671
|
if (action.payload.inputAmount !== void 0) {
|
|
659
672
|
state.uiTxCreateScreen.inputAmount = action.payload.inputAmount;
|
|
660
673
|
}
|
|
674
|
+
if (action.payload.enableRBF !== void 0) {
|
|
675
|
+
state.uiTxCreateScreen.enableRBF = action.payload.enableRBF;
|
|
676
|
+
}
|
|
661
677
|
state.uiTxCreateScreen = { ...state.uiTxCreateScreen };
|
|
662
678
|
},
|
|
663
679
|
updateFeeRateBar(state, action) {
|
|
@@ -740,8 +756,16 @@ var slice7 = toolkit.createSlice({
|
|
|
740
756
|
if (!state.alkanesAssetTabKey) {
|
|
741
757
|
state.alkanesAssetTabKey = 0 /* TOKEN */;
|
|
742
758
|
}
|
|
759
|
+
if (state.moreAssetTabKey === void 0) {
|
|
760
|
+
state.moreAssetTabKey = 0 /* ALKANES_TOKEN */;
|
|
761
|
+
}
|
|
762
|
+
if (state.assetTabKey === 4) {
|
|
763
|
+
state.assetTabKey = 4 /* MORE */;
|
|
764
|
+
}
|
|
743
765
|
if (!state.uiTxCreateScreen) {
|
|
744
766
|
state.uiTxCreateScreen = initialState7.uiTxCreateScreen;
|
|
767
|
+
} else if (state.uiTxCreateScreen.enableRBF === void 0) {
|
|
768
|
+
state.uiTxCreateScreen.enableRBF = true;
|
|
745
769
|
}
|
|
746
770
|
if (!state.feeRateBar) {
|
|
747
771
|
state.feeRateBar = initialState7.feeRateBar;
|
|
@@ -1080,6 +1104,10 @@ function useCurrentAddress() {
|
|
|
1080
1104
|
const accountsState = useAccountsState();
|
|
1081
1105
|
return accountsState.current.address;
|
|
1082
1106
|
}
|
|
1107
|
+
function useCurrentAccountCapabilities() {
|
|
1108
|
+
const currentAccount = useCurrentAccount();
|
|
1109
|
+
return React.useMemo(() => walletShared.getAccountCapabilities(currentAccount), [currentAccount]);
|
|
1110
|
+
}
|
|
1083
1111
|
function useAccounts() {
|
|
1084
1112
|
const accountsState = useAccountsState();
|
|
1085
1113
|
return accountsState.accounts;
|
|
@@ -1380,6 +1408,14 @@ function useBRC20TokenInfoExplorerUrl(ticker) {
|
|
|
1380
1408
|
const chain = useChain();
|
|
1381
1409
|
return `${chain.unisatExplorerUrl}/brc20/${encodeURIComponent(ticker)}`;
|
|
1382
1410
|
}
|
|
1411
|
+
function useRunesTokenInfoExplorerUrl(runeId) {
|
|
1412
|
+
const chain = useChain();
|
|
1413
|
+
return `${chain.unisatExplorerUrl}/runes/detail/${encodeURIComponent(runeId)}`;
|
|
1414
|
+
}
|
|
1415
|
+
function useAlkanesTokenInfoExplorerUrl(alkaneId) {
|
|
1416
|
+
const chain = useChain();
|
|
1417
|
+
return `${chain.unisatExplorerUrl}/alkanes/detail/${encodeURIComponent(alkaneId)}`;
|
|
1418
|
+
}
|
|
1383
1419
|
function useUnisatWebsite() {
|
|
1384
1420
|
const chainType = useChainType();
|
|
1385
1421
|
return walletShared.CHAINS_MAP[chainType].unisatUrl;
|
|
@@ -2117,6 +2153,7 @@ function usePrepareSendBTCCallback() {
|
|
|
2117
2153
|
const fromAddress = useAccountAddress();
|
|
2118
2154
|
const utxos = useUtxos();
|
|
2119
2155
|
const fetchUtxos = useFetchUtxosCallback();
|
|
2156
|
+
const accountCapabilities = useCurrentAccountCapabilities();
|
|
2120
2157
|
const { t } = useI18n();
|
|
2121
2158
|
return React.useCallback(
|
|
2122
2159
|
async ({
|
|
@@ -2125,8 +2162,12 @@ function usePrepareSendBTCCallback() {
|
|
|
2125
2162
|
feeRate,
|
|
2126
2163
|
memo,
|
|
2127
2164
|
memos,
|
|
2128
|
-
disableAutoAdjust
|
|
2165
|
+
disableAutoAdjust,
|
|
2166
|
+
enableRBF
|
|
2129
2167
|
}) => {
|
|
2168
|
+
if (!accountCapabilities.canCreateSigningRequest) {
|
|
2169
|
+
throw new Error(t("not_supported"));
|
|
2170
|
+
}
|
|
2130
2171
|
let _utxos = utxos;
|
|
2131
2172
|
if (_utxos.length === 0) {
|
|
2132
2173
|
_utxos = await fetchUtxos();
|
|
@@ -2144,7 +2185,8 @@ function usePrepareSendBTCCallback() {
|
|
|
2144
2185
|
res = await wallet.createSendAllBTCPsbt({
|
|
2145
2186
|
to: toAddressInfo.address,
|
|
2146
2187
|
btcUtxos: _utxos,
|
|
2147
|
-
feeRate
|
|
2188
|
+
feeRate,
|
|
2189
|
+
enableRBF
|
|
2148
2190
|
});
|
|
2149
2191
|
} else {
|
|
2150
2192
|
res = await wallet.createSendBTCPsbt({
|
|
@@ -2152,24 +2194,31 @@ function usePrepareSendBTCCallback() {
|
|
|
2152
2194
|
amount: toAmount,
|
|
2153
2195
|
btcUtxos: _utxos,
|
|
2154
2196
|
feeRate,
|
|
2197
|
+
enableRBF,
|
|
2155
2198
|
memo,
|
|
2156
2199
|
memos
|
|
2157
2200
|
});
|
|
2158
2201
|
}
|
|
2159
2202
|
return res;
|
|
2160
2203
|
},
|
|
2161
|
-
[dispatch, wallet, fromAddress, utxos, fetchUtxos]
|
|
2204
|
+
[dispatch, wallet, fromAddress, utxos, fetchUtxos, accountCapabilities.canCreateSigningRequest, t]
|
|
2162
2205
|
);
|
|
2163
2206
|
}
|
|
2164
2207
|
function usePrepareSendBypassHeadOffsetsCallback() {
|
|
2165
2208
|
const dispatch = useAppDispatch();
|
|
2166
2209
|
const wallet = useWallet();
|
|
2210
|
+
const accountCapabilities = useCurrentAccountCapabilities();
|
|
2211
|
+
const { t } = useI18n();
|
|
2167
2212
|
return React.useCallback(
|
|
2168
2213
|
async ({
|
|
2169
2214
|
toAddressInfo,
|
|
2170
2215
|
toAmount,
|
|
2171
|
-
feeRate
|
|
2216
|
+
feeRate,
|
|
2217
|
+
enableRBF
|
|
2172
2218
|
}) => {
|
|
2219
|
+
if (!accountCapabilities.canCreateSigningRequest) {
|
|
2220
|
+
throw new Error(t("not_supported"));
|
|
2221
|
+
}
|
|
2173
2222
|
const res = await wallet.createSendBTCOffsetPsbt(
|
|
2174
2223
|
[
|
|
2175
2224
|
{
|
|
@@ -2177,11 +2226,12 @@ function usePrepareSendBypassHeadOffsetsCallback() {
|
|
|
2177
2226
|
satoshis: toAmount
|
|
2178
2227
|
}
|
|
2179
2228
|
],
|
|
2180
|
-
feeRate
|
|
2229
|
+
feeRate,
|
|
2230
|
+
enableRBF
|
|
2181
2231
|
);
|
|
2182
2232
|
return res;
|
|
2183
2233
|
},
|
|
2184
|
-
[dispatch, wallet]
|
|
2234
|
+
[dispatch, wallet, accountCapabilities.canCreateSigningRequest, t]
|
|
2185
2235
|
);
|
|
2186
2236
|
}
|
|
2187
2237
|
function usePushBitcoinTxCallback() {
|
|
@@ -2229,13 +2279,19 @@ function usePrepareSendOrdinalsInscriptionCallback() {
|
|
|
2229
2279
|
const fromAddress = useAccountAddress();
|
|
2230
2280
|
const utxos = useUtxos();
|
|
2231
2281
|
const fetchUtxos = useFetchUtxosCallback();
|
|
2282
|
+
const accountCapabilities = useCurrentAccountCapabilities();
|
|
2283
|
+
const { t } = useI18n();
|
|
2232
2284
|
return React.useCallback(
|
|
2233
2285
|
async ({
|
|
2234
2286
|
toAddressInfo,
|
|
2235
2287
|
inscriptionId,
|
|
2236
2288
|
feeRate,
|
|
2237
|
-
outputValue
|
|
2289
|
+
outputValue,
|
|
2290
|
+
enableRBF
|
|
2238
2291
|
}) => {
|
|
2292
|
+
if (!accountCapabilities.canCreateSigningRequest) {
|
|
2293
|
+
throw new Error(t("not_supported"));
|
|
2294
|
+
}
|
|
2239
2295
|
if (!feeRate) {
|
|
2240
2296
|
const summary = await wallet.getFeeSummary();
|
|
2241
2297
|
feeRate = summary.list[1].feeRate;
|
|
@@ -2249,11 +2305,12 @@ function usePrepareSendOrdinalsInscriptionCallback() {
|
|
|
2249
2305
|
inscriptionId,
|
|
2250
2306
|
feeRate,
|
|
2251
2307
|
outputValue,
|
|
2252
|
-
btcUtxos
|
|
2308
|
+
btcUtxos,
|
|
2309
|
+
enableRBF
|
|
2253
2310
|
});
|
|
2254
2311
|
return toSignData;
|
|
2255
2312
|
},
|
|
2256
|
-
[dispatch, wallet, fromAddress, utxos]
|
|
2313
|
+
[dispatch, wallet, fromAddress, utxos, accountCapabilities.canCreateSigningRequest, t]
|
|
2257
2314
|
);
|
|
2258
2315
|
}
|
|
2259
2316
|
function usePrepareSendOrdinalsInscriptionsCallback() {
|
|
@@ -2262,12 +2319,18 @@ function usePrepareSendOrdinalsInscriptionsCallback() {
|
|
|
2262
2319
|
const fromAddress = useAccountAddress();
|
|
2263
2320
|
const fetchUtxos = useFetchUtxosCallback();
|
|
2264
2321
|
const utxos = useUtxos();
|
|
2322
|
+
const accountCapabilities = useCurrentAccountCapabilities();
|
|
2323
|
+
const { t } = useI18n();
|
|
2265
2324
|
return React.useCallback(
|
|
2266
2325
|
async ({
|
|
2267
2326
|
toAddressInfo,
|
|
2268
2327
|
inscriptionIds,
|
|
2269
|
-
feeRate
|
|
2328
|
+
feeRate,
|
|
2329
|
+
enableRBF
|
|
2270
2330
|
}) => {
|
|
2331
|
+
if (!accountCapabilities.canCreateSigningRequest) {
|
|
2332
|
+
throw new Error(t("not_supported"));
|
|
2333
|
+
}
|
|
2271
2334
|
if (!feeRate) {
|
|
2272
2335
|
const summary = await wallet.getFeeSummary();
|
|
2273
2336
|
feeRate = summary.list[1].feeRate;
|
|
@@ -2280,11 +2343,12 @@ function usePrepareSendOrdinalsInscriptionsCallback() {
|
|
|
2280
2343
|
to: toAddressInfo.address,
|
|
2281
2344
|
inscriptionIds,
|
|
2282
2345
|
feeRate,
|
|
2283
|
-
btcUtxos
|
|
2346
|
+
btcUtxos,
|
|
2347
|
+
enableRBF
|
|
2284
2348
|
});
|
|
2285
2349
|
return res;
|
|
2286
2350
|
},
|
|
2287
|
-
[dispatch, wallet, fromAddress, utxos]
|
|
2351
|
+
[dispatch, wallet, fromAddress, utxos, accountCapabilities.canCreateSigningRequest, t]
|
|
2288
2352
|
);
|
|
2289
2353
|
}
|
|
2290
2354
|
function useCreateSplitTxCallback() {
|
|
@@ -2294,12 +2358,18 @@ function useCreateSplitTxCallback() {
|
|
|
2294
2358
|
const utxos = useUtxos();
|
|
2295
2359
|
const fetchUtxos = useFetchUtxosCallback();
|
|
2296
2360
|
useCurrentAccount();
|
|
2361
|
+
const accountCapabilities = useCurrentAccountCapabilities();
|
|
2362
|
+
const { t } = useI18n();
|
|
2297
2363
|
return React.useCallback(
|
|
2298
2364
|
async ({
|
|
2299
2365
|
inscriptionId,
|
|
2300
2366
|
feeRate,
|
|
2301
|
-
outputValue
|
|
2367
|
+
outputValue,
|
|
2368
|
+
enableRBF
|
|
2302
2369
|
}) => {
|
|
2370
|
+
if (!accountCapabilities.canCreateSigningRequest) {
|
|
2371
|
+
throw new Error(t("not_supported"));
|
|
2372
|
+
}
|
|
2303
2373
|
let btcUtxos = utxos;
|
|
2304
2374
|
if (btcUtxos.length === 0) {
|
|
2305
2375
|
btcUtxos = await fetchUtxos();
|
|
@@ -2308,11 +2378,12 @@ function useCreateSplitTxCallback() {
|
|
|
2308
2378
|
inscriptionId,
|
|
2309
2379
|
feeRate,
|
|
2310
2380
|
outputValue,
|
|
2311
|
-
btcUtxos
|
|
2381
|
+
btcUtxos,
|
|
2382
|
+
enableRBF
|
|
2312
2383
|
});
|
|
2313
2384
|
return res;
|
|
2314
2385
|
},
|
|
2315
|
-
[dispatch, wallet, fromAddress, utxos]
|
|
2386
|
+
[dispatch, wallet, fromAddress, utxos, accountCapabilities.canCreateSigningRequest, t]
|
|
2316
2387
|
);
|
|
2317
2388
|
}
|
|
2318
2389
|
function usePushOrdinalsTxCallback() {
|
|
@@ -2411,14 +2482,20 @@ function usePrepareSendRunesCallback() {
|
|
|
2411
2482
|
const assetUtxosRunes = useAssetUtxosRunes();
|
|
2412
2483
|
const fetchAssetUtxosRunes = useFetchAssetUtxosRunesCallback();
|
|
2413
2484
|
const account = useCurrentAccount();
|
|
2485
|
+
const accountCapabilities = useCurrentAccountCapabilities();
|
|
2486
|
+
const { t } = useI18n();
|
|
2414
2487
|
return React.useCallback(
|
|
2415
2488
|
async ({
|
|
2416
2489
|
toAddressInfo,
|
|
2417
2490
|
runeid,
|
|
2418
2491
|
runeAmount,
|
|
2419
2492
|
outputValue,
|
|
2420
|
-
feeRate
|
|
2493
|
+
feeRate,
|
|
2494
|
+
enableRBF
|
|
2421
2495
|
}) => {
|
|
2496
|
+
if (!accountCapabilities.canCreateSigningRequest) {
|
|
2497
|
+
throw new Error(t("not_supported"));
|
|
2498
|
+
}
|
|
2422
2499
|
if (!feeRate) {
|
|
2423
2500
|
const summary = await wallet.getFeeSummary();
|
|
2424
2501
|
feeRate = summary.list[1].feeRate;
|
|
@@ -2438,11 +2515,22 @@ function usePrepareSendRunesCallback() {
|
|
|
2438
2515
|
outputValue,
|
|
2439
2516
|
feeRate,
|
|
2440
2517
|
btcUtxos,
|
|
2441
|
-
assetUtxos
|
|
2518
|
+
assetUtxos,
|
|
2519
|
+
enableRBF
|
|
2442
2520
|
});
|
|
2443
2521
|
return toSignData;
|
|
2444
2522
|
},
|
|
2445
|
-
[
|
|
2523
|
+
[
|
|
2524
|
+
dispatch,
|
|
2525
|
+
wallet,
|
|
2526
|
+
fromAddress,
|
|
2527
|
+
utxos,
|
|
2528
|
+
assetUtxosRunes,
|
|
2529
|
+
fetchAssetUtxosRunes,
|
|
2530
|
+
account,
|
|
2531
|
+
accountCapabilities.canCreateSigningRequest,
|
|
2532
|
+
t
|
|
2533
|
+
]
|
|
2446
2534
|
);
|
|
2447
2535
|
}
|
|
2448
2536
|
function useRunesTx() {
|
|
@@ -2452,17 +2540,23 @@ function useRunesTx() {
|
|
|
2452
2540
|
function usePrepareSendAlkanesCallback() {
|
|
2453
2541
|
const wallet = useWallet();
|
|
2454
2542
|
const account = useCurrentAccount();
|
|
2543
|
+
const accountCapabilities = useCurrentAccountCapabilities();
|
|
2544
|
+
const { t } = useI18n();
|
|
2455
2545
|
const callback = React.useCallback(
|
|
2456
|
-
async (toAddressInfo, alkaneid, amount, feeRate, type) => {
|
|
2546
|
+
async (toAddressInfo, alkaneid, amount, feeRate, type, enableRBF) => {
|
|
2547
|
+
if (!accountCapabilities.canCreateSigningRequest) {
|
|
2548
|
+
throw new Error(t("not_supported"));
|
|
2549
|
+
}
|
|
2457
2550
|
return await wallet.createSendAlkanesPsbt({
|
|
2458
2551
|
to: toAddressInfo.address,
|
|
2459
2552
|
alkaneid,
|
|
2460
2553
|
amount,
|
|
2461
2554
|
feeRate,
|
|
2462
|
-
type
|
|
2555
|
+
type,
|
|
2556
|
+
enableRBF
|
|
2463
2557
|
});
|
|
2464
2558
|
},
|
|
2465
|
-
[wallet, account]
|
|
2559
|
+
[wallet, account, accountCapabilities.canCreateSigningRequest, t]
|
|
2466
2560
|
);
|
|
2467
2561
|
return callback;
|
|
2468
2562
|
}
|
|
@@ -2485,23 +2579,32 @@ function useAlkanesAssetTabKey() {
|
|
|
2485
2579
|
const uiState = useUIState();
|
|
2486
2580
|
return uiState.alkanesAssetTabKey;
|
|
2487
2581
|
}
|
|
2582
|
+
function useMoreAssetTabKey() {
|
|
2583
|
+
const uiState = useUIState();
|
|
2584
|
+
return uiState.moreAssetTabKey;
|
|
2585
|
+
}
|
|
2488
2586
|
function useUiTxCreateScreen() {
|
|
2489
2587
|
const uiState = useUIState();
|
|
2490
2588
|
return uiState.uiTxCreateScreen;
|
|
2491
2589
|
}
|
|
2492
2590
|
function useUpdateUiTxCreateScreen() {
|
|
2493
2591
|
const dispatch = useAppDispatch();
|
|
2494
|
-
return (
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2592
|
+
return React.useCallback(
|
|
2593
|
+
({
|
|
2594
|
+
toInfo,
|
|
2595
|
+
inputAmount,
|
|
2596
|
+
enableRBF
|
|
2597
|
+
}) => {
|
|
2598
|
+
dispatch(
|
|
2599
|
+
uiActions.updateTxCreateScreen({
|
|
2600
|
+
toInfo,
|
|
2601
|
+
inputAmount,
|
|
2602
|
+
enableRBF
|
|
2603
|
+
})
|
|
2604
|
+
);
|
|
2605
|
+
},
|
|
2606
|
+
[dispatch]
|
|
2607
|
+
);
|
|
2505
2608
|
}
|
|
2506
2609
|
function useFeeRateBar() {
|
|
2507
2610
|
const uiState = useUIState();
|
|
@@ -2509,29 +2612,32 @@ function useFeeRateBar() {
|
|
|
2509
2612
|
}
|
|
2510
2613
|
function useUpdateFeeRateBar() {
|
|
2511
2614
|
const dispatch = useAppDispatch();
|
|
2512
|
-
return (
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2615
|
+
return React.useCallback(
|
|
2616
|
+
({
|
|
2617
|
+
feeRate,
|
|
2618
|
+
feeRateInputVal,
|
|
2619
|
+
enableLowFeeRate,
|
|
2620
|
+
feeOptionIndex,
|
|
2621
|
+
showCustomInput
|
|
2622
|
+
}) => {
|
|
2623
|
+
dispatch(
|
|
2624
|
+
uiActions.updateFeeRateBar({
|
|
2625
|
+
feeRate,
|
|
2626
|
+
feeRateInputVal,
|
|
2627
|
+
enableLowFeeRate,
|
|
2628
|
+
feeOptionIndex,
|
|
2629
|
+
showCustomInput
|
|
2630
|
+
})
|
|
2631
|
+
);
|
|
2632
|
+
},
|
|
2633
|
+
[dispatch]
|
|
2634
|
+
);
|
|
2529
2635
|
}
|
|
2530
2636
|
function useResetFeeRateBar() {
|
|
2531
2637
|
const dispatch = useAppDispatch();
|
|
2532
|
-
return () => {
|
|
2638
|
+
return React.useCallback(() => {
|
|
2533
2639
|
dispatch(uiActions.resetFeeRateBar());
|
|
2534
|
-
};
|
|
2640
|
+
}, [dispatch]);
|
|
2535
2641
|
}
|
|
2536
2642
|
function useAddressInput() {
|
|
2537
2643
|
const uiState = useUIState();
|
|
@@ -2539,20 +2645,23 @@ function useAddressInput() {
|
|
|
2539
2645
|
}
|
|
2540
2646
|
function useUpdateAddressInput() {
|
|
2541
2647
|
const dispatch = useAppDispatch();
|
|
2542
|
-
return (
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2648
|
+
return React.useCallback(
|
|
2649
|
+
({ address, domain }) => {
|
|
2650
|
+
dispatch(
|
|
2651
|
+
uiActions.updateAddressInput({
|
|
2652
|
+
address,
|
|
2653
|
+
domain
|
|
2654
|
+
})
|
|
2655
|
+
);
|
|
2656
|
+
},
|
|
2657
|
+
[dispatch]
|
|
2658
|
+
);
|
|
2550
2659
|
}
|
|
2551
2660
|
function useResetAddressInput() {
|
|
2552
2661
|
const dispatch = useAppDispatch();
|
|
2553
|
-
return () => {
|
|
2662
|
+
return React.useCallback(() => {
|
|
2554
2663
|
dispatch(uiActions.resetAddressInput());
|
|
2555
|
-
};
|
|
2664
|
+
}, [dispatch]);
|
|
2556
2665
|
}
|
|
2557
2666
|
function useAmountInput() {
|
|
2558
2667
|
const uiState = useUIState();
|
|
@@ -2560,32 +2669,35 @@ function useAmountInput() {
|
|
|
2560
2669
|
}
|
|
2561
2670
|
function useUpdateAmountInput() {
|
|
2562
2671
|
const dispatch = useAppDispatch();
|
|
2563
|
-
return (
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2672
|
+
return React.useCallback(
|
|
2673
|
+
({ amount }) => {
|
|
2674
|
+
dispatch(
|
|
2675
|
+
uiActions.updateAmountInput({
|
|
2676
|
+
amount
|
|
2677
|
+
})
|
|
2678
|
+
);
|
|
2679
|
+
},
|
|
2680
|
+
[dispatch]
|
|
2681
|
+
);
|
|
2570
2682
|
}
|
|
2571
2683
|
function useResetAmountInput() {
|
|
2572
2684
|
const dispatch = useAppDispatch();
|
|
2573
|
-
return () => {
|
|
2685
|
+
return React.useCallback(() => {
|
|
2574
2686
|
dispatch(uiActions.resetAmountInput());
|
|
2575
|
-
};
|
|
2687
|
+
}, [dispatch]);
|
|
2576
2688
|
}
|
|
2577
2689
|
function useResetTxState() {
|
|
2578
2690
|
const dispatch = useAppDispatch();
|
|
2579
|
-
return () => {
|
|
2691
|
+
return React.useCallback(() => {
|
|
2580
2692
|
dispatch(uiActions.resetTxCreateScreen());
|
|
2581
2693
|
dispatch(uiActions.resetFeeRateBar());
|
|
2582
|
-
};
|
|
2694
|
+
}, [dispatch]);
|
|
2583
2695
|
}
|
|
2584
2696
|
function useResetUiTxCreateScreen() {
|
|
2585
2697
|
const dispatch = useAppDispatch();
|
|
2586
|
-
return () => {
|
|
2698
|
+
return React.useCallback(() => {
|
|
2587
2699
|
dispatch(uiActions.resetTxCreateScreen());
|
|
2588
|
-
};
|
|
2700
|
+
}, [dispatch]);
|
|
2589
2701
|
}
|
|
2590
2702
|
var useThrottle = (callback, delay, lastCallRef) => {
|
|
2591
2703
|
return React.useCallback(
|
|
@@ -2621,7 +2733,7 @@ function getSupportedAssets(chainType, address) {
|
|
|
2621
2733
|
}
|
|
2622
2734
|
if (chainType === walletTypes.ChainType.BITCOIN_MAINNET || chainType === walletTypes.ChainType.BITCOIN_SIGNET) {
|
|
2623
2735
|
assets.alkanes = true;
|
|
2624
|
-
assetTabKeys.push(4 /*
|
|
2736
|
+
assetTabKeys.push(4 /* MORE */);
|
|
2625
2737
|
}
|
|
2626
2738
|
if (chainType === walletTypes.ChainType.BITCOIN_MAINNET || chainType === walletTypes.ChainType.BITCOIN_SIGNET) {
|
|
2627
2739
|
assets.brc20Prog = true;
|
|
@@ -2872,6 +2984,10 @@ function useAddressTypeScreenLogic() {
|
|
|
2872
2984
|
const wallet = useWallet();
|
|
2873
2985
|
const currentKeyring = useCurrentKeyring();
|
|
2874
2986
|
const account = useCurrentAccount();
|
|
2987
|
+
const currentKeyringCapabilities = React.useMemo(
|
|
2988
|
+
() => walletShared.getAccountCapabilities({ type: currentKeyring.type }),
|
|
2989
|
+
[currentKeyring.type]
|
|
2990
|
+
);
|
|
2875
2991
|
const nav = useNavigation();
|
|
2876
2992
|
useAppDispatch();
|
|
2877
2993
|
const reloadAccounts = useReloadAccounts();
|
|
@@ -2909,7 +3025,7 @@ function useAddressTypeScreenLogic() {
|
|
|
2909
3025
|
loadAddresses();
|
|
2910
3026
|
}, []);
|
|
2911
3027
|
const addressTypes = React.useMemo(() => {
|
|
2912
|
-
if (
|
|
3028
|
+
if (!currentKeyringCapabilities.canChangeAddressType) {
|
|
2913
3029
|
return types.ADDRESS_TYPES.filter((v) => v.value === currentKeyring.addressType);
|
|
2914
3030
|
}
|
|
2915
3031
|
if (currentKeyring.type === types.KeyringType.HdKeyring) {
|
|
@@ -2934,7 +3050,14 @@ function useAddressTypeScreenLogic() {
|
|
|
2934
3050
|
(a, b) => a.displayIndex - b.displayIndex
|
|
2935
3051
|
);
|
|
2936
3052
|
}
|
|
2937
|
-
}, [
|
|
3053
|
+
}, [
|
|
3054
|
+
currentKeyring.type,
|
|
3055
|
+
currentKeyring.addressType,
|
|
3056
|
+
currentKeyringCapabilities.canChangeAddressType,
|
|
3057
|
+
currentKeyring.accountIndexDerivation,
|
|
3058
|
+
addressAssets,
|
|
3059
|
+
addresses
|
|
3060
|
+
]);
|
|
2938
3061
|
const items = React.useMemo(() => {
|
|
2939
3062
|
return addressTypes.map((v) => {
|
|
2940
3063
|
const address = addresses[v.value];
|
|
@@ -2943,7 +3066,11 @@ function useAddressTypeScreenLogic() {
|
|
|
2943
3066
|
satoshis: 0,
|
|
2944
3067
|
total_inscription: 0
|
|
2945
3068
|
};
|
|
2946
|
-
const derivedPath = walletShared.getAccountDerivationPath(
|
|
3069
|
+
const derivedPath = walletShared.getAccountDerivationPath(
|
|
3070
|
+
v.hdPath,
|
|
3071
|
+
account.index || 0,
|
|
3072
|
+
currentKeyring.accountIndexDerivation
|
|
3073
|
+
);
|
|
2947
3074
|
let name = `${v.name} (${derivedPath})`;
|
|
2948
3075
|
if (currentKeyring.type === types.KeyringType.SimpleKeyring) {
|
|
2949
3076
|
name = `${v.name}`;
|
|
@@ -2962,8 +3089,8 @@ function useAddressTypeScreenLogic() {
|
|
|
2962
3089
|
if (item.value == currentKeyring.addressType) {
|
|
2963
3090
|
return;
|
|
2964
3091
|
}
|
|
2965
|
-
if (
|
|
2966
|
-
tools.toastError(t("
|
|
3092
|
+
if (!currentKeyringCapabilities.canChangeAddressType) {
|
|
3093
|
+
tools.toastError(t("not_supported"));
|
|
2967
3094
|
return;
|
|
2968
3095
|
}
|
|
2969
3096
|
await wallet.changeAddressType(item.value);
|
|
@@ -3232,6 +3359,7 @@ var BRC20SendTabKey = /* @__PURE__ */ ((BRC20SendTabKey2) => {
|
|
|
3232
3359
|
})(BRC20SendTabKey || {});
|
|
3233
3360
|
function useBRC20SendScreenLogic() {
|
|
3234
3361
|
const nav = useNavigation();
|
|
3362
|
+
const wallet = useWallet();
|
|
3235
3363
|
const props = nav.getRouteState();
|
|
3236
3364
|
const tokenBalance = props.tokenBalance;
|
|
3237
3365
|
const selectedInscriptionIds = props.selectedInscriptionIds || [];
|
|
@@ -3243,6 +3371,7 @@ function useBRC20SendScreenLogic() {
|
|
|
3243
3371
|
transferableList: [],
|
|
3244
3372
|
inscriptionIdSet: new Set(selectedInscriptionIds),
|
|
3245
3373
|
receiver: "",
|
|
3374
|
+
enableRBF: true,
|
|
3246
3375
|
rawTxInfo: {
|
|
3247
3376
|
psbtHex: "",
|
|
3248
3377
|
rawtx: ""
|
|
@@ -3282,6 +3411,11 @@ function useBRC20SendScreenLogic() {
|
|
|
3282
3411
|
updateContextData({ tabKey: key });
|
|
3283
3412
|
};
|
|
3284
3413
|
const { t } = useI18n();
|
|
3414
|
+
React.useEffect(() => {
|
|
3415
|
+
wallet.getEnableRBF().then((enableRBF) => {
|
|
3416
|
+
updateContextData({ enableRBF });
|
|
3417
|
+
});
|
|
3418
|
+
}, [wallet, updateContextData]);
|
|
3285
3419
|
return {
|
|
3286
3420
|
t,
|
|
3287
3421
|
contextData,
|
|
@@ -3353,14 +3487,16 @@ function useBRC20SendScreenLogicStep2({
|
|
|
3353
3487
|
toAddressInfo: { address: contextData.receiver, domain: "" },
|
|
3354
3488
|
inscriptionId: inscriptionIds[0],
|
|
3355
3489
|
feeRate: feeRateBar.feeRate,
|
|
3356
|
-
outputValue: getAddressUtxoDust(contextData.receiver)
|
|
3490
|
+
outputValue: getAddressUtxoDust(contextData.receiver),
|
|
3491
|
+
enableRBF: contextData.enableRBF
|
|
3357
3492
|
});
|
|
3358
3493
|
nav.navigate("TxConfirmScreen", { toSignData });
|
|
3359
3494
|
} else {
|
|
3360
3495
|
const toSignData = await prepareSendOrdinalsInscriptions({
|
|
3361
3496
|
toAddressInfo: { address: contextData.receiver, domain: "" },
|
|
3362
3497
|
inscriptionIds,
|
|
3363
|
-
feeRate: feeRateBar.feeRate
|
|
3498
|
+
feeRate: feeRateBar.feeRate,
|
|
3499
|
+
enableRBF: contextData.enableRBF
|
|
3364
3500
|
});
|
|
3365
3501
|
nav.navigate("TxConfirmScreen", { toSignData });
|
|
3366
3502
|
}
|
|
@@ -3443,12 +3579,13 @@ function useTransferableListLogic({ contextData, updateContextData }) {
|
|
|
3443
3579
|
const fetchData = async () => {
|
|
3444
3580
|
try {
|
|
3445
3581
|
setLoading(true);
|
|
3446
|
-
const { list, total: total2 } = await wallet.getBRC20TransferableList(
|
|
3447
|
-
currentAccount.address,
|
|
3448
|
-
contextData.tokenBalance.ticker,
|
|
3449
|
-
|
|
3450
|
-
pagination.
|
|
3451
|
-
|
|
3582
|
+
const { list, total: total2 } = await wallet.getBRC20TransferableList({
|
|
3583
|
+
address: currentAccount.address,
|
|
3584
|
+
ticker: contextData.tokenBalance.ticker,
|
|
3585
|
+
tickerHex: contextData.tokenBalance.tickerHex,
|
|
3586
|
+
currentPage: pagination.currentPage,
|
|
3587
|
+
pageSize: pagination.pageSize
|
|
3588
|
+
});
|
|
3452
3589
|
setItems(list);
|
|
3453
3590
|
setTotal(total2);
|
|
3454
3591
|
} catch (e) {
|
|
@@ -3735,6 +3872,7 @@ var BRC20TokenScreenTabKey = /* @__PURE__ */ ((BRC20TokenScreenTabKey2) => {
|
|
|
3735
3872
|
BRC20TokenScreenTabKey2["HISTORY"] = "history";
|
|
3736
3873
|
return BRC20TokenScreenTabKey2;
|
|
3737
3874
|
})(BRC20TokenScreenTabKey || {});
|
|
3875
|
+
var INSWAP_SWAP_ANCHOR = "#swap";
|
|
3738
3876
|
function useBRC20TokenHistoryLogic(props) {
|
|
3739
3877
|
const wallet = useWallet();
|
|
3740
3878
|
const { t } = useI18n();
|
|
@@ -3856,6 +3994,7 @@ function useBRC20TokenScreenLogic() {
|
|
|
3856
3994
|
const [tokenSummary, setTokenSummary] = React.useState({
|
|
3857
3995
|
tokenBalance: {
|
|
3858
3996
|
ticker,
|
|
3997
|
+
tickerHex: Buffer.from(ticker).toString("hex"),
|
|
3859
3998
|
overallBalance: "",
|
|
3860
3999
|
availableBalance: "",
|
|
3861
4000
|
transferableBalance: "",
|
|
@@ -3878,11 +4017,15 @@ function useBRC20TokenScreenLogic() {
|
|
|
3878
4017
|
});
|
|
3879
4018
|
const wallet = useWallet();
|
|
3880
4019
|
const account = useCurrentAccount();
|
|
4020
|
+
const accountCapabilities = useCurrentAccountCapabilities();
|
|
3881
4021
|
const [loading, setLoading] = React.useState(true);
|
|
3882
4022
|
const [deployInscription, setDeployInscription] = React.useState();
|
|
3883
4023
|
const resetTxState = useResetTxState();
|
|
3884
4024
|
React.useEffect(() => {
|
|
3885
|
-
wallet.getBRC20Summary(
|
|
4025
|
+
wallet.getBRC20Summary({
|
|
4026
|
+
address: account.address,
|
|
4027
|
+
ticker
|
|
4028
|
+
}).then((tokenSummary2) => {
|
|
3886
4029
|
if (tokenSummary2.tokenInfo.holder == account.address) {
|
|
3887
4030
|
wallet.getInscriptionInfo(tokenSummary2.tokenInfo.inscriptionId).then((data) => {
|
|
3888
4031
|
setDeployInscription(data);
|
|
@@ -3915,11 +4058,11 @@ function useBRC20TokenScreenLogic() {
|
|
|
3915
4058
|
}, [tokenSummary]);
|
|
3916
4059
|
const enableTransfer = React.useMemo(() => {
|
|
3917
4060
|
let enable = false;
|
|
3918
|
-
if (tokenSummary.tokenBalance.overallBalance !== "0" && tokenSummary.tokenBalance.overallBalance !== "") {
|
|
4061
|
+
if (accountCapabilities.canCreateSigningRequest && tokenSummary.tokenBalance.overallBalance !== "0" && tokenSummary.tokenBalance.overallBalance !== "") {
|
|
3919
4062
|
enable = true;
|
|
3920
4063
|
}
|
|
3921
4064
|
return enable;
|
|
3922
|
-
}, [tokenSummary]);
|
|
4065
|
+
}, [accountCapabilities.canCreateSigningRequest, tokenSummary]);
|
|
3923
4066
|
const tools = useTools();
|
|
3924
4067
|
const chainType = useChainType();
|
|
3925
4068
|
const chain = useChain();
|
|
@@ -3954,6 +4097,10 @@ function useBRC20TokenScreenLogic() {
|
|
|
3954
4097
|
return items;
|
|
3955
4098
|
}
|
|
3956
4099
|
}, [t, enableHistory]);
|
|
4100
|
+
const showSwapBalance = chain.isFractal;
|
|
4101
|
+
const showProgBalance = chain.enableBrc20Prog;
|
|
4102
|
+
const swapSiteEnabled = chain.enum === walletTypes.ChainType.FRACTAL_BITCOIN_MAINNET;
|
|
4103
|
+
const progSiteEnabled = chain.enum === walletTypes.ChainType.BITCOIN_MAINNET;
|
|
3957
4104
|
const onSwapBalance = tokenSummary?.tokenBalance?.swapBalance;
|
|
3958
4105
|
const onProgBalance = tokenSummary?.tokenBalance?.progBalance;
|
|
3959
4106
|
const inWalletBalance = tokenSummary?.tokenBalance?.overallBalance;
|
|
@@ -3965,14 +4112,14 @@ function useBRC20TokenScreenLogic() {
|
|
|
3965
4112
|
amount: inWalletBalance || "0"
|
|
3966
4113
|
}
|
|
3967
4114
|
];
|
|
3968
|
-
if (
|
|
4115
|
+
if (showSwapBalance) {
|
|
3969
4116
|
items.push({
|
|
3970
4117
|
key: "swap",
|
|
3971
4118
|
label: t("brc20_on_swap"),
|
|
3972
4119
|
amount: onSwapBalance
|
|
3973
4120
|
});
|
|
3974
4121
|
}
|
|
3975
|
-
if (
|
|
4122
|
+
if (showProgBalance) {
|
|
3976
4123
|
items.push({
|
|
3977
4124
|
key: "prog",
|
|
3978
4125
|
label: t("brc20_on_prog"),
|
|
@@ -3987,47 +4134,61 @@ function useBRC20TokenScreenLogic() {
|
|
|
3987
4134
|
}
|
|
3988
4135
|
return new BigNumber__default.default(inWalletBalance).plus(new BigNumber__default.default(onSwapBalance || 0)).plus(new BigNumber__default.default(onProgBalance || 0)).toString();
|
|
3989
4136
|
}, [onSwapBalance, onProgBalance, inWalletBalance]);
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
4137
|
+
const brc20prog_ticker = encodeURIComponent(ticker);
|
|
4138
|
+
const ensureSiteEnabled = (enabled) => {
|
|
4139
|
+
if (!enabled) {
|
|
4140
|
+
tools.toastError(t("not_supported"));
|
|
4141
|
+
return false;
|
|
4142
|
+
}
|
|
4143
|
+
return true;
|
|
4144
|
+
};
|
|
3997
4145
|
const onClickWrapBrc20Prog = () => {
|
|
3998
|
-
|
|
4146
|
+
if (!ensureSiteEnabled(progSiteEnabled))
|
|
4147
|
+
return;
|
|
4148
|
+
const url = `https://link.unisat.space/btc/wrap?tick=${brc20prog_ticker}`;
|
|
3999
4149
|
nav.navToUrl(url);
|
|
4000
4150
|
};
|
|
4001
4151
|
const onClickUnwrapBrc20Prog = () => {
|
|
4002
|
-
|
|
4152
|
+
if (!ensureSiteEnabled(progSiteEnabled))
|
|
4153
|
+
return;
|
|
4154
|
+
const url = `https://link.unisat.space/btc/wrap?action=unwrap&tick=${brc20prog_ticker}`;
|
|
4003
4155
|
nav.navToUrl(url);
|
|
4004
4156
|
};
|
|
4005
4157
|
const onClickSendBrc20Prog = () => {
|
|
4006
|
-
|
|
4158
|
+
if (!ensureSiteEnabled(progSiteEnabled))
|
|
4159
|
+
return;
|
|
4160
|
+
const url = `https://bestinslot.xyz/brc2.0/${brc20prog_ticker}/transfer`;
|
|
4007
4161
|
nav.navToUrl(url);
|
|
4008
4162
|
};
|
|
4163
|
+
const inswap_ticker = encodeURIComponent(ticker);
|
|
4009
4164
|
const onClickSwapInSwap = () => {
|
|
4010
|
-
|
|
4165
|
+
if (!ensureSiteEnabled(swapSiteEnabled))
|
|
4166
|
+
return;
|
|
4167
|
+
const url = `https://inswap.cc/swap/pools?q=${inswap_ticker}`;
|
|
4011
4168
|
nav.navToUrl(url);
|
|
4012
4169
|
};
|
|
4013
4170
|
const onClickAddLiquidityInSwap = () => {
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
const onClickRemoveLiquidityInSwap = () => {
|
|
4018
|
-
const url = `https://inswap.cc/swap/pools?t0=${encodeURIComponent(ticker)}&t1=sFB___000&action=remove`;
|
|
4171
|
+
if (!ensureSiteEnabled(swapSiteEnabled))
|
|
4172
|
+
return;
|
|
4173
|
+
const url = `https://inswap.cc/swap/pools?q=${inswap_ticker}`;
|
|
4019
4174
|
nav.navToUrl(url);
|
|
4020
4175
|
};
|
|
4021
4176
|
const onClickWrapInSwap = () => {
|
|
4022
|
-
|
|
4177
|
+
if (!ensureSiteEnabled(swapSiteEnabled))
|
|
4178
|
+
return;
|
|
4179
|
+
const url = `https://inswap.cc/swap?tab=deposit&t=${inswap_ticker}${INSWAP_SWAP_ANCHOR}`;
|
|
4023
4180
|
nav.navToUrl(url);
|
|
4024
4181
|
};
|
|
4025
4182
|
const onClickUnwrapInSwap = () => {
|
|
4026
|
-
|
|
4183
|
+
if (!ensureSiteEnabled(swapSiteEnabled))
|
|
4184
|
+
return;
|
|
4185
|
+
const url = `https://inswap.cc/swap?tab=withdraw&t=${inswap_ticker}${INSWAP_SWAP_ANCHOR}`;
|
|
4027
4186
|
nav.navToUrl(url);
|
|
4028
4187
|
};
|
|
4029
4188
|
const onClickSendInSwap = () => {
|
|
4030
|
-
|
|
4189
|
+
if (!ensureSiteEnabled(swapSiteEnabled))
|
|
4190
|
+
return;
|
|
4191
|
+
const url = `https://inswap.cc/swap/assets/account?tab=assets&t=${inswap_ticker}&action=send`;
|
|
4031
4192
|
nav.navToUrl(url);
|
|
4032
4193
|
};
|
|
4033
4194
|
const onClickMint = () => {
|
|
@@ -4057,7 +4218,6 @@ function useBRC20TokenScreenLogic() {
|
|
|
4057
4218
|
onProgBalance,
|
|
4058
4219
|
inWalletBalance,
|
|
4059
4220
|
outWalletBalanceItems,
|
|
4060
|
-
hasOutWalletBalance,
|
|
4061
4221
|
enableHistory,
|
|
4062
4222
|
enableTrade,
|
|
4063
4223
|
enableMint,
|
|
@@ -4074,12 +4234,13 @@ function useBRC20TokenScreenLogic() {
|
|
|
4074
4234
|
tools,
|
|
4075
4235
|
isBrc20Prog,
|
|
4076
4236
|
iconInfo,
|
|
4237
|
+
showProgBalance,
|
|
4238
|
+
showSwapBalance,
|
|
4077
4239
|
onClickWrapBrc20Prog,
|
|
4078
4240
|
onClickUnwrapBrc20Prog,
|
|
4079
4241
|
onClickSendBrc20Prog,
|
|
4080
4242
|
onClickSwapInSwap,
|
|
4081
4243
|
onClickAddLiquidityInSwap,
|
|
4082
|
-
onClickRemoveLiquidityInSwap,
|
|
4083
4244
|
onClickWrapInSwap,
|
|
4084
4245
|
onClickUnwrapInSwap,
|
|
4085
4246
|
onClickSendInSwap,
|
|
@@ -4117,14 +4278,14 @@ function useEditWalletNameScreenLogic() {
|
|
|
4117
4278
|
return true;
|
|
4118
4279
|
}, [alianName]);
|
|
4119
4280
|
const truncatedTitle = React.useMemo(() => {
|
|
4120
|
-
if (keyring.alianName && keyring.alianName.length >
|
|
4121
|
-
return keyring.alianName.slice(0,
|
|
4281
|
+
if (keyring.alianName && keyring.alianName.length > walletShared.MAX_ALIAS_NAME_LENGTH) {
|
|
4282
|
+
return keyring.alianName.slice(0, walletShared.MAX_ALIAS_NAME_LENGTH) + "...";
|
|
4122
4283
|
}
|
|
4123
4284
|
return keyring.alianName || "";
|
|
4124
4285
|
}, [keyring.alianName]);
|
|
4125
4286
|
const onInputChange = (e) => {
|
|
4126
4287
|
const value = typeof e === "string" ? e : e.target.value;
|
|
4127
|
-
if (value.length <=
|
|
4288
|
+
if (value.length <= walletShared.MAX_ALIAS_NAME_LENGTH) {
|
|
4128
4289
|
setAlianName(value);
|
|
4129
4290
|
}
|
|
4130
4291
|
};
|
|
@@ -4511,13 +4672,23 @@ function useSendOrdinalsInscriptionScreenLogic() {
|
|
|
4511
4672
|
const { feeRate } = useFeeRateBar();
|
|
4512
4673
|
const defaultOutputValue = inscription ? inscription.outputValue : 1e4;
|
|
4513
4674
|
const [outputValue, setOutputValue] = React.useState(defaultOutputValue);
|
|
4675
|
+
const [enableRBF, setEnableRBF] = React.useState(true);
|
|
4514
4676
|
const [inscriptions, setInscriptions] = React.useState([]);
|
|
4515
4677
|
const wallet = useWallet();
|
|
4678
|
+
React.useEffect(() => {
|
|
4679
|
+
wallet.getEnableRBF().then((enableRBF2) => {
|
|
4680
|
+
setEnableRBF(enableRBF2);
|
|
4681
|
+
});
|
|
4682
|
+
}, [wallet]);
|
|
4516
4683
|
React.useEffect(() => {
|
|
4517
4684
|
wallet.getInscriptionUtxoDetail(inscription.inscriptionId).then((v) => {
|
|
4518
4685
|
setInscriptions(v.inscriptions);
|
|
4519
4686
|
});
|
|
4520
4687
|
}, []);
|
|
4688
|
+
const onEnableRBFChange = (value) => {
|
|
4689
|
+
setEnableRBF(value);
|
|
4690
|
+
wallet.setEnableRBF(value);
|
|
4691
|
+
};
|
|
4521
4692
|
const minOutputValue = React.useMemo(() => {
|
|
4522
4693
|
if (toInfo.address) {
|
|
4523
4694
|
return getAddressUtxoDust(toInfo.address);
|
|
@@ -4566,7 +4737,8 @@ function useSendOrdinalsInscriptionScreenLogic() {
|
|
|
4566
4737
|
toAddressInfo: toInfo,
|
|
4567
4738
|
inscriptionId: inscription.inscriptionId,
|
|
4568
4739
|
feeRate,
|
|
4569
|
-
outputValue
|
|
4740
|
+
outputValue,
|
|
4741
|
+
enableRBF
|
|
4570
4742
|
}).then((toSignData) => {
|
|
4571
4743
|
nav.navigate("TxConfirmScreen", { toSignData });
|
|
4572
4744
|
}).catch((e) => {
|
|
@@ -4579,6 +4751,8 @@ function useSendOrdinalsInscriptionScreenLogic() {
|
|
|
4579
4751
|
onAddressInputChange,
|
|
4580
4752
|
toInfo,
|
|
4581
4753
|
outputValue,
|
|
4754
|
+
enableRBF,
|
|
4755
|
+
setEnableRBF: onEnableRBFChange,
|
|
4582
4756
|
minOutputValue,
|
|
4583
4757
|
defaultOutputValue,
|
|
4584
4758
|
setOutputValue,
|
|
@@ -4600,10 +4774,12 @@ function useTxCreateScreenLogic() {
|
|
|
4600
4774
|
const feeRateBarState = useFeeRateBar();
|
|
4601
4775
|
const toInfo = uiState.toInfo;
|
|
4602
4776
|
const inputAmount = uiState.inputAmount;
|
|
4777
|
+
const enableRBF = uiState.enableRBF;
|
|
4603
4778
|
const feeRate = feeRateBarState.feeRate;
|
|
4604
4779
|
const [error, setError] = React.useState("");
|
|
4605
4780
|
const [autoAdjust, setAutoAdjust] = React.useState(false);
|
|
4606
4781
|
const fetchUtxos = useFetchUtxosCallback();
|
|
4782
|
+
const wallet = useWallet();
|
|
4607
4783
|
const tools = useTools();
|
|
4608
4784
|
React.useEffect(() => {
|
|
4609
4785
|
tools.showLoading(true);
|
|
@@ -4611,6 +4787,11 @@ function useTxCreateScreenLogic() {
|
|
|
4611
4787
|
tools.showLoading(false);
|
|
4612
4788
|
});
|
|
4613
4789
|
}, []);
|
|
4790
|
+
React.useEffect(() => {
|
|
4791
|
+
wallet.getEnableRBF().then((enableRBF2) => {
|
|
4792
|
+
setUiState({ enableRBF: enableRBF2 });
|
|
4793
|
+
});
|
|
4794
|
+
}, [wallet, setUiState]);
|
|
4614
4795
|
const prepareSendBTC = usePrepareSendBTCCallback();
|
|
4615
4796
|
const toSatoshis = React.useMemo(() => {
|
|
4616
4797
|
if (!inputAmount)
|
|
@@ -4667,8 +4848,12 @@ function useTxCreateScreenLogic() {
|
|
|
4667
4848
|
setAutoAdjust(true);
|
|
4668
4849
|
setUiState({ inputAmount: availableAmount.toString() });
|
|
4669
4850
|
};
|
|
4851
|
+
const onRBFChange = (value) => {
|
|
4852
|
+
setUiState({ enableRBF: value });
|
|
4853
|
+
wallet.setEnableRBF(value);
|
|
4854
|
+
};
|
|
4670
4855
|
const onClickNext = () => {
|
|
4671
|
-
prepareSendBTC({ toAddressInfo: toInfo, toAmount: toSatoshis, feeRate }).then((toSignData) => {
|
|
4856
|
+
prepareSendBTC({ toAddressInfo: toInfo, toAmount: toSatoshis, feeRate, enableRBF }).then((toSignData) => {
|
|
4672
4857
|
nav.navigate("TxConfirmScreen", {
|
|
4673
4858
|
toSignData
|
|
4674
4859
|
});
|
|
@@ -4686,6 +4871,8 @@ function useTxCreateScreenLogic() {
|
|
|
4686
4871
|
inputAmount,
|
|
4687
4872
|
onAmountInputChange,
|
|
4688
4873
|
onAmountMaxClick,
|
|
4874
|
+
enableRBF,
|
|
4875
|
+
onRBFChange,
|
|
4689
4876
|
showUnavailable,
|
|
4690
4877
|
availableAmount,
|
|
4691
4878
|
unavailableAmount,
|
|
@@ -4705,14 +4892,12 @@ function useBRC20InscribeTransferLogic() {
|
|
|
4705
4892
|
const [contextData, setContextData] = React.useState({
|
|
4706
4893
|
step: 0 /* STEP1 */,
|
|
4707
4894
|
ticker,
|
|
4708
|
-
isApproval: false
|
|
4895
|
+
isApproval: false,
|
|
4896
|
+
enableRBF: true
|
|
4709
4897
|
});
|
|
4710
|
-
const updateContextData = React.useCallback(
|
|
4711
|
-
(
|
|
4712
|
-
|
|
4713
|
-
},
|
|
4714
|
-
[contextData, setContextData]
|
|
4715
|
-
);
|
|
4898
|
+
const updateContextData = React.useCallback((params) => {
|
|
4899
|
+
setContextData((prev) => Object.assign({}, prev, params));
|
|
4900
|
+
}, []);
|
|
4716
4901
|
return {
|
|
4717
4902
|
contextData,
|
|
4718
4903
|
updateContextData
|
|
@@ -4748,6 +4933,11 @@ function useBRC20InscribeTransferLogicStep1(params) {
|
|
|
4748
4933
|
setInputDisabled(true);
|
|
4749
4934
|
}
|
|
4750
4935
|
}, []);
|
|
4936
|
+
React.useEffect(() => {
|
|
4937
|
+
wallet.getEnableRBF().then((enableRBF) => {
|
|
4938
|
+
updateContextData({ enableRBF });
|
|
4939
|
+
});
|
|
4940
|
+
}, []);
|
|
4751
4941
|
React.useEffect(() => {
|
|
4752
4942
|
setInputError("");
|
|
4753
4943
|
setInputErrorAvailable("");
|
|
@@ -4794,7 +4984,10 @@ function useBRC20InscribeTransferLogicStep1(params) {
|
|
|
4794
4984
|
}, [inputAmount, feeRateBarState.feeRate, outputValue, contextData.tokenBalance]);
|
|
4795
4985
|
React.useEffect(() => {
|
|
4796
4986
|
fetchUtxos();
|
|
4797
|
-
wallet.getBRC20Summary(
|
|
4987
|
+
wallet.getBRC20Summary({
|
|
4988
|
+
address: account.address,
|
|
4989
|
+
ticker: contextData.ticker
|
|
4990
|
+
}).then((v) => {
|
|
4798
4991
|
updateContextData({ tokenBalance: v.tokenBalance, tokenInfo: v.tokenInfo });
|
|
4799
4992
|
setTimeout(() => {
|
|
4800
4993
|
setLoading(false);
|
|
@@ -4817,7 +5010,8 @@ function useBRC20InscribeTransferLogicStep1(params) {
|
|
|
4817
5010
|
const toSignData = await prepareSendBypassHeadOffsets({
|
|
4818
5011
|
toAddressInfo: { address: order.payAddress, domain: "" },
|
|
4819
5012
|
toAmount: order.totalFee,
|
|
4820
|
-
feeRate: feeRateBarState.feeRate
|
|
5013
|
+
feeRate: feeRateBarState.feeRate,
|
|
5014
|
+
enableRBF: contextData.enableRBF
|
|
4821
5015
|
});
|
|
4822
5016
|
updateContextData({ order, amount, toSignData, step: 1 /* STEP2 */ });
|
|
4823
5017
|
} catch (e) {
|
|
@@ -4839,6 +5033,11 @@ function useBRC20InscribeTransferLogicStep1(params) {
|
|
|
4839
5033
|
defaultOutputValue,
|
|
4840
5034
|
setOutputValue,
|
|
4841
5035
|
disabled,
|
|
5036
|
+
enableRBF: contextData.enableRBF,
|
|
5037
|
+
setEnableRBF: (value) => {
|
|
5038
|
+
updateContextData({ enableRBF: value });
|
|
5039
|
+
wallet.setEnableRBF(value);
|
|
5040
|
+
},
|
|
4842
5041
|
loadingOnly,
|
|
4843
5042
|
handleCancel
|
|
4844
5043
|
};
|
|
@@ -4916,9 +5115,11 @@ function useBRC20InscribeTransferLogicStep3(params) {
|
|
|
4916
5115
|
const onSignPsbtHandleConfirm = async (signedDatas) => {
|
|
4917
5116
|
tools.showLoading(true);
|
|
4918
5117
|
try {
|
|
4919
|
-
const { success,
|
|
5118
|
+
const { success, error } = await pushBitcoinTx(signedDatas[0].psbtHex);
|
|
4920
5119
|
if (success) {
|
|
4921
|
-
|
|
5120
|
+
updateContextData({
|
|
5121
|
+
step: 3 /* STEP4 */
|
|
5122
|
+
});
|
|
4922
5123
|
} else {
|
|
4923
5124
|
throw new Error(error);
|
|
4924
5125
|
}
|
|
@@ -4962,7 +5163,10 @@ function useBRC20InscribeTransferLogicStep4(params) {
|
|
|
4962
5163
|
}, []);
|
|
4963
5164
|
const onClickConfirm = () => {
|
|
4964
5165
|
tools.showLoading(true);
|
|
4965
|
-
wallet.getBRC20Summary(
|
|
5166
|
+
wallet.getBRC20Summary({
|
|
5167
|
+
address: currentAccount.address,
|
|
5168
|
+
ticker: tokenBalance.ticker
|
|
5169
|
+
}).then((v) => {
|
|
4966
5170
|
if (contextData.isApproval) {
|
|
4967
5171
|
resolveApproval({
|
|
4968
5172
|
inscriptionId: result.inscriptionId,
|
|
@@ -4993,6 +5197,7 @@ function useAlkanesNFTScreenLogic() {
|
|
|
4993
5197
|
const { alkanesInfo } = nav.getRouteState();
|
|
4994
5198
|
const { t } = useI18n();
|
|
4995
5199
|
const resetTxState = useResetTxState();
|
|
5200
|
+
const accountCapabilities = useCurrentAccountCapabilities();
|
|
4996
5201
|
const [availableUtxo, setAvailableUtxo] = React.useState(0);
|
|
4997
5202
|
const wallet = useWallet();
|
|
4998
5203
|
React.useEffect(() => {
|
|
@@ -5011,7 +5216,7 @@ function useAlkanesNFTScreenLogic() {
|
|
|
5011
5216
|
alkanesInfo
|
|
5012
5217
|
});
|
|
5013
5218
|
};
|
|
5014
|
-
const disabledSend = availableUtxo <= 0;
|
|
5219
|
+
const disabledSend = !accountCapabilities.canCreateSigningRequest || availableUtxo <= 0;
|
|
5015
5220
|
return {
|
|
5016
5221
|
alkanesInfo,
|
|
5017
5222
|
t,
|
|
@@ -5055,6 +5260,7 @@ function useAlkanesTokenScreenLogic() {
|
|
|
5055
5260
|
});
|
|
5056
5261
|
const wallet = useWallet();
|
|
5057
5262
|
const account = useCurrentAccount();
|
|
5263
|
+
const accountCapabilities = useCurrentAccountCapabilities();
|
|
5058
5264
|
const [loading, setLoading] = React.useState(true);
|
|
5059
5265
|
const [warning, setWarning] = React.useState(false);
|
|
5060
5266
|
const { t } = useI18n();
|
|
@@ -5070,11 +5276,11 @@ function useAlkanesTokenScreenLogic() {
|
|
|
5070
5276
|
}, [tokenSummary.mintUrl]);
|
|
5071
5277
|
const enableTransfer = React.useMemo(() => {
|
|
5072
5278
|
let enable = false;
|
|
5073
|
-
if (tokenSummary.tokenBalance.amount !== "0") {
|
|
5279
|
+
if (accountCapabilities.canCreateSigningRequest && tokenSummary.tokenBalance.amount !== "0") {
|
|
5074
5280
|
enable = true;
|
|
5075
5281
|
}
|
|
5076
5282
|
return enable;
|
|
5077
|
-
}, [tokenSummary]);
|
|
5283
|
+
}, [accountCapabilities.canCreateSigningRequest, tokenSummary]);
|
|
5078
5284
|
const tools = useTools();
|
|
5079
5285
|
const enableTrade = React.useMemo(() => {
|
|
5080
5286
|
return tokenSummary.tradeUrl && tokenSummary.tradeUrl.trim() !== "";
|
|
@@ -5104,6 +5310,10 @@ function useAlkanesTokenScreenLogic() {
|
|
|
5104
5310
|
tokenSummary.tokenBalance.name,
|
|
5105
5311
|
tokenSummary.tokenBalance.alkaneid
|
|
5106
5312
|
);
|
|
5313
|
+
const alkanesExplorerUrl = useAlkanesTokenInfoExplorerUrl(tokenSummary.tokenInfo.alkaneid);
|
|
5314
|
+
const onClickViewOnExplorer = () => {
|
|
5315
|
+
nav.navToUrl(alkanesExplorerUrl);
|
|
5316
|
+
};
|
|
5107
5317
|
return {
|
|
5108
5318
|
tokenSummary,
|
|
5109
5319
|
loading,
|
|
@@ -5117,6 +5327,7 @@ function useAlkanesTokenScreenLogic() {
|
|
|
5117
5327
|
onClickMint,
|
|
5118
5328
|
onClickSend,
|
|
5119
5329
|
onClickTrade,
|
|
5330
|
+
onClickViewOnExplorer,
|
|
5120
5331
|
iconInfo
|
|
5121
5332
|
};
|
|
5122
5333
|
}
|
|
@@ -5333,6 +5544,7 @@ function useOrdinalsInscriptionScreenLogic() {
|
|
|
5333
5544
|
const [isLoadingDetails, setIsLoadingDetails] = React.useState(false);
|
|
5334
5545
|
const [isInitialLoading, setIsInitialLoading] = React.useState(!props.inscription);
|
|
5335
5546
|
const currentAccount = useCurrentAccount();
|
|
5547
|
+
const accountCapabilities = useCurrentAccountCapabilities();
|
|
5336
5548
|
const resetTxState = useResetTxState();
|
|
5337
5549
|
const { t } = useI18n();
|
|
5338
5550
|
const [isNeedToSplit, setIsNeedToSplit] = React.useState(false);
|
|
@@ -5395,7 +5607,7 @@ function useOrdinalsInscriptionScreenLogic() {
|
|
|
5395
5607
|
nav.navigate("SendOrdinalsInscriptionScreen", { inscription, inscriptionId });
|
|
5396
5608
|
};
|
|
5397
5609
|
const isUnconfirmed = inscription ? inscription.timestamp == 0 : false;
|
|
5398
|
-
const withSend = inscription ? currentAccount.address === inscription.address : false;
|
|
5610
|
+
const withSend = inscription ? accountCapabilities.canCreateSigningRequest && currentAccount.address === inscription.address : false;
|
|
5399
5611
|
const children = inscription ? inscription.children || [] : [];
|
|
5400
5612
|
const parents = inscription ? inscription.parents || [] : [];
|
|
5401
5613
|
const hasProvenance = children.length > 0 || parents.length > 0;
|
|
@@ -5466,6 +5678,7 @@ function useRunesTokenScreenLogic() {
|
|
|
5466
5678
|
});
|
|
5467
5679
|
const wallet = useWallet();
|
|
5468
5680
|
const account = useCurrentAccount();
|
|
5681
|
+
const accountCapabilities = useCurrentAccountCapabilities();
|
|
5469
5682
|
const [loading, setLoading] = React.useState(true);
|
|
5470
5683
|
const { t } = useI18n();
|
|
5471
5684
|
React.useEffect(() => {
|
|
@@ -5477,11 +5690,11 @@ function useRunesTokenScreenLogic() {
|
|
|
5477
5690
|
const enableMint = tokenSummary.runeInfo.mintable;
|
|
5478
5691
|
const enableTransfer = React.useMemo(() => {
|
|
5479
5692
|
let enable = false;
|
|
5480
|
-
if (tokenSummary.runeBalance.amount !== "0") {
|
|
5693
|
+
if (accountCapabilities.canCreateSigningRequest && tokenSummary.runeBalance.amount !== "0") {
|
|
5481
5694
|
enable = true;
|
|
5482
5695
|
}
|
|
5483
5696
|
return enable;
|
|
5484
|
-
}, [tokenSummary]);
|
|
5697
|
+
}, [accountCapabilities.canCreateSigningRequest, tokenSummary]);
|
|
5485
5698
|
const tools = useTools();
|
|
5486
5699
|
const ordinalsWebsite = useOrdinalsWebsite();
|
|
5487
5700
|
const resetTxState = useResetTxState();
|
|
@@ -5497,6 +5710,7 @@ function useRunesTokenScreenLogic() {
|
|
|
5497
5710
|
const iconInfo = useRunesIconInfo(tokenSummary.runeInfo.spacedRune);
|
|
5498
5711
|
const inscribeUrl = useRunesInscribeUrl(tokenSummary.runeInfo.rune);
|
|
5499
5712
|
const marketPlaceUrl = useRunesMarketUrl(tokenSummary.runeInfo.spacedRune);
|
|
5713
|
+
const runesExplorerUrl = useRunesTokenInfoExplorerUrl(tokenSummary.runeInfo.runeid);
|
|
5500
5714
|
const onClickMint = () => {
|
|
5501
5715
|
nav.navToUrl(inscribeUrl);
|
|
5502
5716
|
};
|
|
@@ -5512,6 +5726,9 @@ function useRunesTokenScreenLogic() {
|
|
|
5512
5726
|
nav.navToUrl(marketPlaceUrl);
|
|
5513
5727
|
}
|
|
5514
5728
|
};
|
|
5729
|
+
const onClickViewOnExplorer = () => {
|
|
5730
|
+
nav.navToUrl(runesExplorerUrl);
|
|
5731
|
+
};
|
|
5515
5732
|
return {
|
|
5516
5733
|
runeid,
|
|
5517
5734
|
tokenSummary,
|
|
@@ -5526,7 +5743,8 @@ function useRunesTokenScreenLogic() {
|
|
|
5526
5743
|
enableTransfer,
|
|
5527
5744
|
onClickSend,
|
|
5528
5745
|
enableTrade,
|
|
5529
|
-
onClickTrade
|
|
5746
|
+
onClickTrade,
|
|
5747
|
+
onClickViewOnExplorer
|
|
5530
5748
|
};
|
|
5531
5749
|
}
|
|
5532
5750
|
function useBRC20BalanceCardLogic(props) {
|
|
@@ -5742,6 +5960,7 @@ function useSendRunesScreenLogic() {
|
|
|
5742
5960
|
const defaultOutputValue = 546;
|
|
5743
5961
|
const currentAccount = useCurrentAccount();
|
|
5744
5962
|
const [outputValue, setOutputValue] = React.useState(defaultOutputValue);
|
|
5963
|
+
const [enableRBF, setEnableRBF] = React.useState(true);
|
|
5745
5964
|
const minOutputValue = React.useMemo(() => {
|
|
5746
5965
|
if (toInfo.address) {
|
|
5747
5966
|
const dust1 = getAddressUtxoDust(currentAccount.address);
|
|
@@ -5752,6 +5971,7 @@ function useSendRunesScreenLogic() {
|
|
|
5752
5971
|
}
|
|
5753
5972
|
}, [toInfo.address, currentAccount.address]);
|
|
5754
5973
|
const fetchUtxos = useFetchUtxosCallback();
|
|
5974
|
+
const wallet = useWallet();
|
|
5755
5975
|
const fetchAssetUtxosRunes = useFetchAssetUtxosRunesCallback();
|
|
5756
5976
|
const tools = useTools();
|
|
5757
5977
|
React.useEffect(() => {
|
|
@@ -5776,6 +5996,11 @@ function useSendRunesScreenLogic() {
|
|
|
5776
5996
|
}, []);
|
|
5777
5997
|
const prepareSendRunes = usePrepareSendRunesCallback();
|
|
5778
5998
|
const { feeRate } = useFeeRateBar();
|
|
5999
|
+
React.useEffect(() => {
|
|
6000
|
+
wallet.getEnableRBF().then((enableRBF2) => {
|
|
6001
|
+
setEnableRBF(enableRBF2);
|
|
6002
|
+
});
|
|
6003
|
+
}, [wallet]);
|
|
5779
6004
|
React.useEffect(() => {
|
|
5780
6005
|
setError("");
|
|
5781
6006
|
setDisabled(true);
|
|
@@ -5814,6 +6039,10 @@ function useSendRunesScreenLogic() {
|
|
|
5814
6039
|
const onClickBack = () => {
|
|
5815
6040
|
nav.goBack();
|
|
5816
6041
|
};
|
|
6042
|
+
const onEnableRBFChange = (value) => {
|
|
6043
|
+
setEnableRBF(value);
|
|
6044
|
+
wallet.setEnableRBF(value);
|
|
6045
|
+
};
|
|
5817
6046
|
const onClickNext = () => {
|
|
5818
6047
|
const runeAmount = baseUtils.bnUtils.fromDecimalAmount(inputAmount, runeInfo.divisibility);
|
|
5819
6048
|
prepareSendRunes({
|
|
@@ -5821,7 +6050,8 @@ function useSendRunesScreenLogic() {
|
|
|
5821
6050
|
runeid: runeInfo.runeid,
|
|
5822
6051
|
runeAmount,
|
|
5823
6052
|
outputValue,
|
|
5824
|
-
feeRate
|
|
6053
|
+
feeRate,
|
|
6054
|
+
enableRBF
|
|
5825
6055
|
}).then((toSignData) => {
|
|
5826
6056
|
nav.navigate("TxConfirmScreen", { toSignData });
|
|
5827
6057
|
}).catch((e) => {
|
|
@@ -5843,6 +6073,8 @@ function useSendRunesScreenLogic() {
|
|
|
5843
6073
|
defaultOutputValue,
|
|
5844
6074
|
minOutputValue,
|
|
5845
6075
|
setOutputValue,
|
|
6076
|
+
enableRBF,
|
|
6077
|
+
setEnableRBF: onEnableRBFChange,
|
|
5846
6078
|
t,
|
|
5847
6079
|
// actions
|
|
5848
6080
|
onClickBack,
|
|
@@ -6005,14 +6237,14 @@ function useEditAccountNameScreenLogic() {
|
|
|
6005
6237
|
}, [alianName]);
|
|
6006
6238
|
const truncatedTitle = React.useMemo(() => {
|
|
6007
6239
|
const name = account.alianName || "";
|
|
6008
|
-
if (name.length >
|
|
6009
|
-
return name.slice(0,
|
|
6240
|
+
if (name.length > walletShared.MAX_ALIAS_NAME_LENGTH) {
|
|
6241
|
+
return name.slice(0, walletShared.MAX_ALIAS_NAME_LENGTH) + "...";
|
|
6010
6242
|
}
|
|
6011
6243
|
return name;
|
|
6012
6244
|
}, [account.alianName]);
|
|
6013
6245
|
const onInputChange = (e) => {
|
|
6014
6246
|
const value = typeof e === "string" ? e : e.target.value;
|
|
6015
|
-
if (value.length <=
|
|
6247
|
+
if (value.length <= walletShared.MAX_ALIAS_NAME_LENGTH) {
|
|
6016
6248
|
setAlianName(value);
|
|
6017
6249
|
}
|
|
6018
6250
|
};
|
|
@@ -6103,7 +6335,11 @@ function useBRC20ListLogic() {
|
|
|
6103
6335
|
if (currentAccount.address === "") {
|
|
6104
6336
|
return { list: [], total: 0 };
|
|
6105
6337
|
}
|
|
6106
|
-
const { list, total: total2 } = await wallet.getBRC20List(
|
|
6338
|
+
const { list, total: total2 } = await wallet.getBRC20List({
|
|
6339
|
+
address: currentAccount.address,
|
|
6340
|
+
currentPage: page,
|
|
6341
|
+
pageSize
|
|
6342
|
+
});
|
|
6107
6343
|
if (list.length > 0) {
|
|
6108
6344
|
wallet.getBrc20sPrice(list.map((item) => item.ticker)).then(updatePrices);
|
|
6109
6345
|
}
|
|
@@ -6734,7 +6970,11 @@ function useBRC20ProgListLogic() {
|
|
|
6734
6970
|
if (!supportedAssets.assets.brc20Prog || currentAccount.address === "") {
|
|
6735
6971
|
return { list: [], total: 0 };
|
|
6736
6972
|
}
|
|
6737
|
-
const { list, total: total2 } = await wallet.getBRC20ProgList(
|
|
6973
|
+
const { list, total: total2 } = await wallet.getBRC20ProgList({
|
|
6974
|
+
address: currentAccount.address,
|
|
6975
|
+
currentPage: page,
|
|
6976
|
+
pageSize
|
|
6977
|
+
});
|
|
6738
6978
|
if (list.length > 0) {
|
|
6739
6979
|
wallet.getBrc20sPrice(list.map((item) => item.ticker)).then(updatePrices);
|
|
6740
6980
|
}
|
|
@@ -6830,6 +7070,7 @@ function useCAT20TokenScreenLogic() {
|
|
|
6830
7070
|
const wallet = useWallet();
|
|
6831
7071
|
const account = useCurrentAccount();
|
|
6832
7072
|
const keyring = useCurrentKeyring();
|
|
7073
|
+
const accountCapabilities = useCurrentAccountCapabilities();
|
|
6833
7074
|
const [loading, setLoading] = React.useState(true);
|
|
6834
7075
|
const tools = useTools();
|
|
6835
7076
|
React.useEffect(() => {
|
|
@@ -6841,11 +7082,12 @@ function useCAT20TokenScreenLogic() {
|
|
|
6841
7082
|
const tokenUrl = useCAT20TokenInfoExplorerUrl(version, tokenSummary.cat20Info.tokenId);
|
|
6842
7083
|
const enableTransfer = React.useMemo(() => {
|
|
6843
7084
|
let enable = false;
|
|
6844
|
-
if (tokenSummary.cat20Balance && tokenSummary.cat20Balance.amount !== "0") {
|
|
7085
|
+
if (accountCapabilities.canCreateSigningRequest && tokenSummary.cat20Balance && tokenSummary.cat20Balance.amount !== "0") {
|
|
6845
7086
|
enable = true;
|
|
6846
7087
|
}
|
|
6847
7088
|
return enable;
|
|
6848
|
-
}, [tokenSummary]);
|
|
7089
|
+
}, [accountCapabilities.canCreateSigningRequest, tokenSummary]);
|
|
7090
|
+
const enableMerge = accountCapabilities.canCreateSigningRequest;
|
|
6849
7091
|
const chainType = useChainType();
|
|
6850
7092
|
const enableTrade = React.useMemo(() => {
|
|
6851
7093
|
if (chainType === walletTypes.ChainType.FRACTAL_BITCOIN_MAINNET && version === walletShared.CAT_VERSION.V1) {
|
|
@@ -6860,6 +7102,10 @@ function useCAT20TokenScreenLogic() {
|
|
|
6860
7102
|
nav.goBack();
|
|
6861
7103
|
};
|
|
6862
7104
|
const onClickMerge = (e) => {
|
|
7105
|
+
if (!accountCapabilities.canCreateSigningRequest) {
|
|
7106
|
+
tools.toastError(t("not_supported"));
|
|
7107
|
+
return;
|
|
7108
|
+
}
|
|
6863
7109
|
if (keyring.type === types.KeyringType.KeystoneKeyring) {
|
|
6864
7110
|
tools.toastError(t("merge_utxos_is_not_supported_for_keystone_yet"));
|
|
6865
7111
|
return;
|
|
@@ -6886,18 +7132,23 @@ function useCAT20TokenScreenLogic() {
|
|
|
6886
7132
|
const onClickTrade = (e) => {
|
|
6887
7133
|
nav.navToUrl(marketPlaceUrl);
|
|
6888
7134
|
};
|
|
7135
|
+
const onClickViewOnExplorer = (e) => {
|
|
7136
|
+
nav.navToUrl(tokenUrl);
|
|
7137
|
+
};
|
|
6889
7138
|
const iconInfo = useCAT20IconInfo(tokenSummary.cat20Info.name, tokenSummary.cat20Info.tokenId);
|
|
6890
7139
|
return {
|
|
6891
7140
|
tokenSummary,
|
|
6892
7141
|
loading,
|
|
6893
7142
|
tokenUrl,
|
|
6894
7143
|
enableTransfer,
|
|
7144
|
+
enableMerge,
|
|
6895
7145
|
enableTrade,
|
|
6896
7146
|
iconInfo,
|
|
6897
7147
|
onClickMerge,
|
|
6898
7148
|
onClickSend,
|
|
6899
7149
|
onClickTrade,
|
|
6900
7150
|
onClickBack,
|
|
7151
|
+
onClickViewOnExplorer,
|
|
6901
7152
|
t
|
|
6902
7153
|
};
|
|
6903
7154
|
}
|
|
@@ -6914,15 +7165,25 @@ function useSplitOrdinalsInscriptionScreenLogic() {
|
|
|
6914
7165
|
const account = useCurrentAccount();
|
|
6915
7166
|
const minOutputValue = getAddressUtxoDust(account.address);
|
|
6916
7167
|
const [outputValue, setOutputValue] = React.useState(defaultOutputValue);
|
|
7168
|
+
const [enableRBF, setEnableRBF] = React.useState(true);
|
|
6917
7169
|
const { feeRate } = useFeeRateBar();
|
|
6918
7170
|
const [inscriptions, setInscriptions] = React.useState([]);
|
|
6919
7171
|
const [splitedCount, setSplitedCount] = React.useState(0);
|
|
6920
7172
|
const wallet = useWallet();
|
|
7173
|
+
React.useEffect(() => {
|
|
7174
|
+
wallet.getEnableRBF().then((enableRBF2) => {
|
|
7175
|
+
setEnableRBF(enableRBF2);
|
|
7176
|
+
});
|
|
7177
|
+
}, [wallet]);
|
|
6921
7178
|
React.useEffect(() => {
|
|
6922
7179
|
wallet.getInscriptionUtxoDetail(props.inscription.inscriptionId).then((v) => {
|
|
6923
7180
|
setInscriptions(v.inscriptions);
|
|
6924
7181
|
});
|
|
6925
7182
|
}, []);
|
|
7183
|
+
const onEnableRBFChange = (value) => {
|
|
7184
|
+
setEnableRBF(value);
|
|
7185
|
+
wallet.setEnableRBF(value);
|
|
7186
|
+
};
|
|
6926
7187
|
React.useEffect(() => {
|
|
6927
7188
|
setDisabled(true);
|
|
6928
7189
|
setError("");
|
|
@@ -6947,7 +7208,7 @@ function useSplitOrdinalsInscriptionScreenLogic() {
|
|
|
6947
7208
|
setOutputValue(value);
|
|
6948
7209
|
};
|
|
6949
7210
|
const onClickNext = () => {
|
|
6950
|
-
createSplitTx({ inscriptionId: inscription.inscriptionId, feeRate, outputValue }).then((toSignData) => {
|
|
7211
|
+
createSplitTx({ inscriptionId: inscription.inscriptionId, feeRate, outputValue, enableRBF }).then((toSignData) => {
|
|
6951
7212
|
nav.navigate("TxConfirmScreen", { toSignData });
|
|
6952
7213
|
}).catch((e) => {
|
|
6953
7214
|
console.log(e);
|
|
@@ -6959,6 +7220,8 @@ function useSplitOrdinalsInscriptionScreenLogic() {
|
|
|
6959
7220
|
inscriptions,
|
|
6960
7221
|
minOutputValue,
|
|
6961
7222
|
splitedCount,
|
|
7223
|
+
enableRBF,
|
|
7224
|
+
setEnableRBF: onEnableRBFChange,
|
|
6962
7225
|
error,
|
|
6963
7226
|
disabled,
|
|
6964
7227
|
onOutputValueChange,
|
|
@@ -7122,9 +7385,16 @@ function useSendAlkanesNFTScreenLogic() {
|
|
|
7122
7385
|
inscription: void 0
|
|
7123
7386
|
});
|
|
7124
7387
|
const [error, setError] = React.useState("");
|
|
7388
|
+
const [enableRBF, setEnableRBF] = React.useState(true);
|
|
7125
7389
|
useCurrentAccount();
|
|
7126
7390
|
const tools = useTools();
|
|
7391
|
+
const wallet = useWallet();
|
|
7127
7392
|
const { feeRate } = useFeeRateBar();
|
|
7393
|
+
React.useEffect(() => {
|
|
7394
|
+
wallet.getEnableRBF().then((enableRBF2) => {
|
|
7395
|
+
setEnableRBF(enableRBF2);
|
|
7396
|
+
});
|
|
7397
|
+
}, [wallet]);
|
|
7128
7398
|
React.useEffect(() => {
|
|
7129
7399
|
setError("");
|
|
7130
7400
|
setDisabled(true);
|
|
@@ -7146,7 +7416,14 @@ function useSendAlkanesNFTScreenLogic() {
|
|
|
7146
7416
|
const onCreateTxHandleConfirm = async () => {
|
|
7147
7417
|
tools.showLoading(true);
|
|
7148
7418
|
try {
|
|
7149
|
-
const toSignData = await prepareSendAlkanes(
|
|
7419
|
+
const toSignData = await prepareSendAlkanes(
|
|
7420
|
+
toInfo,
|
|
7421
|
+
alkanesInfo.alkaneid,
|
|
7422
|
+
"1",
|
|
7423
|
+
feeRate,
|
|
7424
|
+
"nft",
|
|
7425
|
+
enableRBF
|
|
7426
|
+
);
|
|
7150
7427
|
if (toSignData) {
|
|
7151
7428
|
transferData.current.toSignData = toSignData;
|
|
7152
7429
|
setStep(1);
|
|
@@ -7187,14 +7464,20 @@ function useSendAlkanesNFTScreenLogic() {
|
|
|
7187
7464
|
toSignDatas: [transferData.current.toSignData]
|
|
7188
7465
|
}
|
|
7189
7466
|
};
|
|
7467
|
+
const onEnableRBFChange = (value) => {
|
|
7468
|
+
setEnableRBF(value);
|
|
7469
|
+
wallet.setEnableRBF(value);
|
|
7470
|
+
};
|
|
7190
7471
|
return {
|
|
7191
7472
|
step,
|
|
7192
7473
|
t,
|
|
7193
7474
|
alkanesInfo,
|
|
7194
7475
|
toInfo,
|
|
7476
|
+
enableRBF,
|
|
7195
7477
|
disabled,
|
|
7196
7478
|
error,
|
|
7197
7479
|
setToInfo,
|
|
7480
|
+
setEnableRBF: onEnableRBFChange,
|
|
7198
7481
|
onCreateTxHandleConfirm,
|
|
7199
7482
|
onCreateTxHandleBack,
|
|
7200
7483
|
onSignPsbtHandleConfirm,
|
|
@@ -7223,6 +7506,7 @@ function useSendAlkanesScreenLogic() {
|
|
|
7223
7506
|
});
|
|
7224
7507
|
const [availableBalance, setAvailableBalance] = React.useState(tokenBalance.amount);
|
|
7225
7508
|
const [error, setError] = React.useState("");
|
|
7509
|
+
const [enableRBF, setEnableRBF] = React.useState(true);
|
|
7226
7510
|
const totalBalanceStr = React.useMemo(() => {
|
|
7227
7511
|
return baseUtils.bnUtils.toDecimalAmount(tokenBalance.amount, tokenBalance.divisibility);
|
|
7228
7512
|
}, [tokenBalance]);
|
|
@@ -7271,6 +7555,11 @@ function useSendAlkanesScreenLogic() {
|
|
|
7271
7555
|
});
|
|
7272
7556
|
const [step, setStep] = React.useState(0 /* CREATE_TX */);
|
|
7273
7557
|
const wallet = useWallet();
|
|
7558
|
+
React.useEffect(() => {
|
|
7559
|
+
wallet.getEnableRBF().then((enableRBF2) => {
|
|
7560
|
+
setEnableRBF(enableRBF2);
|
|
7561
|
+
});
|
|
7562
|
+
}, [wallet]);
|
|
7274
7563
|
const prepareSendAlkanes = usePrepareSendAlkanesCallback();
|
|
7275
7564
|
const pushBitcoinTx = usePushBitcoinTxCallback();
|
|
7276
7565
|
const onClickBack = () => {
|
|
@@ -7284,7 +7573,8 @@ function useSendAlkanesScreenLogic() {
|
|
|
7284
7573
|
tokenBalance.alkaneid,
|
|
7285
7574
|
baseUtils.bnUtils.fromDecimalAmount(inputAmount, tokenBalance.divisibility),
|
|
7286
7575
|
feeRate,
|
|
7287
|
-
"ft"
|
|
7576
|
+
"ft",
|
|
7577
|
+
enableRBF
|
|
7288
7578
|
);
|
|
7289
7579
|
if (toSignData) {
|
|
7290
7580
|
transferData.current.toSignData = toSignData;
|
|
@@ -7322,6 +7612,10 @@ function useSendAlkanesScreenLogic() {
|
|
|
7322
7612
|
const onSignPsbtHandleBack = () => {
|
|
7323
7613
|
setStep(0 /* CREATE_TX */);
|
|
7324
7614
|
};
|
|
7615
|
+
const onEnableRBFChange = (value) => {
|
|
7616
|
+
setEnableRBF(value);
|
|
7617
|
+
wallet.setEnableRBF(value);
|
|
7618
|
+
};
|
|
7325
7619
|
return {
|
|
7326
7620
|
step,
|
|
7327
7621
|
t,
|
|
@@ -7331,11 +7625,13 @@ function useSendAlkanesScreenLogic() {
|
|
|
7331
7625
|
totalBalanceStr,
|
|
7332
7626
|
availableBalanceStr,
|
|
7333
7627
|
inputAmount,
|
|
7628
|
+
enableRBF,
|
|
7334
7629
|
disabled,
|
|
7335
7630
|
error,
|
|
7336
7631
|
// actions
|
|
7337
7632
|
setToInfo,
|
|
7338
7633
|
setInputAmount,
|
|
7634
|
+
setEnableRBF: onEnableRBFChange,
|
|
7339
7635
|
onClickBack,
|
|
7340
7636
|
onClickNext,
|
|
7341
7637
|
// sign psbt actions
|
|
@@ -7421,6 +7717,7 @@ function useCAT721NFTScreenLogic() {
|
|
|
7421
7717
|
const { collectionInfo, localId, version } = nav.getRouteState();
|
|
7422
7718
|
const { t } = useI18n();
|
|
7423
7719
|
const resetTxState = useResetTxState();
|
|
7720
|
+
const accountCapabilities = useCurrentAccountCapabilities();
|
|
7424
7721
|
const onClickBack = () => {
|
|
7425
7722
|
nav.goBack();
|
|
7426
7723
|
};
|
|
@@ -7441,7 +7738,8 @@ function useCAT721NFTScreenLogic() {
|
|
|
7441
7738
|
t,
|
|
7442
7739
|
// actions
|
|
7443
7740
|
onClickBack,
|
|
7444
|
-
onClickSend
|
|
7741
|
+
onClickSend,
|
|
7742
|
+
disabledSend: !accountCapabilities.canCreateSigningRequest
|
|
7445
7743
|
};
|
|
7446
7744
|
}
|
|
7447
7745
|
function useSignMessageLogic(props) {
|
|
@@ -7457,10 +7755,10 @@ function useSignMessageLogic(props) {
|
|
|
7457
7755
|
const [loading, setLoading] = React.useState(false);
|
|
7458
7756
|
const [isKeystoneSigning, setIsKeystoneSigning] = React.useState(false);
|
|
7459
7757
|
const [isColdWalletSigning, setIsColdWalletSigning] = React.useState(false);
|
|
7758
|
+
const [readonlySignature, setReadonlySignature] = React.useState("");
|
|
7460
7759
|
const wallet = useWallet();
|
|
7461
|
-
useTools();
|
|
7462
|
-
const
|
|
7463
|
-
const keyringType = currentAccount.type;
|
|
7760
|
+
const tools = useTools();
|
|
7761
|
+
const accountCapabilities = useCurrentAccountCapabilities();
|
|
7464
7762
|
const { t } = useI18n();
|
|
7465
7763
|
const [disclaimerVisible, setDisclaimerVisible] = React.useState(false);
|
|
7466
7764
|
const [signingTxIndex, setSigningTxIndex] = React.useState(toSignMessages.length > 1 ? -1 : 0);
|
|
@@ -7478,11 +7776,11 @@ function useSignMessageLogic(props) {
|
|
|
7478
7776
|
if (toSignMessages.length <= 1) {
|
|
7479
7777
|
return;
|
|
7480
7778
|
}
|
|
7481
|
-
if (
|
|
7779
|
+
if (accountCapabilities.signMethod !== walletShared.AccountSignMethod.Local) {
|
|
7482
7780
|
return;
|
|
7483
7781
|
}
|
|
7484
7782
|
setAllowQuickMultiSign(websiteResult.allowQuickMultiSign && toSignMessages.length > 1);
|
|
7485
|
-
}, [websiteResult,
|
|
7783
|
+
}, [websiteResult, accountCapabilities, toSignMessages.length]);
|
|
7486
7784
|
useAsyncEffect(async () => {
|
|
7487
7785
|
const website = session?.origin;
|
|
7488
7786
|
if (website) {
|
|
@@ -7579,12 +7877,27 @@ function useSignMessageLogic(props) {
|
|
|
7579
7877
|
}
|
|
7580
7878
|
};
|
|
7581
7879
|
const onNextStep = () => {
|
|
7582
|
-
|
|
7583
|
-
|
|
7584
|
-
|
|
7585
|
-
|
|
7586
|
-
|
|
7587
|
-
|
|
7880
|
+
switch (accountCapabilities.signMethod) {
|
|
7881
|
+
case walletShared.AccountSignMethod.Keystone:
|
|
7882
|
+
setIsKeystoneSigning(true);
|
|
7883
|
+
return;
|
|
7884
|
+
case walletShared.AccountSignMethod.ColdWallet:
|
|
7885
|
+
setIsColdWalletSigning(true);
|
|
7886
|
+
return;
|
|
7887
|
+
case walletShared.AccountSignMethod.External:
|
|
7888
|
+
if (!readonlySignature) {
|
|
7889
|
+
tools.toastError(t("please_enter_your_signature"));
|
|
7890
|
+
return;
|
|
7891
|
+
}
|
|
7892
|
+
onSignedData({ signature: readonlySignature }, signingTxIndex);
|
|
7893
|
+
setReadonlySignature("");
|
|
7894
|
+
return;
|
|
7895
|
+
case walletShared.AccountSignMethod.Local:
|
|
7896
|
+
localSign();
|
|
7897
|
+
return;
|
|
7898
|
+
case walletShared.AccountSignMethod.None:
|
|
7899
|
+
default:
|
|
7900
|
+
tools.toastError(t("not_supported"));
|
|
7588
7901
|
}
|
|
7589
7902
|
};
|
|
7590
7903
|
const onSignedData = (data, signingTxIndex2) => {
|
|
@@ -7659,6 +7972,8 @@ function useSignMessageLogic(props) {
|
|
|
7659
7972
|
onKeystoneSigningBack,
|
|
7660
7973
|
onColdWalletSigningSuccess,
|
|
7661
7974
|
onColdWalletSigningBack,
|
|
7975
|
+
readonlySignature,
|
|
7976
|
+
setReadonlySignature,
|
|
7662
7977
|
onDisclaimerModalClose
|
|
7663
7978
|
};
|
|
7664
7979
|
}
|
|
@@ -7677,11 +7992,11 @@ function useSignPsbtLogic(props) {
|
|
|
7677
7992
|
const [isPsbtRiskPopoverVisible, setIsPsbtRiskPopoverVisible] = React.useState(false);
|
|
7678
7993
|
const [isKeystoneSigning, setIsKeystoneSigning] = React.useState(false);
|
|
7679
7994
|
const [isColdWalletSigning, setIsColdWalletSigning] = React.useState(false);
|
|
7995
|
+
const [readonlySignedPsbtHex, setReadonlySignedPsbtHex] = React.useState("");
|
|
7680
7996
|
const [contractPopoverData, setContractPopoverData] = React.useState(void 0);
|
|
7681
7997
|
const wallet = useWallet();
|
|
7682
7998
|
const tools = useTools();
|
|
7683
|
-
const
|
|
7684
|
-
const keyringType = currentAccount.type;
|
|
7999
|
+
const accountCapabilities = useCurrentAccountCapabilities();
|
|
7685
8000
|
const { t } = useI18n();
|
|
7686
8001
|
const [disclaimerVisible, setDisclaimerVisible] = React.useState(false);
|
|
7687
8002
|
const [localPsbtSummary, setLocalPsbtSummary] = React.useState(null);
|
|
@@ -7700,11 +8015,11 @@ function useSignPsbtLogic(props) {
|
|
|
7700
8015
|
if (toSignDatas.length <= 1) {
|
|
7701
8016
|
return;
|
|
7702
8017
|
}
|
|
7703
|
-
if (
|
|
8018
|
+
if (accountCapabilities.signMethod !== walletShared.AccountSignMethod.Local) {
|
|
7704
8019
|
return;
|
|
7705
8020
|
}
|
|
7706
8021
|
setAllowQuickMultiSign(websiteResult.allowQuickMultiSign && toSignDatas.length > 1);
|
|
7707
|
-
}, [websiteResult,
|
|
8022
|
+
}, [websiteResult, accountCapabilities]);
|
|
7708
8023
|
useAsyncEffect(async () => {
|
|
7709
8024
|
const website = session?.origin;
|
|
7710
8025
|
if (website) {
|
|
@@ -7905,12 +8220,27 @@ function useSignPsbtLogic(props) {
|
|
|
7905
8220
|
}
|
|
7906
8221
|
};
|
|
7907
8222
|
const onNextStep = () => {
|
|
7908
|
-
|
|
7909
|
-
|
|
7910
|
-
|
|
7911
|
-
|
|
7912
|
-
|
|
7913
|
-
|
|
8223
|
+
switch (accountCapabilities.signMethod) {
|
|
8224
|
+
case walletShared.AccountSignMethod.Keystone:
|
|
8225
|
+
setIsKeystoneSigning(true);
|
|
8226
|
+
return;
|
|
8227
|
+
case walletShared.AccountSignMethod.ColdWallet:
|
|
8228
|
+
setIsColdWalletSigning(true);
|
|
8229
|
+
return;
|
|
8230
|
+
case walletShared.AccountSignMethod.External:
|
|
8231
|
+
if (!readonlySignedPsbtHex) {
|
|
8232
|
+
tools.toastError(t("invalid_psbt"));
|
|
8233
|
+
return;
|
|
8234
|
+
}
|
|
8235
|
+
onSignedData({ psbtHex: readonlySignedPsbtHex }, signingTxIndex);
|
|
8236
|
+
setReadonlySignedPsbtHex("");
|
|
8237
|
+
return;
|
|
8238
|
+
case walletShared.AccountSignMethod.Local:
|
|
8239
|
+
localSign();
|
|
8240
|
+
return;
|
|
8241
|
+
case walletShared.AccountSignMethod.None:
|
|
8242
|
+
default:
|
|
8243
|
+
tools.toastError(t("not_supported"));
|
|
7914
8244
|
}
|
|
7915
8245
|
};
|
|
7916
8246
|
const onSignedData = (data, signingTxIndex2) => {
|
|
@@ -7987,6 +8317,8 @@ function useSignPsbtLogic(props) {
|
|
|
7987
8317
|
toSignDatas,
|
|
7988
8318
|
currentToSignData,
|
|
7989
8319
|
currentDecodedPsbt,
|
|
8320
|
+
readonlySignedPsbtHex,
|
|
8321
|
+
setReadonlySignedPsbtHex,
|
|
7990
8322
|
// state
|
|
7991
8323
|
networkFee,
|
|
7992
8324
|
isValid,
|
|
@@ -8227,6 +8559,10 @@ function useSettingsTabScreenLogic() {
|
|
|
8227
8559
|
const item = walletShared.ADDRESS_TYPES[currentKeyring.addressType];
|
|
8228
8560
|
return currentKeyring.hdPath !== "" && item.hdPath !== currentKeyring.hdPath;
|
|
8229
8561
|
}, [currentKeyring]);
|
|
8562
|
+
const currentKeyringCapabilities = React.useMemo(
|
|
8563
|
+
() => walletShared.getAccountCapabilities({ type: currentKeyring.type }),
|
|
8564
|
+
[currentKeyring.type]
|
|
8565
|
+
);
|
|
8230
8566
|
const settings_connectedSites = React.useMemo(() => {
|
|
8231
8567
|
const value = connected ? t("connected") : t("not_connected");
|
|
8232
8568
|
return {
|
|
@@ -8258,7 +8594,7 @@ function useSettingsTabScreenLogic() {
|
|
|
8258
8594
|
let value = "";
|
|
8259
8595
|
const item = walletShared.ADDRESS_TYPES[currentKeyring.addressType];
|
|
8260
8596
|
const hdPath = currentKeyring.hdPath || item.hdPath;
|
|
8261
|
-
if (currentKeyring.type === types.KeyringType.SimpleKeyring) {
|
|
8597
|
+
if (currentKeyring.type === types.KeyringType.SimpleKeyring || currentKeyringCapabilities.signMethod === walletShared.AccountSignMethod.External || !currentKeyringCapabilities.canChangeAddressType) {
|
|
8262
8598
|
value = `${item.name}`;
|
|
8263
8599
|
} else {
|
|
8264
8600
|
value = `${item.name} (${hdPath}/${currentAccount.index})`;
|
|
@@ -8282,7 +8618,7 @@ function useSettingsTabScreenLogic() {
|
|
|
8282
8618
|
nav.navigate("AddressTypeScreen");
|
|
8283
8619
|
}
|
|
8284
8620
|
};
|
|
8285
|
-
}, [t, isCustomHdPath]);
|
|
8621
|
+
}, [t, isCustomHdPath, currentKeyring, currentAccount.index, currentKeyringCapabilities]);
|
|
8286
8622
|
const settings_advanced = React.useMemo(() => {
|
|
8287
8623
|
return {
|
|
8288
8624
|
key: "settings_advanced",
|
|
@@ -8543,6 +8879,7 @@ exports.BRC20TokenScreenTabKey = BRC20TokenScreenTabKey;
|
|
|
8543
8879
|
exports.CATAssetTabKey = CATAssetTabKey;
|
|
8544
8880
|
exports.DeviceContext = DeviceContext;
|
|
8545
8881
|
exports.I18nContext = I18nContext;
|
|
8882
|
+
exports.MoreAssetTabKey = MoreAssetTabKey;
|
|
8546
8883
|
exports.NavigationContext = NavigationContext;
|
|
8547
8884
|
exports.NavigationSource = NavigationSource;
|
|
8548
8885
|
exports.OrdinalsAssetTabKey = OrdinalsAssetTabKey;
|
|
@@ -8586,6 +8923,7 @@ exports.useAlkanesListLogic = useAlkanesListLogic;
|
|
|
8586
8923
|
exports.useAlkanesMarketPlaceWebsite = useAlkanesMarketPlaceWebsite;
|
|
8587
8924
|
exports.useAlkanesNFTListLogic = useAlkanesNFTListLogic;
|
|
8588
8925
|
exports.useAlkanesNFTScreenLogic = useAlkanesNFTScreenLogic;
|
|
8926
|
+
exports.useAlkanesTokenInfoExplorerUrl = useAlkanesTokenInfoExplorerUrl;
|
|
8589
8927
|
exports.useAlkanesTokenScreenLogic = useAlkanesTokenScreenLogic;
|
|
8590
8928
|
exports.useAmountInput = useAmountInput;
|
|
8591
8929
|
exports.useAmountInputLogic = useAmountInputLogic;
|
|
@@ -8649,6 +8987,7 @@ exports.useCreatePasswordScreenLogic = useCreatePasswordScreenLogic;
|
|
|
8649
8987
|
exports.useCreateSplitTxCallback = useCreateSplitTxCallback;
|
|
8650
8988
|
exports.useCreateWalletLogicImportWordsStep = useCreateWalletLogicImportWordsStep;
|
|
8651
8989
|
exports.useCurrentAccount = useCurrentAccount;
|
|
8990
|
+
exports.useCurrentAccountCapabilities = useCurrentAccountCapabilities;
|
|
8652
8991
|
exports.useCurrentAddress = useCurrentAddress;
|
|
8653
8992
|
exports.useCurrentKeyring = useCurrentKeyring;
|
|
8654
8993
|
exports.useDeveloperMode = useDeveloperMode;
|
|
@@ -8697,6 +9036,7 @@ exports.useLockCallback = useLockCallback;
|
|
|
8697
9036
|
exports.useLockTimePageLogic = useLockTimePageLogic;
|
|
8698
9037
|
exports.useLockedOverlayVisible = useLockedOverlayVisible;
|
|
8699
9038
|
exports.useModelPopover = useModelPopover;
|
|
9039
|
+
exports.useMoreAssetTabKey = useMoreAssetTabKey;
|
|
8700
9040
|
exports.useNavigation = useNavigation;
|
|
8701
9041
|
exports.useNetworkType = useNetworkType;
|
|
8702
9042
|
exports.useNotificationsLogic = useNotificationsLogic;
|
|
@@ -8726,6 +9066,7 @@ exports.useRunesIconInfo = useRunesIconInfo;
|
|
|
8726
9066
|
exports.useRunesInscribeUrl = useRunesInscribeUrl;
|
|
8727
9067
|
exports.useRunesListLogic = useRunesListLogic;
|
|
8728
9068
|
exports.useRunesMarketUrl = useRunesMarketUrl;
|
|
9069
|
+
exports.useRunesTokenInfoExplorerUrl = useRunesTokenInfoExplorerUrl;
|
|
8729
9070
|
exports.useRunesTokenScreenLogic = useRunesTokenScreenLogic;
|
|
8730
9071
|
exports.useRunesTx = useRunesTx;
|
|
8731
9072
|
exports.useSafeBalance = useSafeBalance;
|