@embarkai/ui-kit 0.4.56 → 0.4.58
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/dist/iframe/index.html +1 -1
- package/dist/iframe/main.js +1 -1
- package/dist/index.cjs +1063 -905
- package/dist/index.d.cts +105 -1
- package/dist/index.d.ts +105 -1
- package/dist/index.js +879 -727
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -852,31 +852,31 @@ var init_useLayoutDataStore = __esm({
|
|
|
852
852
|
"src/internal/hooks/useLayoutDataStore.ts"() {
|
|
853
853
|
import_zustand = require("zustand");
|
|
854
854
|
init_constants();
|
|
855
|
-
PageKey = /* @__PURE__ */ ((
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
return
|
|
855
|
+
PageKey = /* @__PURE__ */ ((PageKey4) => {
|
|
856
|
+
PageKey4["AUTH"] = "auth";
|
|
857
|
+
PageKey4["LANGUAGES"] = "languages";
|
|
858
|
+
PageKey4["TERMS_OF_SERVICE"] = "terms-of-service";
|
|
859
|
+
PageKey4["MAIN_MENU"] = "main-menu";
|
|
860
|
+
PageKey4["SETTINGS"] = "settings";
|
|
861
|
+
PageKey4["SEND"] = "send";
|
|
862
|
+
PageKey4["RECEIVE"] = "receive";
|
|
863
|
+
PageKey4["BUY"] = "buy";
|
|
864
|
+
PageKey4["KYC"] = "kyc";
|
|
865
|
+
PageKey4["TRANSACTIONS"] = "transactions";
|
|
866
|
+
PageKey4["ASSETS"] = "assets";
|
|
867
|
+
PageKey4["MANAGE_WALLET"] = "manage-wallet";
|
|
868
|
+
PageKey4["UNLINK_PROVIDER"] = "unlink-provider";
|
|
869
|
+
PageKey4["SECURITY"] = "security";
|
|
870
|
+
PageKey4["KEYSARE_BACKUP"] = "keysare-backup";
|
|
871
|
+
PageKey4["KEYSHARE_RESTORE"] = "keyshare-restore";
|
|
872
|
+
PageKey4["CHAIN"] = "chain";
|
|
873
|
+
PageKey4["CHAIN_SWITCH_REQUEST"] = "chain-switch-request";
|
|
874
|
+
PageKey4["NICKNAME_SETTINGS"] = "nickname-settings";
|
|
875
|
+
PageKey4["DEVICES"] = "devices";
|
|
876
|
+
PageKey4["DEVICE_LINK"] = "device-link";
|
|
877
|
+
PageKey4["DEVICE_MANAGE"] = "device-manage";
|
|
878
|
+
PageKey4["DEVICE_RESTORE"] = "device-restore";
|
|
879
|
+
return PageKey4;
|
|
880
880
|
})(PageKey || {});
|
|
881
881
|
useLayoutDataStore = (0, import_zustand.create)((set) => ({
|
|
882
882
|
page: null,
|
|
@@ -2465,7 +2465,7 @@ function usePageParams() {
|
|
|
2465
2465
|
currentParams.current = pageParams;
|
|
2466
2466
|
setPageParams(null);
|
|
2467
2467
|
}, []);
|
|
2468
|
-
return currentParams
|
|
2468
|
+
return currentParams;
|
|
2469
2469
|
}
|
|
2470
2470
|
var import_react4;
|
|
2471
2471
|
var init_useOpenPage = __esm({
|
|
@@ -5516,7 +5516,7 @@ var init_en = __esm({
|
|
|
5516
5516
|
selectToken: "Select Asset",
|
|
5517
5517
|
estimations: "Estimations",
|
|
5518
5518
|
estimatedFee: "Estimated Fee",
|
|
5519
|
-
availableChainPairs: "
|
|
5519
|
+
availableChainPairs: "Select Chain Pairs",
|
|
5520
5520
|
toChain: "To Chain",
|
|
5521
5521
|
fromChain: "From Chain",
|
|
5522
5522
|
optionalRecipient: "Recipient (optional, if empty - destination chain address = sender address on origin chain)",
|
|
@@ -5591,7 +5591,12 @@ var init_en = __esm({
|
|
|
5591
5591
|
exchangeRate: "Exchange Rate",
|
|
5592
5592
|
networkFee: "Network Fee",
|
|
5593
5593
|
serviceFee: "Service Fee",
|
|
5594
|
-
paymentMethod: "Payment Method"
|
|
5594
|
+
paymentMethod: "Payment Method",
|
|
5595
|
+
toAddress: {
|
|
5596
|
+
receiver: "ATTENTION! Receiving Address",
|
|
5597
|
+
message: "You are about to purchase crypto to an external address, not your embarkAI address.",
|
|
5598
|
+
suggestion: "Please make sure this is your correct wallet address, otherwise you may lose your funds."
|
|
5599
|
+
}
|
|
5595
5600
|
},
|
|
5596
5601
|
transactionHistory: {
|
|
5597
5602
|
details: "Details"
|
|
@@ -5609,7 +5614,8 @@ var init_en = __esm({
|
|
|
5609
5614
|
},
|
|
5610
5615
|
portfolioMenu: {
|
|
5611
5616
|
title: "Your Assets",
|
|
5612
|
-
noAssets: "No assets found"
|
|
5617
|
+
noAssets: "No assets found",
|
|
5618
|
+
noBlockscout: "No Blockscout API found for chain: {{chain}}"
|
|
5613
5619
|
},
|
|
5614
5620
|
transactionsMenu: {
|
|
5615
5621
|
title: "Transactions History",
|
|
@@ -8809,11 +8815,35 @@ var init_priceFormatter = __esm({
|
|
|
8809
8815
|
});
|
|
8810
8816
|
|
|
8811
8817
|
// src/internal/components/BuyMenu/useBuyMenuStore.ts
|
|
8812
|
-
|
|
8818
|
+
function useBuyMenuParams() {
|
|
8819
|
+
(0, import_react21.useEffect)(() => {
|
|
8820
|
+
const { pageParams, setPageParams } = useLayoutDataStore.getState();
|
|
8821
|
+
if (!pageParams || !(0, import_lodash_es4.keys)(pageParams).length) return;
|
|
8822
|
+
const { amount, crypto: crypto2, toWalletAddress, confirmationMessage, onRampWidgetRedirected } = pageParams || {};
|
|
8823
|
+
switch (true) {
|
|
8824
|
+
case !!amount:
|
|
8825
|
+
useBuyMenuStore.getState().setSrcInputAmount(amount);
|
|
8826
|
+
useBuyMenuStore.getState().setSrcQueryAmount(amount);
|
|
8827
|
+
case !!crypto2:
|
|
8828
|
+
useBuyMenuStore.getState().setSelectedCrypto(crypto2);
|
|
8829
|
+
case !!toWalletAddress:
|
|
8830
|
+
useBuyMenuStore.getState().setToWalletAddress(toWalletAddress);
|
|
8831
|
+
case !!onRampWidgetRedirected:
|
|
8832
|
+
useBuyMenuStore.getState().setOnRampWidgetRedirectedFn(onRampWidgetRedirected);
|
|
8833
|
+
case !!confirmationMessage:
|
|
8834
|
+
useBuyMenuStore.getState().setConfirmationMessage(confirmationMessage);
|
|
8835
|
+
}
|
|
8836
|
+
setPageParams(null);
|
|
8837
|
+
}, []);
|
|
8838
|
+
}
|
|
8839
|
+
var import_lodash_es4, import_react21, import_zustand4, import_middleware, DEFAULT_MENU_SWITCHES, DEFAULT_PROVIDER, useBuyMenuStore;
|
|
8813
8840
|
var init_useBuyMenuStore = __esm({
|
|
8814
8841
|
"src/internal/components/BuyMenu/useBuyMenuStore.ts"() {
|
|
8842
|
+
import_lodash_es4 = require("lodash-es");
|
|
8843
|
+
import_react21 = require("react");
|
|
8815
8844
|
import_zustand4 = require("zustand");
|
|
8816
8845
|
import_middleware = require("zustand/middleware");
|
|
8846
|
+
init_useLayoutDataStore();
|
|
8817
8847
|
DEFAULT_MENU_SWITCHES = {
|
|
8818
8848
|
isTransactionHistory: false,
|
|
8819
8849
|
isProviderSelector: false,
|
|
@@ -8828,6 +8858,8 @@ var init_useBuyMenuStore = __esm({
|
|
|
8828
8858
|
(set) => ({
|
|
8829
8859
|
renderKey: "default-initial-buy-menu-render-key",
|
|
8830
8860
|
setRenderKey: (key) => set({ renderKey: key }),
|
|
8861
|
+
toWalletAddress: null,
|
|
8862
|
+
setToWalletAddress: (toWalletAddress) => set({ toWalletAddress }),
|
|
8831
8863
|
/** boolean flags */
|
|
8832
8864
|
isTransactionHistory: false,
|
|
8833
8865
|
setIsTransactionHistory: (isTransactionHistory) => {
|
|
@@ -8877,6 +8909,10 @@ var init_useBuyMenuStore = __esm({
|
|
|
8877
8909
|
srcQueryAmount: 0,
|
|
8878
8910
|
setSrcQueryAmount: (amount) => set({ srcQueryAmount: amount }),
|
|
8879
8911
|
/** */
|
|
8912
|
+
onRampWidgetRedirected: import_lodash_es4.noop,
|
|
8913
|
+
setOnRampWidgetRedirectedFn: (cb) => set({ onRampWidgetRedirected: cb }),
|
|
8914
|
+
confirmationMessage: null,
|
|
8915
|
+
setConfirmationMessage: (message) => set({ confirmationMessage: message }),
|
|
8880
8916
|
error: null,
|
|
8881
8917
|
setError: (error) => set({ error })
|
|
8882
8918
|
}),
|
|
@@ -8928,16 +8964,16 @@ function CryptoSelector(props) {
|
|
|
8928
8964
|
const { coins } = props;
|
|
8929
8965
|
const { t } = useT();
|
|
8930
8966
|
const chainConfig = useSession((st) => st.chainConfig);
|
|
8931
|
-
const [searchValue, setSearchValue] = (0,
|
|
8932
|
-
const [target, setTarget] = (0,
|
|
8933
|
-
const setSearchDebounced = (0,
|
|
8934
|
-
(0,
|
|
8967
|
+
const [searchValue, setSearchValue] = (0, import_react22.useState)("");
|
|
8968
|
+
const [target, setTarget] = (0, import_react22.useState)("");
|
|
8969
|
+
const setSearchDebounced = (0, import_react22.useCallback)(
|
|
8970
|
+
(0, import_lodash_es5.debounce)((value) => {
|
|
8935
8971
|
setTarget(value);
|
|
8936
8972
|
useBuyMenuStore.getState().setRenderKey(`on-ramp-crypto-selector-${Date.now()}`);
|
|
8937
8973
|
}, 1e3),
|
|
8938
8974
|
[]
|
|
8939
8975
|
);
|
|
8940
|
-
const filteredCoins = (0,
|
|
8976
|
+
const filteredCoins = (0, import_react22.useMemo)(() => {
|
|
8941
8977
|
const sorted = [...coins].sort((a, b) => {
|
|
8942
8978
|
const aIdx = POPULAR_CRYPTOS.indexOf(a.symbol.toUpperCase());
|
|
8943
8979
|
const bIdx = POPULAR_CRYPTOS.indexOf(b.symbol.toUpperCase());
|
|
@@ -8949,7 +8985,7 @@ function CryptoSelector(props) {
|
|
|
8949
8985
|
if (!target) return sorted;
|
|
8950
8986
|
return sorted.filter((f) => f.symbol.toLowerCase().includes(target.toLowerCase()));
|
|
8951
8987
|
}, [coins, target]);
|
|
8952
|
-
const groupedCoins = (0,
|
|
8988
|
+
const groupedCoins = (0, import_lodash_es5.toPairs)(
|
|
8953
8989
|
filteredCoins.reduce(
|
|
8954
8990
|
(acc, coin) => {
|
|
8955
8991
|
const network = coin.network;
|
|
@@ -9043,16 +9079,16 @@ function CryptoSelectorTrigger(props) {
|
|
|
9043
9079
|
}
|
|
9044
9080
|
);
|
|
9045
9081
|
}
|
|
9046
|
-
var
|
|
9082
|
+
var import_lodash_es5, import_lucide_react9, import_react22, import_jsx_runtime32, POPULAR_CRYPTOS;
|
|
9047
9083
|
var init_CryptoSelector = __esm({
|
|
9048
9084
|
"src/internal/components/BuyMenu/components/CryptoSelector.tsx"() {
|
|
9049
9085
|
init_tokens();
|
|
9050
9086
|
init_utils2();
|
|
9051
9087
|
init_SessionContext();
|
|
9052
9088
|
init_i18n();
|
|
9053
|
-
|
|
9089
|
+
import_lodash_es5 = require("lodash-es");
|
|
9054
9090
|
import_lucide_react9 = require("lucide-react");
|
|
9055
|
-
|
|
9091
|
+
import_react22 = require("react");
|
|
9056
9092
|
init_priceFormatter();
|
|
9057
9093
|
init_button();
|
|
9058
9094
|
init_highlight();
|
|
@@ -9154,16 +9190,16 @@ function FiatSelector(props) {
|
|
|
9154
9190
|
const { fiats } = props;
|
|
9155
9191
|
const { t, i18n } = useT();
|
|
9156
9192
|
const locale = i18n.resolvedLanguage || "en";
|
|
9157
|
-
const [searchValue, setSearchValue] = (0,
|
|
9158
|
-
const [target, setTarget] = (0,
|
|
9159
|
-
const setSearchDebounced = (0,
|
|
9160
|
-
(0,
|
|
9193
|
+
const [searchValue, setSearchValue] = (0, import_react23.useState)("");
|
|
9194
|
+
const [target, setTarget] = (0, import_react23.useState)("");
|
|
9195
|
+
const setSearchDebounced = (0, import_react23.useCallback)(
|
|
9196
|
+
(0, import_lodash_es6.debounce)((value) => {
|
|
9161
9197
|
setTarget(value);
|
|
9162
9198
|
useBuyMenuStore.getState().setRenderKey(`on-ramp-fiat-selector-${Date.now()}`);
|
|
9163
9199
|
}, 1e3),
|
|
9164
9200
|
[]
|
|
9165
9201
|
);
|
|
9166
|
-
const filteredFiats = (0,
|
|
9202
|
+
const filteredFiats = (0, import_react23.useMemo)(() => {
|
|
9167
9203
|
const sorted = [...fiats].sort((a, b) => {
|
|
9168
9204
|
const aIdx = POPULAR_FIATS.indexOf(a.ticker.toUpperCase());
|
|
9169
9205
|
const bIdx = POPULAR_FIATS.indexOf(b.ticker.toUpperCase());
|
|
@@ -9228,13 +9264,13 @@ function FiatSelectorTrigger(props) {
|
|
|
9228
9264
|
}
|
|
9229
9265
|
);
|
|
9230
9266
|
}
|
|
9231
|
-
var
|
|
9267
|
+
var import_lodash_es6, import_lucide_react10, import_react23, import_jsx_runtime34, POPULAR_FIATS;
|
|
9232
9268
|
var init_FiatSelector = __esm({
|
|
9233
9269
|
"src/internal/components/BuyMenu/components/FiatSelector.tsx"() {
|
|
9234
9270
|
init_i18n();
|
|
9235
|
-
|
|
9271
|
+
import_lodash_es6 = require("lodash-es");
|
|
9236
9272
|
import_lucide_react10 = require("lucide-react");
|
|
9237
|
-
|
|
9273
|
+
import_react23 = require("react");
|
|
9238
9274
|
init_button();
|
|
9239
9275
|
init_highlight();
|
|
9240
9276
|
init_input();
|
|
@@ -9459,12 +9495,68 @@ var init_api = __esm({
|
|
|
9459
9495
|
}
|
|
9460
9496
|
});
|
|
9461
9497
|
|
|
9498
|
+
// src/internal/utils/cn.ts
|
|
9499
|
+
function cn2(...inputs) {
|
|
9500
|
+
return twMerge((0, import_clsx2.clsx)(inputs));
|
|
9501
|
+
}
|
|
9502
|
+
var import_clsx2;
|
|
9503
|
+
var init_cn = __esm({
|
|
9504
|
+
"src/internal/utils/cn.ts"() {
|
|
9505
|
+
import_clsx2 = require("clsx");
|
|
9506
|
+
init_bundle_mjs();
|
|
9507
|
+
}
|
|
9508
|
+
});
|
|
9509
|
+
|
|
9510
|
+
// src/internal/components/ui/badge.tsx
|
|
9511
|
+
function Badge(props) {
|
|
9512
|
+
const { className, variant = "secondary", size = "default", ...rest } = props;
|
|
9513
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { ...rest, className: cn2(badgeVariants({ variant, size }), className) });
|
|
9514
|
+
}
|
|
9515
|
+
var import_class_variance_authority2, import_jsx_runtime36, badgeVariants;
|
|
9516
|
+
var init_badge = __esm({
|
|
9517
|
+
"src/internal/components/ui/badge.tsx"() {
|
|
9518
|
+
import_class_variance_authority2 = require("class-variance-authority");
|
|
9519
|
+
init_cn();
|
|
9520
|
+
import_jsx_runtime36 = require("react/jsx-runtime");
|
|
9521
|
+
badgeVariants = (0, import_class_variance_authority2.cva)(
|
|
9522
|
+
cn2(
|
|
9523
|
+
//
|
|
9524
|
+
"inline-flex items-center",
|
|
9525
|
+
"border font-semibold",
|
|
9526
|
+
"select-none"
|
|
9527
|
+
),
|
|
9528
|
+
{
|
|
9529
|
+
variants: {
|
|
9530
|
+
variant: {
|
|
9531
|
+
outline: "border-[var(--ui-kit-bd)] bg-transparent text-[var(--ui-kit-fg)]",
|
|
9532
|
+
secondary: "border-[var(--ui-kit-secondary)] bg-[var(--ui-kit-secondary)] text-[var(--ui-kit-fg)]",
|
|
9533
|
+
destructive: "border-[var(--ui-kit-bg-error)] bg-[var(--ui-kit-bg-error)] text-[var(--ui-kit-error)]",
|
|
9534
|
+
success: "border-[var(--ui-kit-bg-success)] bg-[var(--ui-kit-bg-success)] text-[var(--ui-kit-success)]",
|
|
9535
|
+
warning: "border-[var(--ui-kit-bg-warning)] bg-[var(--ui-kit-bg-warning)] text-[var(--ui-kit-warning)]"
|
|
9536
|
+
},
|
|
9537
|
+
size: {
|
|
9538
|
+
default: "h-5 px-2 rounded-full text-[10px] gap-[var(--ui-kit-gap)]",
|
|
9539
|
+
medium: "h-8 px-[var(--ui-kit-pd)] rounded-[var(--ui-kit-el-bdrs)] text-sm gap-[var(--ui-kit-gap)]",
|
|
9540
|
+
large: cn2(
|
|
9541
|
+
"whitespace-nowrap text-sm font-semibold font-sans",
|
|
9542
|
+
"h-12 px-[var(--ui-kit-pd)] rounded-[var(--ui-kit-el-bdrs)]"
|
|
9543
|
+
)
|
|
9544
|
+
}
|
|
9545
|
+
},
|
|
9546
|
+
defaultVariants: {
|
|
9547
|
+
variant: "secondary"
|
|
9548
|
+
}
|
|
9549
|
+
}
|
|
9550
|
+
);
|
|
9551
|
+
}
|
|
9552
|
+
});
|
|
9553
|
+
|
|
9462
9554
|
// src/internal/components/BuyMenu/binance/config.ts
|
|
9463
|
-
var import_read9,
|
|
9555
|
+
var import_read9, CHAIN_ID_TO_BINANCE_NETWORK_TICKER;
|
|
9464
9556
|
var init_config = __esm({
|
|
9465
9557
|
"src/internal/components/BuyMenu/binance/config.ts"() {
|
|
9466
9558
|
import_read9 = require("@embarkai/core/read");
|
|
9467
|
-
|
|
9559
|
+
CHAIN_ID_TO_BINANCE_NETWORK_TICKER = {
|
|
9468
9560
|
[import_read9.LUMIA_MAINNET_CHAIN_ID]: "LUMIA",
|
|
9469
9561
|
[import_read9.BSC_MAINNET_CHAIN_ID]: "BSC"
|
|
9470
9562
|
};
|
|
@@ -9476,21 +9568,30 @@ function BinanceSummary(props) {
|
|
|
9476
9568
|
const { payment } = props;
|
|
9477
9569
|
const qc = (0, import_react_query7.useQueryClient)();
|
|
9478
9570
|
const { t } = useT();
|
|
9479
|
-
const
|
|
9571
|
+
const embarkaiAddress = useSession((st) => st.address);
|
|
9480
9572
|
const chainConfig = useSession((st) => st.chainConfig);
|
|
9481
|
-
const {
|
|
9573
|
+
const {
|
|
9574
|
+
toWalletAddress,
|
|
9575
|
+
selectedFiat,
|
|
9576
|
+
selectedCrypto,
|
|
9577
|
+
srcQueryAmount,
|
|
9578
|
+
redirecting,
|
|
9579
|
+
confirmationMessage,
|
|
9580
|
+
setRedirecting
|
|
9581
|
+
} = useBuyMenuStore();
|
|
9482
9582
|
const quoteData = useBinanceStore((st) => st.quoteData);
|
|
9483
9583
|
const cryptoToRecieve = Number(quoteData?.totalAmount || "0");
|
|
9484
9584
|
const { mutate: checkoutFundWalletOrder, isPending: isFundWalletOrderCheckouting } = (0, import_react_query7.useMutation)({
|
|
9485
9585
|
mutationFn: async () => {
|
|
9486
9586
|
setRedirecting(true);
|
|
9487
9587
|
return await createPreorderMutation({
|
|
9588
|
+
address: toWalletAddress || embarkaiAddress,
|
|
9488
9589
|
amountType: 1,
|
|
9489
9590
|
requestedAmount: String(srcQueryAmount),
|
|
9490
|
-
address: walletAddress,
|
|
9491
9591
|
fiatCurrency: selectedFiat,
|
|
9492
9592
|
cryptoCurrency: selectedCrypto,
|
|
9493
|
-
network:
|
|
9593
|
+
network: CHAIN_ID_TO_BINANCE_NETWORK_TICKER[chainConfig.id],
|
|
9594
|
+
//
|
|
9494
9595
|
payMethodCode: payment?.payMethodCode || void 0,
|
|
9495
9596
|
payMethodSubCode: payment?.payMethodSubCode || void 0,
|
|
9496
9597
|
// TODO: pass quote response to backend to create order with exact quote details (amount, fees, etc.)
|
|
@@ -9509,8 +9610,10 @@ function BinanceSummary(props) {
|
|
|
9509
9610
|
setRedirecting(false);
|
|
9510
9611
|
qc.invalidateQueries({ queryKey: [QUERY_KEYS2.binanceTransactions] });
|
|
9511
9612
|
window.open(link, "_blank", "noopener,noreferrer");
|
|
9512
|
-
useBuyMenuStore.getState()
|
|
9513
|
-
|
|
9613
|
+
const { setError, setIsTransactionHistory, onRampWidgetRedirected } = useBuyMenuStore.getState();
|
|
9614
|
+
onRampWidgetRedirected(quoteData);
|
|
9615
|
+
setError(null);
|
|
9616
|
+
setIsTransactionHistory(true);
|
|
9514
9617
|
}, REDIRECT_TIMEOUT_MS);
|
|
9515
9618
|
}
|
|
9516
9619
|
},
|
|
@@ -9522,51 +9625,59 @@ function BinanceSummary(props) {
|
|
|
9522
9625
|
});
|
|
9523
9626
|
const isContinueDisabled = !!redirecting || !!isFundWalletOrderCheckouting || !quoteData;
|
|
9524
9627
|
if (!quoteData) {
|
|
9525
|
-
return /* @__PURE__ */ (0,
|
|
9526
|
-
/* @__PURE__ */ (0,
|
|
9527
|
-
/* @__PURE__ */ (0,
|
|
9628
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Highlight, { type: "warning", className: "flex gap-[var(--ui-kit-gap)]", children: [
|
|
9629
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_lucide_react12.InfoIcon, { className: "w-4 h-4" }),
|
|
9630
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: t("passport:common.errors.oops") })
|
|
9528
9631
|
] }) });
|
|
9529
9632
|
}
|
|
9530
|
-
return /* @__PURE__ */ (0,
|
|
9531
|
-
/* @__PURE__ */ (0,
|
|
9532
|
-
/* @__PURE__ */ (0,
|
|
9533
|
-
/* @__PURE__ */ (0,
|
|
9633
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: [
|
|
9634
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex justify-between text-xs leading-5", children: [
|
|
9635
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "", children: t("passport:common.amount") }),
|
|
9636
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { className: "font-bold", children: [
|
|
9534
9637
|
formatPrice(srcQueryAmount),
|
|
9535
9638
|
" ",
|
|
9536
9639
|
selectedFiat.toUpperCase()
|
|
9537
9640
|
] })
|
|
9538
9641
|
] }),
|
|
9539
|
-
/* @__PURE__ */ (0,
|
|
9540
|
-
/* @__PURE__ */ (0,
|
|
9541
|
-
/* @__PURE__ */ (0,
|
|
9642
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex justify-between text-xs leading-5", children: [
|
|
9643
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "", children: t("passport:buyMenu.summary.youReceive") }),
|
|
9644
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { className: "font-bold", children: [
|
|
9542
9645
|
formatPrice(cryptoToRecieve),
|
|
9543
9646
|
" ",
|
|
9544
9647
|
selectedCrypto.toUpperCase()
|
|
9545
9648
|
] })
|
|
9546
9649
|
] }),
|
|
9547
|
-
/* @__PURE__ */ (0,
|
|
9548
|
-
/* @__PURE__ */ (0,
|
|
9549
|
-
/* @__PURE__ */ (0,
|
|
9550
|
-
/* @__PURE__ */ (0,
|
|
9650
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Highlight, { type: "info", className: "", children: [
|
|
9651
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("p", { className: "flex justify-between gap-[var(--ui-kit-gap)] leading-5", children: [
|
|
9652
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: t("passport:buyMenu.summary.networkFee") }),
|
|
9653
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("strong", { children: [
|
|
9551
9654
|
formatPrice(Number(quoteData?.networkFee || "0")),
|
|
9552
9655
|
" ",
|
|
9553
9656
|
quoteData?.feeCurrency || ""
|
|
9554
9657
|
] })
|
|
9555
9658
|
] }),
|
|
9556
|
-
/* @__PURE__ */ (0,
|
|
9557
|
-
/* @__PURE__ */ (0,
|
|
9558
|
-
/* @__PURE__ */ (0,
|
|
9659
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("p", { className: "flex justify-between gap-[var(--ui-kit-gap)] leading-5", children: [
|
|
9660
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: t("passport:buyMenu.summary.serviceFee") }),
|
|
9661
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("strong", { children: [
|
|
9559
9662
|
formatPrice(Number(quoteData?.feeAmount || "0")),
|
|
9560
9663
|
" ",
|
|
9561
9664
|
quoteData?.feeCurrency || ""
|
|
9562
9665
|
] })
|
|
9563
9666
|
] }),
|
|
9564
|
-
/* @__PURE__ */ (0,
|
|
9565
|
-
/* @__PURE__ */ (0,
|
|
9566
|
-
/* @__PURE__ */ (0,
|
|
9667
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("p", { className: "flex justify-between gap-[var(--ui-kit-gap)] leading-5", children: [
|
|
9668
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: t("passport:buyMenu.selectPaymentMode") }),
|
|
9669
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("strong", { children: payment?.paymentMethod?.toUpperCase() })
|
|
9670
|
+
] })
|
|
9671
|
+
] }),
|
|
9672
|
+
toWalletAddress && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Highlight, { type: "warning", children: [
|
|
9673
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "font-bold leading-6", children: t("passport:buyMenu.summary.toAddress.receiver") }),
|
|
9674
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Badge, { variant: "secondary", size: "medium", className: "w-full text-center justify-center text-[10px]", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "truncate leading-4", children: toWalletAddress }) }),
|
|
9675
|
+
!!confirmationMessage ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "leading-5", children: confirmationMessage }) : /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("p", { className: "leading-4", children: [
|
|
9676
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: t("passport:buyMenu.summary.toAddress.message") }),
|
|
9677
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: t("passport:buyMenu.summary.toAddress.suggestion") })
|
|
9567
9678
|
] })
|
|
9568
9679
|
] }),
|
|
9569
|
-
/* @__PURE__ */ (0,
|
|
9680
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
9570
9681
|
Button,
|
|
9571
9682
|
{
|
|
9572
9683
|
size: "large",
|
|
@@ -9575,9 +9686,9 @@ function BinanceSummary(props) {
|
|
|
9575
9686
|
variant: "default",
|
|
9576
9687
|
onClick: () => checkoutFundWalletOrder(),
|
|
9577
9688
|
children: [
|
|
9578
|
-
redirecting && /* @__PURE__ */ (0,
|
|
9579
|
-
/* @__PURE__ */ (0,
|
|
9580
|
-
!!quoteData?.totalAmount && /* @__PURE__ */ (0,
|
|
9689
|
+
redirecting && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_lucide_react12.LoaderIcon, { size: 16, className: "animate-spin" }),
|
|
9690
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: redirecting ? "REDIRECTING..." : String(t("passport:buyMenu.actions.confirmPurchase")).toUpperCase() }),
|
|
9691
|
+
!!quoteData?.totalAmount && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("strong", { children: [
|
|
9581
9692
|
formatPrice(Number(quoteData.totalAmount)),
|
|
9582
9693
|
" ",
|
|
9583
9694
|
selectedCrypto.toUpperCase()
|
|
@@ -9587,7 +9698,7 @@ function BinanceSummary(props) {
|
|
|
9587
9698
|
)
|
|
9588
9699
|
] });
|
|
9589
9700
|
}
|
|
9590
|
-
var import_react_query7, import_lucide_react12,
|
|
9701
|
+
var import_react_query7, import_lucide_react12, import_jsx_runtime37;
|
|
9591
9702
|
var init_BinanceSummary = __esm({
|
|
9592
9703
|
"src/internal/components/BuyMenu/binance/BinanceSummary.tsx"() {
|
|
9593
9704
|
init_utils2();
|
|
@@ -9596,6 +9707,7 @@ var init_BinanceSummary = __esm({
|
|
|
9596
9707
|
init_priceFormatter();
|
|
9597
9708
|
import_react_query7 = require("@tanstack/react-query");
|
|
9598
9709
|
import_lucide_react12 = require("lucide-react");
|
|
9710
|
+
init_badge();
|
|
9599
9711
|
init_button();
|
|
9600
9712
|
init_highlight();
|
|
9601
9713
|
init_contants();
|
|
@@ -9604,71 +9716,15 @@ var init_BinanceSummary = __esm({
|
|
|
9604
9716
|
init_api();
|
|
9605
9717
|
init_config();
|
|
9606
9718
|
init_useBinanceStore();
|
|
9607
|
-
import_jsx_runtime36 = require("react/jsx-runtime");
|
|
9608
|
-
}
|
|
9609
|
-
});
|
|
9610
|
-
|
|
9611
|
-
// src/internal/utils/cn.ts
|
|
9612
|
-
function cn2(...inputs) {
|
|
9613
|
-
return twMerge((0, import_clsx2.clsx)(inputs));
|
|
9614
|
-
}
|
|
9615
|
-
var import_clsx2;
|
|
9616
|
-
var init_cn = __esm({
|
|
9617
|
-
"src/internal/utils/cn.ts"() {
|
|
9618
|
-
import_clsx2 = require("clsx");
|
|
9619
|
-
init_bundle_mjs();
|
|
9620
|
-
}
|
|
9621
|
-
});
|
|
9622
|
-
|
|
9623
|
-
// src/internal/components/ui/badge.tsx
|
|
9624
|
-
function Badge(props) {
|
|
9625
|
-
const { className, variant = "secondary", size = "default", ...rest } = props;
|
|
9626
|
-
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { ...rest, className: cn2(badgeVariants({ variant, size }), className) });
|
|
9627
|
-
}
|
|
9628
|
-
var import_class_variance_authority2, import_jsx_runtime37, badgeVariants;
|
|
9629
|
-
var init_badge = __esm({
|
|
9630
|
-
"src/internal/components/ui/badge.tsx"() {
|
|
9631
|
-
import_class_variance_authority2 = require("class-variance-authority");
|
|
9632
|
-
init_cn();
|
|
9633
9719
|
import_jsx_runtime37 = require("react/jsx-runtime");
|
|
9634
|
-
badgeVariants = (0, import_class_variance_authority2.cva)(
|
|
9635
|
-
cn2(
|
|
9636
|
-
//
|
|
9637
|
-
"inline-flex items-center",
|
|
9638
|
-
"border font-semibold",
|
|
9639
|
-
"select-none"
|
|
9640
|
-
),
|
|
9641
|
-
{
|
|
9642
|
-
variants: {
|
|
9643
|
-
variant: {
|
|
9644
|
-
outline: "border-[var(--ui-kit-bd)] bg-transparent text-[var(--ui-kit-fg)]",
|
|
9645
|
-
secondary: "border-[var(--ui-kit-secondary)] bg-[var(--ui-kit-secondary)] text-[var(--ui-kit-fg)]",
|
|
9646
|
-
destructive: "border-[var(--ui-kit-bg-error)] bg-[var(--ui-kit-bg-error)] text-[var(--ui-kit-error)]",
|
|
9647
|
-
success: "border-[var(--ui-kit-bg-success)] bg-[var(--ui-kit-bg-success)] text-[var(--ui-kit-success)]",
|
|
9648
|
-
warning: "border-[var(--ui-kit-bg-warning)] bg-[var(--ui-kit-bg-warning)] text-[var(--ui-kit-warning)]"
|
|
9649
|
-
},
|
|
9650
|
-
size: {
|
|
9651
|
-
default: "h-5 px-2 rounded-full text-[10px] gap-[var(--ui-kit-gap)]",
|
|
9652
|
-
medium: "h-8 px-[var(--ui-kit-pd)] rounded-[var(--ui-kit-el-bdrs)] text-sm gap-[var(--ui-kit-gap)]",
|
|
9653
|
-
large: cn2(
|
|
9654
|
-
"whitespace-nowrap text-sm font-semibold font-sans",
|
|
9655
|
-
"h-12 px-[var(--ui-kit-pd)] rounded-[var(--ui-kit-el-bdrs)]"
|
|
9656
|
-
)
|
|
9657
|
-
}
|
|
9658
|
-
},
|
|
9659
|
-
defaultVariants: {
|
|
9660
|
-
variant: "secondary"
|
|
9661
|
-
}
|
|
9662
|
-
}
|
|
9663
|
-
);
|
|
9664
9720
|
}
|
|
9665
9721
|
});
|
|
9666
9722
|
|
|
9667
9723
|
// src/internal/components/BuyMenu/binance/statuses.ts
|
|
9668
|
-
var
|
|
9724
|
+
var import_lodash_es7, STATUS_CODE_TO_MESSAGE, STATUSES_FILTERS;
|
|
9669
9725
|
var init_statuses = __esm({
|
|
9670
9726
|
"src/internal/components/BuyMenu/binance/statuses.ts"() {
|
|
9671
|
-
|
|
9727
|
+
import_lodash_es7 = require("lodash-es");
|
|
9672
9728
|
STATUS_CODE_TO_MESSAGE = {
|
|
9673
9729
|
"0": {
|
|
9674
9730
|
code: "0",
|
|
@@ -9773,7 +9829,7 @@ var init_statuses = __esm({
|
|
|
9773
9829
|
remarks: "On-ramp"
|
|
9774
9830
|
}
|
|
9775
9831
|
};
|
|
9776
|
-
STATUSES_FILTERS = (0,
|
|
9832
|
+
STATUSES_FILTERS = (0, import_lodash_es7.values)(STATUS_CODE_TO_MESSAGE).filter(
|
|
9777
9833
|
(status) => status.remarks.toLowerCase().includes("on-ramp")
|
|
9778
9834
|
);
|
|
9779
9835
|
}
|
|
@@ -9909,17 +9965,17 @@ function BinanceTxHistory() {
|
|
|
9909
9965
|
txStatuses: SHOW_STATUSES
|
|
9910
9966
|
})
|
|
9911
9967
|
});
|
|
9912
|
-
const txList = (0,
|
|
9968
|
+
const txList = (0, import_react24.useMemo)(
|
|
9913
9969
|
() => historyData?.pages?.map((p) => p.data).flat(Infinity) || [],
|
|
9914
9970
|
[historyData]
|
|
9915
9971
|
);
|
|
9916
|
-
const updateExpandable = (0,
|
|
9917
|
-
(0,
|
|
9972
|
+
const updateExpandable = (0, import_react24.useCallback)(
|
|
9973
|
+
(0, import_lodash_es8.debounce)(() => {
|
|
9918
9974
|
useBuyMenuStore.getState().setRenderKey(`binance-history-loaded-${Date.now()}`);
|
|
9919
9975
|
}, 200),
|
|
9920
9976
|
[]
|
|
9921
9977
|
);
|
|
9922
|
-
(0,
|
|
9978
|
+
(0, import_react24.useEffect)(() => {
|
|
9923
9979
|
if (isTxDataLoading || !txList?.length || txList.length > 10) return;
|
|
9924
9980
|
updateExpandable();
|
|
9925
9981
|
}, [isTxDataLoading, txList]);
|
|
@@ -9944,7 +10000,7 @@ function BinanceTxHistory() {
|
|
|
9944
10000
|
)
|
|
9945
10001
|
] });
|
|
9946
10002
|
}
|
|
9947
|
-
var import_react_query8, import_dayjs,
|
|
10003
|
+
var import_react_query8, import_dayjs, import_lodash_es8, import_lucide_react13, import_react24, import_jsx_runtime38, TRANSACTIONS_PAGESIZE, SHOW_STATUSES;
|
|
9948
10004
|
var init_BinanceTxHistory = __esm({
|
|
9949
10005
|
"src/internal/components/BuyMenu/binance/BinanceTxHistory.tsx"() {
|
|
9950
10006
|
init_tokens();
|
|
@@ -9953,9 +10009,9 @@ var init_BinanceTxHistory = __esm({
|
|
|
9953
10009
|
init_i18n();
|
|
9954
10010
|
import_react_query8 = require("@tanstack/react-query");
|
|
9955
10011
|
import_dayjs = __toESM(require("dayjs"), 1);
|
|
9956
|
-
|
|
10012
|
+
import_lodash_es8 = require("lodash-es");
|
|
9957
10013
|
import_lucide_react13 = require("lucide-react");
|
|
9958
|
-
|
|
10014
|
+
import_react24 = require("react");
|
|
9959
10015
|
init_priceFormatter();
|
|
9960
10016
|
init_badge();
|
|
9961
10017
|
init_button();
|
|
@@ -9973,8 +10029,8 @@ var init_BinanceTxHistory = __esm({
|
|
|
9973
10029
|
// src/internal/components/BuyMenu/binance/useBinanceSseTracing.ts
|
|
9974
10030
|
function useBinanceSseTxTracing(walletAddress) {
|
|
9975
10031
|
const qc = (0, import_react_query9.useQueryClient)();
|
|
9976
|
-
const debounceRef = (0,
|
|
9977
|
-
(0,
|
|
10032
|
+
const debounceRef = (0, import_react25.useRef)(null);
|
|
10033
|
+
(0, import_react25.useEffect)(() => {
|
|
9978
10034
|
if (!walletAddress) return;
|
|
9979
10035
|
const iframeManager = getIframeManager();
|
|
9980
10036
|
if (!iframeManager) return;
|
|
@@ -9996,11 +10052,11 @@ function useBinanceSseTxTracing(walletAddress) {
|
|
|
9996
10052
|
};
|
|
9997
10053
|
}, [walletAddress, qc]);
|
|
9998
10054
|
}
|
|
9999
|
-
var import_react_query9,
|
|
10055
|
+
var import_react_query9, import_react25;
|
|
10000
10056
|
var init_useBinanceSseTracing = __esm({
|
|
10001
10057
|
"src/internal/components/BuyMenu/binance/useBinanceSseTracing.ts"() {
|
|
10002
10058
|
import_react_query9 = require("@tanstack/react-query");
|
|
10003
|
-
|
|
10059
|
+
import_react25 = require("react");
|
|
10004
10060
|
init_iframe_manager();
|
|
10005
10061
|
init_queryKeys();
|
|
10006
10062
|
init_api();
|
|
@@ -10022,7 +10078,7 @@ function Binance() {
|
|
|
10022
10078
|
const { t } = useT();
|
|
10023
10079
|
const chainConfig = useSession((st) => st.chainConfig);
|
|
10024
10080
|
const walletAddress = useSession((st) => st.address);
|
|
10025
|
-
const chainTicker =
|
|
10081
|
+
const chainTicker = CHAIN_ID_TO_BINANCE_NETWORK_TICKER[chainConfig.id] || null;
|
|
10026
10082
|
const {
|
|
10027
10083
|
error,
|
|
10028
10084
|
srcQueryAmount,
|
|
@@ -10037,7 +10093,7 @@ function Binance() {
|
|
|
10037
10093
|
} = useBuyMenuStore();
|
|
10038
10094
|
const paymentMode = useBinanceStore((st) => st.paymentMode);
|
|
10039
10095
|
const isCurrurenciesSelected = !!selectedCrypto && !!selectedFiat;
|
|
10040
|
-
(0,
|
|
10096
|
+
(0, import_react26.useEffect)(() => {
|
|
10041
10097
|
if (!isCurrurenciesSelected) return;
|
|
10042
10098
|
useBuyMenuStore.getState().setRenderKey(`${selectedCrypto}-${selectedFiat}-${Date.now()}`);
|
|
10043
10099
|
}, [isCurrurenciesSelected]);
|
|
@@ -10055,7 +10111,7 @@ function Binance() {
|
|
|
10055
10111
|
queryFn: async () => await getSupportedNetworksQuery()
|
|
10056
10112
|
});
|
|
10057
10113
|
const networkAvailableCryptoList = networksData?.data?.filter(
|
|
10058
|
-
(ntw) => ntw.networks.map((n) => n.network).includes(
|
|
10114
|
+
(ntw) => ntw.networks.map((n) => n.network).includes(CHAIN_ID_TO_BINANCE_NETWORK_TICKER[chainConfig.id] || "UNSUPPORTED")
|
|
10059
10115
|
) || [];
|
|
10060
10116
|
const { data: paymentModesData = null, isFetching: isPaymentModesLoading } = (0, import_react_query10.useQuery)({
|
|
10061
10117
|
retry: false,
|
|
@@ -10072,7 +10128,7 @@ function Binance() {
|
|
|
10072
10128
|
});
|
|
10073
10129
|
const paymentModes = paymentModesData?.data?.paymentMethods || [];
|
|
10074
10130
|
const selectedPaymentMode = paymentModes?.find((el) => getPayMethodID(el) === paymentMode) || null;
|
|
10075
|
-
(0,
|
|
10131
|
+
(0, import_react26.useEffect)(() => {
|
|
10076
10132
|
useBuyMenuStore.getState().setMinAmount(Number(selectedPaymentMode?.fiatMinLimit || "0"));
|
|
10077
10133
|
}, [selectedPaymentMode]);
|
|
10078
10134
|
const { mutate: estimateQuote, isPending: isQuoteEstimating } = (0, import_react_query10.useMutation)({
|
|
@@ -10100,21 +10156,22 @@ function Binance() {
|
|
|
10100
10156
|
}
|
|
10101
10157
|
});
|
|
10102
10158
|
const availableFiats = (tradingPairsData?.data?.fiatCurrencies || []).map((ticker) => ({ ticker }));
|
|
10103
|
-
(0,
|
|
10159
|
+
(0, import_react26.useEffect)(() => {
|
|
10104
10160
|
if (!!selectedFiat || !availableFiats?.length) return;
|
|
10105
|
-
const targetFiat = availableFiats.find((item) =>
|
|
10161
|
+
const targetFiat = availableFiats.find((item) => PREFERRED_FIATS.includes(item.ticker)) || availableFiats[0];
|
|
10106
10162
|
useBuyMenuStore.getState().setSelectedFiat(targetFiat.ticker);
|
|
10107
10163
|
}, [availableFiats, selectedFiat]);
|
|
10108
|
-
(0,
|
|
10164
|
+
(0, import_react26.useEffect)(() => {
|
|
10109
10165
|
if (!!selectedCrypto || !networkAvailableCryptoList?.length) return;
|
|
10110
|
-
|
|
10166
|
+
const targetCrypto = networkAvailableCryptoList.find((item) => PREFERRED_CRYPTOS.includes(item.cryptoCurrency)) || networkAvailableCryptoList[0];
|
|
10167
|
+
useBuyMenuStore.getState().setSelectedCrypto(targetCrypto.cryptoCurrency);
|
|
10111
10168
|
}, [networkAvailableCryptoList, selectedCrypto]);
|
|
10112
|
-
(0,
|
|
10169
|
+
(0, import_react26.useEffect)(() => {
|
|
10113
10170
|
if (!!paymentMode || !paymentModes.length) return;
|
|
10114
10171
|
const targetPaymentMode = paymentModes.find((item) => item.payMethodCode === PREFERRED_PAYMENT_METHOD) || paymentModes[0];
|
|
10115
10172
|
useBinanceStore.getState().setPaymentMode(getPayMethodID(targetPaymentMode));
|
|
10116
10173
|
}, [paymentModes]);
|
|
10117
|
-
(0,
|
|
10174
|
+
(0, import_react26.useEffect)(() => {
|
|
10118
10175
|
return () => {
|
|
10119
10176
|
useBinanceStore.getState().setPaymentMode(null);
|
|
10120
10177
|
qc.resetQueries({ queryKey: [QUERY_KEYS2.binanceTradingPairs] });
|
|
@@ -10236,7 +10293,7 @@ function Binance() {
|
|
|
10236
10293
|
)
|
|
10237
10294
|
] });
|
|
10238
10295
|
}
|
|
10239
|
-
var import_react_query10, import_lucide_react14,
|
|
10296
|
+
var import_react_query10, import_lucide_react14, import_react26, import_jsx_runtime39, PREFERRED_PAYMENT_METHOD, PREFERRED_FIATS, PREFERRED_CRYPTOS;
|
|
10240
10297
|
var init_Binance = __esm({
|
|
10241
10298
|
"src/internal/components/BuyMenu/binance/Binance.tsx"() {
|
|
10242
10299
|
init_utils2();
|
|
@@ -10244,7 +10301,7 @@ var init_Binance = __esm({
|
|
|
10244
10301
|
init_i18n();
|
|
10245
10302
|
import_react_query10 = require("@tanstack/react-query");
|
|
10246
10303
|
import_lucide_react14 = require("lucide-react");
|
|
10247
|
-
|
|
10304
|
+
import_react26 = require("react");
|
|
10248
10305
|
init_button();
|
|
10249
10306
|
init_highlight();
|
|
10250
10307
|
init_input();
|
|
@@ -10261,6 +10318,8 @@ var init_Binance = __esm({
|
|
|
10261
10318
|
init_utils6();
|
|
10262
10319
|
import_jsx_runtime39 = require("react/jsx-runtime");
|
|
10263
10320
|
PREFERRED_PAYMENT_METHOD = "BUY_CARD";
|
|
10321
|
+
PREFERRED_FIATS = ["USD", "EUR"];
|
|
10322
|
+
PREFERRED_CRYPTOS = ["USDT", "LUMIA"];
|
|
10264
10323
|
}
|
|
10265
10324
|
});
|
|
10266
10325
|
|
|
@@ -10516,7 +10575,7 @@ function FinchPayTxHistoryItem(props) {
|
|
|
10516
10575
|
function FinchPayTxHistory() {
|
|
10517
10576
|
const { t } = useT();
|
|
10518
10577
|
const walletAddress = useSession((st) => st.address);
|
|
10519
|
-
const [cursor, setCursor] = (0,
|
|
10578
|
+
const [cursor, setCursor] = (0, import_react27.useState)(1);
|
|
10520
10579
|
const {
|
|
10521
10580
|
data: txData,
|
|
10522
10581
|
isLoading: isTxDataLoading,
|
|
@@ -10538,7 +10597,7 @@ function FinchPayTxHistory() {
|
|
|
10538
10597
|
const pageCount = loadedPages[loadedPages.length - 1]?.pageCount || 1;
|
|
10539
10598
|
const txList = loadedPages.map((p) => p.data)[cursor - 1] || [];
|
|
10540
10599
|
console.log("[FINCHPAY] txList", txData);
|
|
10541
|
-
const handleNextPage = (0,
|
|
10600
|
+
const handleNextPage = (0, import_react27.useCallback)(
|
|
10542
10601
|
async (curCursor, curPageParams) => {
|
|
10543
10602
|
const maxLoadedPage = Math.max(...curPageParams);
|
|
10544
10603
|
if (curCursor !== maxLoadedPage) {
|
|
@@ -10593,7 +10652,7 @@ function FinchPayTxHistory() {
|
|
|
10593
10652
|
] })
|
|
10594
10653
|
] });
|
|
10595
10654
|
}
|
|
10596
|
-
var import_react_query12, import_dayjs2, import_lucide_react16,
|
|
10655
|
+
var import_react_query12, import_dayjs2, import_lucide_react16, import_react27, import_jsx_runtime41, TRANSACTIONS_PAGESIZE2;
|
|
10597
10656
|
var init_FinchPayTxHistory = __esm({
|
|
10598
10657
|
"src/internal/components/BuyMenu/finchpay/FinchPayTxHistory.tsx"() {
|
|
10599
10658
|
init_utils2();
|
|
@@ -10602,7 +10661,7 @@ var init_FinchPayTxHistory = __esm({
|
|
|
10602
10661
|
import_react_query12 = require("@tanstack/react-query");
|
|
10603
10662
|
import_dayjs2 = __toESM(require("dayjs"), 1);
|
|
10604
10663
|
import_lucide_react16 = require("lucide-react");
|
|
10605
|
-
|
|
10664
|
+
import_react27 = require("react");
|
|
10606
10665
|
init_priceFormatter();
|
|
10607
10666
|
init_badge();
|
|
10608
10667
|
init_button();
|
|
@@ -10615,15 +10674,13 @@ var init_FinchPayTxHistory = __esm({
|
|
|
10615
10674
|
});
|
|
10616
10675
|
|
|
10617
10676
|
// src/internal/components/BuyMenu/finchpay/networks.ts
|
|
10618
|
-
var import_read10,
|
|
10677
|
+
var import_read10, CHAIN_ID_TO_FINCHPAY_NETWORK_TICKER;
|
|
10619
10678
|
var init_networks = __esm({
|
|
10620
10679
|
"src/internal/components/BuyMenu/finchpay/networks.ts"() {
|
|
10621
10680
|
import_read10 = require("@embarkai/core/read");
|
|
10622
|
-
|
|
10681
|
+
CHAIN_ID_TO_FINCHPAY_NETWORK_TICKER = {
|
|
10623
10682
|
[import_read10.LUMIA_MAINNET_CHAIN_ID]: "LUM20",
|
|
10624
|
-
[import_read10.
|
|
10625
|
-
[import_read10.BSC_TESTNET_CHAIN_ID]: "BSC"
|
|
10626
|
-
// TODO: change to BSC mainnet when supported by EmbarkAI
|
|
10683
|
+
[import_read10.BSC_MAINNET_CHAIN_ID]: "BSC"
|
|
10627
10684
|
};
|
|
10628
10685
|
}
|
|
10629
10686
|
});
|
|
@@ -10631,8 +10688,8 @@ var init_networks = __esm({
|
|
|
10631
10688
|
// src/internal/components/BuyMenu/finchpay/useFinchpaySseTxTracing.ts
|
|
10632
10689
|
function useFinchpaySseTxTracing(walletAddress) {
|
|
10633
10690
|
const qc = (0, import_react_query13.useQueryClient)();
|
|
10634
|
-
const debounceRef = (0,
|
|
10635
|
-
(0,
|
|
10691
|
+
const debounceRef = (0, import_react28.useRef)(null);
|
|
10692
|
+
(0, import_react28.useEffect)(() => {
|
|
10636
10693
|
if (!walletAddress) return;
|
|
10637
10694
|
const iframeManager = getIframeManager();
|
|
10638
10695
|
if (!iframeManager) return;
|
|
@@ -10654,11 +10711,11 @@ function useFinchpaySseTxTracing(walletAddress) {
|
|
|
10654
10711
|
};
|
|
10655
10712
|
}, [walletAddress, qc]);
|
|
10656
10713
|
}
|
|
10657
|
-
var import_react_query13,
|
|
10714
|
+
var import_react_query13, import_react28;
|
|
10658
10715
|
var init_useFinchpaySseTxTracing = __esm({
|
|
10659
10716
|
"src/internal/components/BuyMenu/finchpay/useFinchpaySseTxTracing.ts"() {
|
|
10660
10717
|
import_react_query13 = require("@tanstack/react-query");
|
|
10661
|
-
|
|
10718
|
+
import_react28 = require("react");
|
|
10662
10719
|
init_iframe_manager();
|
|
10663
10720
|
init_queryKeys();
|
|
10664
10721
|
init_api2();
|
|
@@ -10719,7 +10776,7 @@ function FinchPay() {
|
|
|
10719
10776
|
const currentNetworkCoins = [];
|
|
10720
10777
|
data.forEach((currency) => {
|
|
10721
10778
|
networks.push(currency.network);
|
|
10722
|
-
const isCurrentNetworkCoin = currency.network?.toUpperCase() ===
|
|
10779
|
+
const isCurrentNetworkCoin = currency.network?.toUpperCase() === CHAIN_ID_TO_FINCHPAY_NETWORK_TICKER[chainConfig.id]?.toUpperCase();
|
|
10723
10780
|
if (currency.is_fiat) {
|
|
10724
10781
|
fiats.push(currency);
|
|
10725
10782
|
} else {
|
|
@@ -10756,11 +10813,11 @@ function FinchPay() {
|
|
|
10756
10813
|
})
|
|
10757
10814
|
});
|
|
10758
10815
|
const minimum = Number(limitsData?.min_amount || "0");
|
|
10759
|
-
(0,
|
|
10816
|
+
(0, import_react29.useEffect)(() => {
|
|
10760
10817
|
if (minimum <= 0) return;
|
|
10761
10818
|
useBuyMenuStore.getState().setMinAmount(minimum);
|
|
10762
10819
|
}, [minimum]);
|
|
10763
|
-
(0,
|
|
10820
|
+
(0, import_react29.useEffect)(() => {
|
|
10764
10821
|
if (srcInputAmount >= minimum) return;
|
|
10765
10822
|
useBuyMenuStore.getState().setRenderKey(`finchpay-input-minimum-warning-${Date.now()}`);
|
|
10766
10823
|
}, [minimum, srcInputAmount]);
|
|
@@ -10788,23 +10845,23 @@ function FinchPay() {
|
|
|
10788
10845
|
// defaults to CARD estimation, widgetUrl
|
|
10789
10846
|
})
|
|
10790
10847
|
});
|
|
10791
|
-
(0,
|
|
10848
|
+
(0, import_react29.useEffect)(() => {
|
|
10792
10849
|
const { error: errorTitle, message: errorMessage } = handleErrors([currenciesError, limitsError, estimateError]);
|
|
10793
10850
|
if (!errorTitle && !errorMessage) return;
|
|
10794
10851
|
console.error(`[BuyModal][Binance] ${errorTitle}: ${errorMessage}`);
|
|
10795
10852
|
useBuyMenuStore.getState().setError(errorMessage);
|
|
10796
10853
|
}, [currenciesError, limitsError, estimateError]);
|
|
10797
|
-
(0,
|
|
10854
|
+
(0, import_react29.useEffect)(() => {
|
|
10798
10855
|
if (!!selectedFiat || currenciesData.fiats.length === 0) return;
|
|
10799
10856
|
const fallbackFiat = currenciesData.fiats[0];
|
|
10800
10857
|
const targetFiat = currenciesData.fiats.find((f) => f.ticker.toUpperCase() === "USD") || fallbackFiat;
|
|
10801
10858
|
useBuyMenuStore.getState().setSelectedFiat(targetFiat.ticker);
|
|
10802
10859
|
}, [currenciesData, selectedFiat]);
|
|
10803
|
-
(0,
|
|
10860
|
+
(0, import_react29.useEffect)(() => {
|
|
10804
10861
|
if (!!selectedCrypto || currenciesData.currentNetworkCoins.length === 0) return;
|
|
10805
10862
|
useBuyMenuStore.getState().setSelectedCrypto(currenciesData.currentNetworkCoins[0].ticker);
|
|
10806
10863
|
}, [currenciesData, selectedCrypto]);
|
|
10807
|
-
(0,
|
|
10864
|
+
(0, import_react29.useEffect)(() => {
|
|
10808
10865
|
return () => {
|
|
10809
10866
|
qc.resetQueries({ queryKey: [QUERY_KEYS2.finchPayCurrencies] });
|
|
10810
10867
|
qc.resetQueries({ queryKey: [QUERY_KEYS2.finchPayLimits] });
|
|
@@ -10926,7 +10983,7 @@ function FinchPay() {
|
|
|
10926
10983
|
)
|
|
10927
10984
|
] });
|
|
10928
10985
|
}
|
|
10929
|
-
var import_react_query14, import_lucide_react17,
|
|
10986
|
+
var import_react_query14, import_lucide_react17, import_react29, import_jsx_runtime42;
|
|
10930
10987
|
var init_FinchPay = __esm({
|
|
10931
10988
|
"src/internal/components/BuyMenu/finchpay/FinchPay.tsx"() {
|
|
10932
10989
|
init_priceFormatter();
|
|
@@ -10935,7 +10992,7 @@ var init_FinchPay = __esm({
|
|
|
10935
10992
|
init_i18n();
|
|
10936
10993
|
import_react_query14 = require("@tanstack/react-query");
|
|
10937
10994
|
import_lucide_react17 = require("lucide-react");
|
|
10938
|
-
|
|
10995
|
+
import_react29 = require("react");
|
|
10939
10996
|
init_button();
|
|
10940
10997
|
init_highlight();
|
|
10941
10998
|
init_input();
|
|
@@ -11063,74 +11120,56 @@ var init_ProviderSelector = __esm({
|
|
|
11063
11120
|
}
|
|
11064
11121
|
});
|
|
11065
11122
|
|
|
11066
|
-
// src/internal/utils/debounce.ts
|
|
11067
|
-
function debounce5(func, waitFor) {
|
|
11068
|
-
let timeout;
|
|
11069
|
-
return (...args) => {
|
|
11070
|
-
if (timeout) clearTimeout(timeout);
|
|
11071
|
-
timeout = setTimeout(() => func(...args), waitFor);
|
|
11072
|
-
};
|
|
11073
|
-
}
|
|
11074
|
-
var init_debounce = __esm({
|
|
11075
|
-
"src/internal/utils/debounce.ts"() {
|
|
11076
|
-
}
|
|
11077
|
-
});
|
|
11078
|
-
|
|
11079
11123
|
// src/internal/components/BuyMenu/useHandleInputAmount.ts
|
|
11080
|
-
var
|
|
11124
|
+
var import_react30, ON_INPUT_QUERY_DELAY, useHandleInputAmount;
|
|
11081
11125
|
var init_useHandleInputAmount = __esm({
|
|
11082
11126
|
"src/internal/components/BuyMenu/useHandleInputAmount.ts"() {
|
|
11083
|
-
|
|
11084
|
-
init_debounce();
|
|
11127
|
+
import_react30 = require("react");
|
|
11085
11128
|
init_contants();
|
|
11086
11129
|
init_useBuyMenuStore();
|
|
11087
11130
|
ON_INPUT_QUERY_DELAY = 1500;
|
|
11088
11131
|
useHandleInputAmount = () => {
|
|
11089
|
-
const lastRampProviderRef = (0,
|
|
11132
|
+
const lastRampProviderRef = (0, import_react30.useRef)(DEFAULT_PROVIDER2);
|
|
11090
11133
|
const rampProvider = useBuyMenuStore((st) => st.rampProvider);
|
|
11091
11134
|
const srcInputAmount = useBuyMenuStore((st) => st.srcInputAmount);
|
|
11092
11135
|
const minAmount = useBuyMenuStore((st) => st.minAmount);
|
|
11093
|
-
const
|
|
11094
|
-
|
|
11095
|
-
|
|
11136
|
+
const queryAmountTimer = (0, import_react30.useRef)(null);
|
|
11137
|
+
(0, import_react30.useEffect)(() => {
|
|
11138
|
+
if (queryAmountTimer.current) clearTimeout(queryAmountTimer.current);
|
|
11139
|
+
queryAmountTimer.current = setTimeout(() => {
|
|
11140
|
+
const checkedValue = Math.ceil(Math.max(Number(srcInputAmount), Number(minAmount)));
|
|
11096
11141
|
useBuyMenuStore.getState().setSrcInputAmount(checkedValue);
|
|
11097
11142
|
useBuyMenuStore.getState().setSrcQueryAmount(checkedValue);
|
|
11098
|
-
}, ON_INPUT_QUERY_DELAY)
|
|
11099
|
-
|
|
11100
|
-
)
|
|
11101
|
-
(0, import_react29.useEffect)(() => setQueryAmountDebounced(srcInputAmount), [srcInputAmount, setQueryAmountDebounced]);
|
|
11102
|
-
(0, import_react29.useEffect)(() => {
|
|
11143
|
+
}, ON_INPUT_QUERY_DELAY);
|
|
11144
|
+
}, [minAmount, srcInputAmount]);
|
|
11145
|
+
(0, import_react30.useEffect)(() => {
|
|
11103
11146
|
if (lastRampProviderRef.current === rampProvider) return;
|
|
11104
11147
|
const {
|
|
11105
11148
|
setIsProviderSummary,
|
|
11106
11149
|
setIsCryptoSelector,
|
|
11107
11150
|
setIsFiatSelector,
|
|
11108
|
-
setIsPaymentModeSelector
|
|
11109
|
-
setSelectedCrypto,
|
|
11110
|
-
setSelectedFiat
|
|
11111
|
-
setSrcInputAmount,
|
|
11112
|
-
setSrcQueryAmount
|
|
11151
|
+
setIsPaymentModeSelector
|
|
11152
|
+
// setSelectedCrypto,
|
|
11153
|
+
// setSelectedFiat
|
|
11154
|
+
// setSrcInputAmount,
|
|
11155
|
+
// setSrcQueryAmount
|
|
11113
11156
|
} = useBuyMenuStore.getState();
|
|
11114
11157
|
setIsProviderSummary(false);
|
|
11115
11158
|
setIsCryptoSelector(false);
|
|
11116
11159
|
setIsFiatSelector(false);
|
|
11117
11160
|
setIsPaymentModeSelector(false);
|
|
11118
|
-
setSelectedCrypto(null);
|
|
11119
|
-
setSelectedFiat(null);
|
|
11120
|
-
setSrcInputAmount(0);
|
|
11121
|
-
setSrcQueryAmount(0);
|
|
11122
11161
|
lastRampProviderRef.current = rampProvider;
|
|
11123
11162
|
}, [rampProvider]);
|
|
11124
11163
|
};
|
|
11125
11164
|
}
|
|
11126
11165
|
});
|
|
11127
11166
|
|
|
11128
|
-
// src/internal/components/BuyMenu/
|
|
11167
|
+
// src/internal/components/BuyMenu/BuyMenu.tsx
|
|
11129
11168
|
function BuyMenu() {
|
|
11130
11169
|
const { t } = useT();
|
|
11131
11170
|
const walletAddress = useSession((st) => st.address);
|
|
11132
|
-
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
11133
11171
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
11172
|
+
useBuyMenuParams();
|
|
11134
11173
|
useHandleInputAmount();
|
|
11135
11174
|
const renderKey = useBuyMenuStore((st) => st.renderKey);
|
|
11136
11175
|
const rampProvider = useBuyMenuStore((st) => st.rampProvider);
|
|
@@ -11196,7 +11235,7 @@ function BuyMenu() {
|
|
|
11196
11235
|
setIsPaymentModeSelector(false);
|
|
11197
11236
|
return;
|
|
11198
11237
|
}
|
|
11199
|
-
setPage("main-menu" /* MAIN_MENU */);
|
|
11238
|
+
useLayoutDataStore.getState().setPage("main-menu" /* MAIN_MENU */);
|
|
11200
11239
|
},
|
|
11201
11240
|
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react18.ArrowLeft, { className: "h-4 w-4" })
|
|
11202
11241
|
}
|
|
@@ -11243,8 +11282,8 @@ function BuyMenu() {
|
|
|
11243
11282
|
);
|
|
11244
11283
|
}
|
|
11245
11284
|
var import_lucide_react18, import_jsx_runtime44;
|
|
11246
|
-
var
|
|
11247
|
-
"src/internal/components/BuyMenu/
|
|
11285
|
+
var init_BuyMenu = __esm({
|
|
11286
|
+
"src/internal/components/BuyMenu/BuyMenu.tsx"() {
|
|
11248
11287
|
init_utils2();
|
|
11249
11288
|
init_SessionContext();
|
|
11250
11289
|
init_i18n();
|
|
@@ -11263,10 +11302,40 @@ var init_ByuMenu = __esm({
|
|
|
11263
11302
|
}
|
|
11264
11303
|
});
|
|
11265
11304
|
|
|
11305
|
+
// src/internal/components/BuyMenu/external.usage.ts
|
|
11306
|
+
async function getInProgressOnrampTransactionsList(params) {
|
|
11307
|
+
const { walletAddress, chainId } = params;
|
|
11308
|
+
const [binanceResponse, finchpayResponse] = await Promise.all([
|
|
11309
|
+
getTransactionList({ walletAddress, txStatuses: ["1"], page: 1, pageSize: 5 }),
|
|
11310
|
+
// status 1 = ON_RAMP_PROCESSING
|
|
11311
|
+
getTransactionList2({ walletAddress, txStatuses: ["PROCESSING"], page: 1, pageSize: 5 })
|
|
11312
|
+
]);
|
|
11313
|
+
const binanceProgressTXs = binanceResponse.data.filter(
|
|
11314
|
+
(tx) => tx.embarkChainId === CHAIN_ID_TO_BINANCE_NETWORK_TICKER[chainId]
|
|
11315
|
+
);
|
|
11316
|
+
const finchpayProgressTXs = finchpayResponse.data.filter(
|
|
11317
|
+
(tx) => tx.embarkChainId === CHAIN_ID_TO_FINCHPAY_NETWORK_TICKER[chainId]
|
|
11318
|
+
);
|
|
11319
|
+
return {
|
|
11320
|
+
hasInProgressTXs: !!binanceProgressTXs.length || !!finchpayProgressTXs.length,
|
|
11321
|
+
// HINT: update on provider added
|
|
11322
|
+
inProgressTXs: [...binanceProgressTXs, ...finchpayProgressTXs]
|
|
11323
|
+
};
|
|
11324
|
+
}
|
|
11325
|
+
var init_external_usage = __esm({
|
|
11326
|
+
"src/internal/components/BuyMenu/external.usage.ts"() {
|
|
11327
|
+
init_api();
|
|
11328
|
+
init_config();
|
|
11329
|
+
init_api2();
|
|
11330
|
+
init_networks();
|
|
11331
|
+
}
|
|
11332
|
+
});
|
|
11333
|
+
|
|
11266
11334
|
// src/internal/components/BuyMenu/index.ts
|
|
11267
|
-
var
|
|
11335
|
+
var init_BuyMenu2 = __esm({
|
|
11268
11336
|
"src/internal/components/BuyMenu/index.ts"() {
|
|
11269
|
-
|
|
11337
|
+
init_BuyMenu();
|
|
11338
|
+
init_external_usage();
|
|
11270
11339
|
}
|
|
11271
11340
|
});
|
|
11272
11341
|
|
|
@@ -11456,8 +11525,8 @@ function ChainItem(props) {
|
|
|
11456
11525
|
const { t } = useT();
|
|
11457
11526
|
const isSessionLoading = useSession((st) => st.isLoading);
|
|
11458
11527
|
const activeChainId = useSession((st) => st.activeChainId);
|
|
11459
|
-
const [copiedChainId, setCopiedChainId] = (0,
|
|
11460
|
-
const copiedResetTimerRef = (0,
|
|
11528
|
+
const [copiedChainId, setCopiedChainId] = (0, import_react31.useState)(null);
|
|
11529
|
+
const copiedResetTimerRef = (0, import_react31.useRef)(null);
|
|
11461
11530
|
const isActiveChain = activeChainId === chainId;
|
|
11462
11531
|
const paymasterAddress = isActiveChain ? activePaymasterData?.address : null;
|
|
11463
11532
|
const paymasterExplorerUrl = paymasterAddress ? getPaymasterExplorerUrl(chainId, paymasterAddress) : null;
|
|
@@ -11554,7 +11623,7 @@ function ChainItem(props) {
|
|
|
11554
11623
|
}
|
|
11555
11624
|
);
|
|
11556
11625
|
}
|
|
11557
|
-
var import_read13, import_lucide_react19,
|
|
11626
|
+
var import_read13, import_lucide_react19, import_react31, import_jsx_runtime51;
|
|
11558
11627
|
var init_ChainItem = __esm({
|
|
11559
11628
|
"src/internal/components/ChainsMenu/ChainItem.tsx"() {
|
|
11560
11629
|
init_SessionContext();
|
|
@@ -11564,7 +11633,7 @@ var init_ChainItem = __esm({
|
|
|
11564
11633
|
init_truncateMiddle();
|
|
11565
11634
|
import_read13 = require("@embarkai/core/read");
|
|
11566
11635
|
import_lucide_react19 = require("lucide-react");
|
|
11567
|
-
|
|
11636
|
+
import_react31 = require("react");
|
|
11568
11637
|
init_badge();
|
|
11569
11638
|
init_button();
|
|
11570
11639
|
import_jsx_runtime51 = require("react/jsx-runtime");
|
|
@@ -11575,11 +11644,11 @@ var init_ChainItem = __esm({
|
|
|
11575
11644
|
function ChainsMenu() {
|
|
11576
11645
|
const config = useProviderConfig().config;
|
|
11577
11646
|
const activeChainId = useSession((st) => st.activeChainId);
|
|
11578
|
-
const [isTestnets, setIsTestnets] = (0,
|
|
11579
|
-
const [nextChainId, setNextChainId] = (0,
|
|
11647
|
+
const [isTestnets, setIsTestnets] = (0, import_react32.useState)(false);
|
|
11648
|
+
const [nextChainId, setNextChainId] = (0, import_react32.useState)(null);
|
|
11580
11649
|
const { t } = useT();
|
|
11581
11650
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
11582
|
-
const visibleNetworks = (0,
|
|
11651
|
+
const visibleNetworks = (0, import_react32.useMemo)(() => {
|
|
11583
11652
|
return NETWORK_OPTIONS.filter(
|
|
11584
11653
|
(option) => option.isActive && (isTestnets ? true : import_read14.SUPPORTED_MAINNETS.includes(option.chainId))
|
|
11585
11654
|
);
|
|
@@ -11653,7 +11722,7 @@ function ChainsMenu() {
|
|
|
11653
11722
|
}
|
|
11654
11723
|
);
|
|
11655
11724
|
}
|
|
11656
|
-
var import_core2, import_read14, import_react_query15, import_lucide_react20,
|
|
11725
|
+
var import_core2, import_read14, import_react_query15, import_lucide_react20, import_react32, import_jsx_runtime52;
|
|
11657
11726
|
var init_ChainsMenu = __esm({
|
|
11658
11727
|
"src/internal/components/ChainsMenu/ChainsMenu.tsx"() {
|
|
11659
11728
|
init_networks3();
|
|
@@ -11664,7 +11733,7 @@ var init_ChainsMenu = __esm({
|
|
|
11664
11733
|
import_read14 = require("@embarkai/core/read");
|
|
11665
11734
|
import_react_query15 = require("@tanstack/react-query");
|
|
11666
11735
|
import_lucide_react20 = require("lucide-react");
|
|
11667
|
-
|
|
11736
|
+
import_react32 = require("react");
|
|
11668
11737
|
init_resolve_paymaster();
|
|
11669
11738
|
init_useLayoutDataStore();
|
|
11670
11739
|
init_useLayoutStore();
|
|
@@ -11852,8 +11921,8 @@ function DeviceLinkScreen() {
|
|
|
11852
11921
|
const setPage = useLayoutDataStore((s) => s.setPage);
|
|
11853
11922
|
const maxScrollHeight = useLayoutStore((s) => s.maxScrollHeight);
|
|
11854
11923
|
const { mutate: link, isPending } = useLinkDevice();
|
|
11855
|
-
const [code, setCode] = (0,
|
|
11856
|
-
const [error, setError] = (0,
|
|
11924
|
+
const [code, setCode] = (0, import_react33.useState)("");
|
|
11925
|
+
const [error, setError] = (0, import_react33.useState)(null);
|
|
11857
11926
|
const isValid = code.length === 6 && VALID_CHARS.test(code);
|
|
11858
11927
|
function handleCodeChange(value) {
|
|
11859
11928
|
const upper = value.toUpperCase().slice(0, 6);
|
|
@@ -11912,10 +11981,10 @@ function DeviceLinkScreen() {
|
|
|
11912
11981
|
}
|
|
11913
11982
|
);
|
|
11914
11983
|
}
|
|
11915
|
-
var
|
|
11984
|
+
var import_react33, import_lucide_react22, import_jsx_runtime54, VALID_CHARS;
|
|
11916
11985
|
var init_DeviceLinkScreen = __esm({
|
|
11917
11986
|
"src/internal/components/DevicesMenu/DeviceLinkScreen.tsx"() {
|
|
11918
|
-
|
|
11987
|
+
import_react33 = require("react");
|
|
11919
11988
|
import_lucide_react22 = require("lucide-react");
|
|
11920
11989
|
init_Expandable2();
|
|
11921
11990
|
init_button();
|
|
@@ -12448,19 +12517,19 @@ function DeviceManageScreen() {
|
|
|
12448
12517
|
const userId = session?.mpcUserId || "";
|
|
12449
12518
|
const deviceId = pageParams?.deviceId;
|
|
12450
12519
|
const deviceName = pageParams?.deviceName;
|
|
12451
|
-
const guardianRef = (0,
|
|
12452
|
-
const [screen, setScreen] = (0,
|
|
12453
|
-
const [actionState, setActionState] = (0,
|
|
12454
|
-
const [password, setPassword] = (0,
|
|
12455
|
-
const [statusMessage, setStatusMessage] = (0,
|
|
12456
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
12457
|
-
const [waitingConfirm, setWaitingConfirm] = (0,
|
|
12458
|
-
(0,
|
|
12520
|
+
const guardianRef = (0, import_react34.useRef)(null);
|
|
12521
|
+
const [screen, setScreen] = (0, import_react34.useState)({ step: "connecting" });
|
|
12522
|
+
const [actionState, setActionState] = (0, import_react34.useState)(null);
|
|
12523
|
+
const [password, setPassword] = (0, import_react34.useState)("");
|
|
12524
|
+
const [statusMessage, setStatusMessage] = (0, import_react34.useState)(null);
|
|
12525
|
+
const [errorMessage, setErrorMessage] = (0, import_react34.useState)(null);
|
|
12526
|
+
const [waitingConfirm, setWaitingConfirm] = (0, import_react34.useState)(false);
|
|
12527
|
+
(0, import_react34.useEffect)(() => {
|
|
12459
12528
|
if (!statusMessage) return;
|
|
12460
12529
|
const t = setTimeout(() => setStatusMessage(null), 3e3);
|
|
12461
12530
|
return () => clearTimeout(t);
|
|
12462
12531
|
}, [statusMessage]);
|
|
12463
|
-
(0,
|
|
12532
|
+
(0, import_react34.useEffect)(() => {
|
|
12464
12533
|
if (!deviceId || !isWebSerialAvailable()) {
|
|
12465
12534
|
setScreen({ step: "error", message: "WebSerial not available" });
|
|
12466
12535
|
return;
|
|
@@ -12492,7 +12561,7 @@ function DeviceManageScreen() {
|
|
|
12492
12561
|
guardianRef.current?.close();
|
|
12493
12562
|
};
|
|
12494
12563
|
}, [deviceId]);
|
|
12495
|
-
const refreshList = (0,
|
|
12564
|
+
const refreshList = (0, import_react34.useCallback)(async () => {
|
|
12496
12565
|
const guardian = guardianRef.current;
|
|
12497
12566
|
if (!guardian || screen.step !== "connected") return;
|
|
12498
12567
|
try {
|
|
@@ -12501,7 +12570,7 @@ function DeviceManageScreen() {
|
|
|
12501
12570
|
} catch {
|
|
12502
12571
|
}
|
|
12503
12572
|
}, [screen]);
|
|
12504
|
-
const handleBackup = (0,
|
|
12573
|
+
const handleBackup = (0, import_react34.useCallback)(async () => {
|
|
12505
12574
|
const guardian = guardianRef.current;
|
|
12506
12575
|
const iframe4 = getIframeManager();
|
|
12507
12576
|
if (!guardian || !iframe4 || !userId) return;
|
|
@@ -12525,7 +12594,7 @@ function DeviceManageScreen() {
|
|
|
12525
12594
|
setActionState(null);
|
|
12526
12595
|
}
|
|
12527
12596
|
}, [password, userId, refreshList]);
|
|
12528
|
-
const handleOverwrite = (0,
|
|
12597
|
+
const handleOverwrite = (0, import_react34.useCallback)(async () => {
|
|
12529
12598
|
const guardian = guardianRef.current;
|
|
12530
12599
|
const iframe4 = getIframeManager();
|
|
12531
12600
|
if (!guardian || !iframe4 || !userId) return;
|
|
@@ -12545,7 +12614,7 @@ function DeviceManageScreen() {
|
|
|
12545
12614
|
setActionState(null);
|
|
12546
12615
|
}
|
|
12547
12616
|
}, [password, userId, refreshList]);
|
|
12548
|
-
const handleDelete = (0,
|
|
12617
|
+
const handleDelete = (0, import_react34.useCallback)(async (keyshareId) => {
|
|
12549
12618
|
const guardian = guardianRef.current;
|
|
12550
12619
|
if (!guardian) return;
|
|
12551
12620
|
setActionState({ action: "delete", keyshareId, substep: "confirm-device" });
|
|
@@ -12712,10 +12781,10 @@ function DeviceManageScreen() {
|
|
|
12712
12781
|
}
|
|
12713
12782
|
);
|
|
12714
12783
|
}
|
|
12715
|
-
var
|
|
12784
|
+
var import_react34, import_lucide_react23, import_jsx_runtime55;
|
|
12716
12785
|
var init_DeviceManageScreen = __esm({
|
|
12717
12786
|
"src/internal/components/DevicesMenu/DeviceManageScreen.tsx"() {
|
|
12718
|
-
|
|
12787
|
+
import_react34 = require("react");
|
|
12719
12788
|
import_lucide_react23 = require("lucide-react");
|
|
12720
12789
|
init_Expandable2();
|
|
12721
12790
|
init_button();
|
|
@@ -12738,11 +12807,11 @@ function DeviceRestoreScreen() {
|
|
|
12738
12807
|
const keyshareId = pageParams?.keyshareId;
|
|
12739
12808
|
const deviceId = pageParams?.deviceId;
|
|
12740
12809
|
const deviceName = pageParams?.deviceName;
|
|
12741
|
-
const [password, setPassword] = (0,
|
|
12742
|
-
const [isWorking, setIsWorking] = (0,
|
|
12743
|
-
const [statusMessage, setStatusMessage] = (0,
|
|
12744
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
12745
|
-
const handleRestore = (0,
|
|
12810
|
+
const [password, setPassword] = (0, import_react35.useState)("");
|
|
12811
|
+
const [isWorking, setIsWorking] = (0, import_react35.useState)(false);
|
|
12812
|
+
const [statusMessage, setStatusMessage] = (0, import_react35.useState)(null);
|
|
12813
|
+
const [errorMessage, setErrorMessage] = (0, import_react35.useState)(null);
|
|
12814
|
+
const handleRestore = (0, import_react35.useCallback)(async () => {
|
|
12746
12815
|
if (!password || !keyshareId || !userId) return;
|
|
12747
12816
|
const iframe4 = getIframeManager();
|
|
12748
12817
|
if (!iframe4) {
|
|
@@ -12829,10 +12898,10 @@ function DeviceRestoreScreen() {
|
|
|
12829
12898
|
}
|
|
12830
12899
|
);
|
|
12831
12900
|
}
|
|
12832
|
-
var
|
|
12901
|
+
var import_react35, import_lucide_react24, import_jsx_runtime56;
|
|
12833
12902
|
var init_DeviceRestoreScreen = __esm({
|
|
12834
12903
|
"src/internal/components/DevicesMenu/DeviceRestoreScreen.tsx"() {
|
|
12835
|
-
|
|
12904
|
+
import_react35 = require("react");
|
|
12836
12905
|
import_lucide_react24 = require("lucide-react");
|
|
12837
12906
|
init_Expandable2();
|
|
12838
12907
|
init_button();
|
|
@@ -12855,8 +12924,8 @@ function truncateAddress(address) {
|
|
|
12855
12924
|
return `${address.slice(0, 6)}...${address.slice(-4)}`;
|
|
12856
12925
|
}
|
|
12857
12926
|
function DeviceRow({ device }) {
|
|
12858
|
-
const [confirmingUnlink, setConfirmingUnlink] = (0,
|
|
12859
|
-
const [unlinkError, setUnlinkError] = (0,
|
|
12927
|
+
const [confirmingUnlink, setConfirmingUnlink] = (0, import_react36.useState)(false);
|
|
12928
|
+
const [unlinkError, setUnlinkError] = (0, import_react36.useState)(null);
|
|
12860
12929
|
const { mutate: unlink, isPending } = useUnlinkDevice();
|
|
12861
12930
|
if (confirmingUnlink) {
|
|
12862
12931
|
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "flex flex-col gap-2 p-3 rounded-lg bg-[var(--ui-kit-bg)]", children: [
|
|
@@ -12970,10 +13039,10 @@ function DevicesMenu() {
|
|
|
12970
13039
|
}
|
|
12971
13040
|
);
|
|
12972
13041
|
}
|
|
12973
|
-
var
|
|
13042
|
+
var import_react36, import_lucide_react25, import_jsx_runtime57;
|
|
12974
13043
|
var init_DevicesMenu = __esm({
|
|
12975
13044
|
"src/internal/components/DevicesMenu/DevicesMenu.tsx"() {
|
|
12976
|
-
|
|
13045
|
+
import_react36 = require("react");
|
|
12977
13046
|
import_lucide_react25 = require("lucide-react");
|
|
12978
13047
|
init_Expandable2();
|
|
12979
13048
|
init_button();
|
|
@@ -13066,7 +13135,7 @@ function useOnRestoreSuccess() {
|
|
|
13066
13135
|
setStatus
|
|
13067
13136
|
} = useSession();
|
|
13068
13137
|
const { setError, setSuccess } = useRestoreStore();
|
|
13069
|
-
const createSessionWithKeyshare = (0,
|
|
13138
|
+
const createSessionWithKeyshare = (0, import_react37.useCallback)(
|
|
13070
13139
|
async (userId, hasServerKeyshare, isNewUser) => {
|
|
13071
13140
|
try {
|
|
13072
13141
|
try {
|
|
@@ -13107,7 +13176,7 @@ function useOnRestoreSuccess() {
|
|
|
13107
13176
|
},
|
|
13108
13177
|
[setStatus, usePaymaster, activeChainId, publicClient]
|
|
13109
13178
|
);
|
|
13110
|
-
const onRestoreSuccess = (0,
|
|
13179
|
+
const onRestoreSuccess = (0, import_react37.useCallback)(async () => {
|
|
13111
13180
|
const { verifyToken: verifyToken2, jwtTokenManager: jwtTokenManager4 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
13112
13181
|
const verify = await verifyToken2();
|
|
13113
13182
|
const hasServerKeyshare = verify?.hasKeyshare ?? jwtTokenManager4.getHasKeyshare() ?? false;
|
|
@@ -13172,12 +13241,12 @@ function useOnRestoreSuccess() {
|
|
|
13172
13241
|
]);
|
|
13173
13242
|
return { onRestoreSuccess };
|
|
13174
13243
|
}
|
|
13175
|
-
var
|
|
13244
|
+
var import_react37;
|
|
13176
13245
|
var init_useOnRestoreSuccess = __esm({
|
|
13177
13246
|
"src/internal/components/KeyshareRestoreMenu/hooks/useOnRestoreSuccess.ts"() {
|
|
13178
13247
|
init_ProviderContext();
|
|
13179
13248
|
init_SessionContext();
|
|
13180
|
-
|
|
13249
|
+
import_react37 = require("react");
|
|
13181
13250
|
init_useLayoutDataStore();
|
|
13182
13251
|
init_useLayoutStore();
|
|
13183
13252
|
init_useRestoreStore();
|
|
@@ -13602,7 +13671,7 @@ function useCreateBackup() {
|
|
|
13602
13671
|
const usePasskey = useRestoreStore((st) => st.usePasskey);
|
|
13603
13672
|
const restorePassword = useRestoreStore((st) => st.restorePassword);
|
|
13604
13673
|
const selectedCloudProvider = useRestoreStore((st) => st.selectedCloudProvider);
|
|
13605
|
-
(0,
|
|
13674
|
+
(0, import_react38.useEffect)(() => {
|
|
13606
13675
|
if (!hasServerVault) {
|
|
13607
13676
|
useRestoreStore.getState().setMethod("server");
|
|
13608
13677
|
useLayoutStore.getState().setIsDialogForced(true);
|
|
@@ -13610,7 +13679,7 @@ function useCreateBackup() {
|
|
|
13610
13679
|
}, [hasServerVault]);
|
|
13611
13680
|
const recoveryUserId = useSession((st) => st.recoveryUserId);
|
|
13612
13681
|
const passportUserId = session?.mpcUserId || recoveryUserId || "";
|
|
13613
|
-
const onBackupSuccess = (0,
|
|
13682
|
+
const onBackupSuccess = (0, import_react38.useCallback)(() => {
|
|
13614
13683
|
console.log("[EMBARKAI BACKUP] Backup created successfully");
|
|
13615
13684
|
}, [hasServerVault]);
|
|
13616
13685
|
const { mutate: createPasswordBackup, isPending: isPasswordBackupCreating } = (0, import_react_query17.useMutation)({
|
|
@@ -13770,12 +13839,12 @@ function useCreateBackup() {
|
|
|
13770
13839
|
createPasskey
|
|
13771
13840
|
};
|
|
13772
13841
|
}
|
|
13773
|
-
var import_react_query17,
|
|
13842
|
+
var import_react_query17, import_react38;
|
|
13774
13843
|
var init_useCreateBackup = __esm({
|
|
13775
13844
|
"src/internal/components/KeyshareRestoreMenu/hooks/useCreateBackup.ts"() {
|
|
13776
13845
|
init_SessionContext();
|
|
13777
13846
|
import_react_query17 = require("@tanstack/react-query");
|
|
13778
|
-
|
|
13847
|
+
import_react38 = require("react");
|
|
13779
13848
|
init_auth();
|
|
13780
13849
|
init_useLayoutStore();
|
|
13781
13850
|
init_iframe_manager();
|
|
@@ -13910,7 +13979,7 @@ function useValidateFileBackup() {
|
|
|
13910
13979
|
const restoreFile = useRestoreStore((st) => st.restoreFile);
|
|
13911
13980
|
const setError = useRestoreStore((st) => st.setError);
|
|
13912
13981
|
const setUsePasskey = useRestoreStore((st) => st.setUsePasskey);
|
|
13913
|
-
(0,
|
|
13982
|
+
(0, import_react39.useEffect)(() => {
|
|
13914
13983
|
if (!restoreFile) {
|
|
13915
13984
|
return;
|
|
13916
13985
|
}
|
|
@@ -13931,10 +14000,10 @@ function useValidateFileBackup() {
|
|
|
13931
14000
|
reader.readAsText(restoreFile);
|
|
13932
14001
|
}, [restoreFile]);
|
|
13933
14002
|
}
|
|
13934
|
-
var
|
|
14003
|
+
var import_react39;
|
|
13935
14004
|
var init_useValidateFileBackup = __esm({
|
|
13936
14005
|
"src/internal/components/KeyshareRestoreMenu/hooks/useValidateFileBackup.ts"() {
|
|
13937
|
-
|
|
14006
|
+
import_react39 = require("react");
|
|
13938
14007
|
init_useRestoreStore();
|
|
13939
14008
|
}
|
|
13940
14009
|
});
|
|
@@ -13962,7 +14031,7 @@ function MethodSelector(props) {
|
|
|
13962
14031
|
setError,
|
|
13963
14032
|
setSuccess
|
|
13964
14033
|
} = useRestoreStore();
|
|
13965
|
-
const recoveryRenderMethods = (0,
|
|
14034
|
+
const recoveryRenderMethods = (0, import_react40.useMemo)(() => {
|
|
13966
14035
|
const methodsWithBackupData = getRecoveryRenderMethods(mode).map((mt) => {
|
|
13967
14036
|
let data = null;
|
|
13968
14037
|
switch (true) {
|
|
@@ -13977,7 +14046,7 @@ function MethodSelector(props) {
|
|
|
13977
14046
|
return methodsWithBackupData;
|
|
13978
14047
|
}, [mode, serverRecoveryStatus]);
|
|
13979
14048
|
if (!!selectedRecoveryMethod) return null;
|
|
13980
|
-
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
14049
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react40.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
13981
14050
|
"div",
|
|
13982
14051
|
{
|
|
13983
14052
|
style: { gridTemplateColumns: `repeat(${recoveryRenderMethods.length}, minmax(0, 1fr))` },
|
|
@@ -14011,12 +14080,12 @@ function MethodSelector(props) {
|
|
|
14011
14080
|
}
|
|
14012
14081
|
) });
|
|
14013
14082
|
}
|
|
14014
|
-
var import_lucide_react27,
|
|
14083
|
+
var import_lucide_react27, import_react40, import_jsx_runtime58, getRecoveryRenderMethods;
|
|
14015
14084
|
var init_MethodSelector = __esm({
|
|
14016
14085
|
"src/internal/components/KeyshareRestoreMenu/components/MethodSelector.tsx"() {
|
|
14017
14086
|
init_useT();
|
|
14018
14087
|
import_lucide_react27 = require("lucide-react");
|
|
14019
|
-
|
|
14088
|
+
import_react40 = require("react");
|
|
14020
14089
|
init_icons();
|
|
14021
14090
|
init_guardian_backup();
|
|
14022
14091
|
init_button();
|
|
@@ -14050,7 +14119,7 @@ function PasswordPasskey(props) {
|
|
|
14050
14119
|
onCreatePasskey
|
|
14051
14120
|
} = props;
|
|
14052
14121
|
const hasServerVault = useSession((st) => st.hasServerVault);
|
|
14053
|
-
const actionRef = (0,
|
|
14122
|
+
const actionRef = (0, import_react41.useRef)(null);
|
|
14054
14123
|
const {
|
|
14055
14124
|
showPassword,
|
|
14056
14125
|
restorePassword,
|
|
@@ -14064,7 +14133,7 @@ function PasswordPasskey(props) {
|
|
|
14064
14133
|
} = useRestoreStore();
|
|
14065
14134
|
const { config } = useProviderConfig();
|
|
14066
14135
|
const isPasskeyEnabled = config.current.passkey.enabled;
|
|
14067
|
-
(0,
|
|
14136
|
+
(0, import_react41.useEffect)(() => {
|
|
14068
14137
|
if (!isPasskeyEnabled && usePasskey) setUsePasskey(false);
|
|
14069
14138
|
}, [isPasskeyEnabled, usePasskey]);
|
|
14070
14139
|
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_jsx_runtime59.Fragment, { children: [
|
|
@@ -14219,7 +14288,7 @@ function PasswordPasskey(props) {
|
|
|
14219
14288
|
] })
|
|
14220
14289
|
] });
|
|
14221
14290
|
}
|
|
14222
|
-
var import_lucide_react28,
|
|
14291
|
+
var import_lucide_react28, import_react41, import_jsx_runtime59;
|
|
14223
14292
|
var init_PasswordPasskey = __esm({
|
|
14224
14293
|
"src/internal/components/KeyshareRestoreMenu/components/PasswordPasskey.tsx"() {
|
|
14225
14294
|
init_ProviderContext();
|
|
@@ -14227,7 +14296,7 @@ var init_PasswordPasskey = __esm({
|
|
|
14227
14296
|
init_i18n();
|
|
14228
14297
|
init_utils2();
|
|
14229
14298
|
import_lucide_react28 = require("lucide-react");
|
|
14230
|
-
|
|
14299
|
+
import_react41 = require("react");
|
|
14231
14300
|
init_icons();
|
|
14232
14301
|
init_button();
|
|
14233
14302
|
init_highlight();
|
|
@@ -14403,7 +14472,7 @@ function Server(props) {
|
|
|
14403
14472
|
const usePasskey = useRestoreStore((st) => st.usePasskey);
|
|
14404
14473
|
const setUsePasskey = useRestoreStore((st) => st.setUsePasskey);
|
|
14405
14474
|
const serverRecoveryStatus = qc.getQueryData([CHECK_BACKUP_QUERY_KEY, address]);
|
|
14406
|
-
(0,
|
|
14475
|
+
(0, import_react42.useEffect)(() => {
|
|
14407
14476
|
if (mode === "backup" || !serverRecoveryStatus?.created?.encryptionMethod) return;
|
|
14408
14477
|
setUsePasskey(serverRecoveryStatus.created.encryptionMethod === "passkey");
|
|
14409
14478
|
}, [mode, serverRecoveryStatus, setUsePasskey]);
|
|
@@ -14438,7 +14507,7 @@ function Server(props) {
|
|
|
14438
14507
|
] })
|
|
14439
14508
|
] });
|
|
14440
14509
|
}
|
|
14441
|
-
var import_react_query19, import_dayjs3, import_lucide_react31,
|
|
14510
|
+
var import_react_query19, import_dayjs3, import_lucide_react31, import_react42, import_jsx_runtime62;
|
|
14442
14511
|
var init_Server = __esm({
|
|
14443
14512
|
"src/internal/components/KeyshareRestoreMenu/methods/Server.tsx"() {
|
|
14444
14513
|
init_SessionContext();
|
|
@@ -14447,7 +14516,7 @@ var init_Server = __esm({
|
|
|
14447
14516
|
import_react_query19 = require("@tanstack/react-query");
|
|
14448
14517
|
import_dayjs3 = __toESM(require("dayjs"), 1);
|
|
14449
14518
|
import_lucide_react31 = require("lucide-react");
|
|
14450
|
-
|
|
14519
|
+
import_react42 = require("react");
|
|
14451
14520
|
init_highlight();
|
|
14452
14521
|
init_PasswordPasskey();
|
|
14453
14522
|
init_constants4();
|
|
@@ -14610,7 +14679,7 @@ function Cloud2(props) {
|
|
|
14610
14679
|
return availableProviders.map((p) => ({ id: p.id, name: p.name, available: p.isAvailable() }));
|
|
14611
14680
|
}
|
|
14612
14681
|
});
|
|
14613
|
-
(0,
|
|
14682
|
+
(0, import_react43.useEffect)(() => {
|
|
14614
14683
|
if (isCloudProvidersLoading) return;
|
|
14615
14684
|
if (!!cloudProvidersError) {
|
|
14616
14685
|
console.error("[KeyshareBackup] Failed to load cloud providers:", cloudProvidersError);
|
|
@@ -14674,13 +14743,13 @@ function Cloud2(props) {
|
|
|
14674
14743
|
)
|
|
14675
14744
|
] });
|
|
14676
14745
|
}
|
|
14677
|
-
var import_react_query20, import_lucide_react33,
|
|
14746
|
+
var import_react_query20, import_lucide_react33, import_react43, import_jsx_runtime64;
|
|
14678
14747
|
var init_Cloud = __esm({
|
|
14679
14748
|
"src/internal/components/KeyshareRestoreMenu/methods/Cloud.tsx"() {
|
|
14680
14749
|
init_SessionContext();
|
|
14681
14750
|
import_react_query20 = require("@tanstack/react-query");
|
|
14682
14751
|
import_lucide_react33 = require("lucide-react");
|
|
14683
|
-
|
|
14752
|
+
import_react43 = require("react");
|
|
14684
14753
|
init_button();
|
|
14685
14754
|
init_select();
|
|
14686
14755
|
init_PasswordPasskey();
|
|
@@ -14697,8 +14766,8 @@ function Guardian(props) {
|
|
|
14697
14766
|
const session = useSession((st) => st.session);
|
|
14698
14767
|
const recoveryUserId = useSession((st) => st.recoveryUserId);
|
|
14699
14768
|
const { onRestoreSuccess } = useOnRestoreSuccess();
|
|
14700
|
-
const [isWorking, setIsWorking] = (0,
|
|
14701
|
-
const [step, setStep] = (0,
|
|
14769
|
+
const [isWorking, setIsWorking] = (0, import_react44.useState)(false);
|
|
14770
|
+
const [step, setStep] = (0, import_react44.useState)("idle");
|
|
14702
14771
|
const handleGuardianBackup = async () => {
|
|
14703
14772
|
if (!restorePassword) {
|
|
14704
14773
|
setError("Please enter a password");
|
|
@@ -14827,11 +14896,11 @@ function Guardian(props) {
|
|
|
14827
14896
|
] })
|
|
14828
14897
|
] });
|
|
14829
14898
|
}
|
|
14830
|
-
var
|
|
14899
|
+
var import_react44, import_lucide_react34, import_jsx_runtime65;
|
|
14831
14900
|
var init_Guardian = __esm({
|
|
14832
14901
|
"src/internal/components/KeyshareRestoreMenu/methods/Guardian.tsx"() {
|
|
14833
14902
|
init_SessionContext();
|
|
14834
|
-
|
|
14903
|
+
import_react44 = require("react");
|
|
14835
14904
|
import_lucide_react34 = require("lucide-react");
|
|
14836
14905
|
init_iframe_manager();
|
|
14837
14906
|
init_guardian_backup();
|
|
@@ -14854,7 +14923,7 @@ var init_methods = __esm({
|
|
|
14854
14923
|
});
|
|
14855
14924
|
|
|
14856
14925
|
// src/internal/components/KeyshareRestoreMenu/KeyshareRestoreMenu.tsx
|
|
14857
|
-
var import_react_query21, import_lucide_react35,
|
|
14926
|
+
var import_react_query21, import_lucide_react35, import_react45, import_wagmi, import_jsx_runtime66, RESTORE_COMPONENTS, KeyshareRestoreMenu;
|
|
14858
14927
|
var init_KeyshareRestoreMenu = __esm({
|
|
14859
14928
|
"src/internal/components/KeyshareRestoreMenu/KeyshareRestoreMenu.tsx"() {
|
|
14860
14929
|
init_ProviderContext();
|
|
@@ -14862,7 +14931,7 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
14862
14931
|
init_i18n();
|
|
14863
14932
|
import_react_query21 = require("@tanstack/react-query");
|
|
14864
14933
|
import_lucide_react35 = require("lucide-react");
|
|
14865
|
-
|
|
14934
|
+
import_react45 = require("react");
|
|
14866
14935
|
import_wagmi = require("wagmi");
|
|
14867
14936
|
init_useLayoutDataStore();
|
|
14868
14937
|
init_useLayoutStore();
|
|
@@ -14893,7 +14962,7 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
14893
14962
|
const error = useRestoreStore((st) => st.error);
|
|
14894
14963
|
const success = useRestoreStore((st) => st.success);
|
|
14895
14964
|
const currentRestoreMethod = useRestoreStore((st) => st.method);
|
|
14896
|
-
(0,
|
|
14965
|
+
(0, import_react45.useEffect)(() => {
|
|
14897
14966
|
const { setIsDialogForced } = useLayoutStore.getState();
|
|
14898
14967
|
const { setRestorePassword, setRestoreFile, setShowPassword, setUsePasskey, setMethod } = useRestoreStore.getState();
|
|
14899
14968
|
setIsDialogForced(true);
|
|
@@ -14933,7 +15002,7 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
14933
15002
|
queryFn: async () => await getShareRecoveryStats()
|
|
14934
15003
|
});
|
|
14935
15004
|
const hasServerBackup = serverRecoveryStatus?.created || serverRecoveryStatus?.devices?.length > 0;
|
|
14936
|
-
(0,
|
|
15005
|
+
(0, import_react45.useEffect)(() => {
|
|
14937
15006
|
if (!!hasServerBackup) useRestoreStore.getState().setMethod("server");
|
|
14938
15007
|
}, [hasServerBackup]);
|
|
14939
15008
|
const { mutate: disconnect, isPending: isDisconnecting } = (0, import_react_query21.useMutation)({
|
|
@@ -15087,7 +15156,7 @@ function KeyshareBackupMenu() {
|
|
|
15087
15156
|
const currentBackupMethod = useRestoreStore((st) => st.method);
|
|
15088
15157
|
const error = useRestoreStore((st) => st.error);
|
|
15089
15158
|
const success = useRestoreStore((st) => st.success);
|
|
15090
|
-
(0,
|
|
15159
|
+
(0, import_react46.useEffect)(() => {
|
|
15091
15160
|
const { setSuccess, setError, setRestorePassword, setRestoreFile, setShowPassword, setUsePasskey, setMethod } = useRestoreStore.getState();
|
|
15092
15161
|
return () => {
|
|
15093
15162
|
setSuccess(null);
|
|
@@ -15106,7 +15175,7 @@ function KeyshareBackupMenu() {
|
|
|
15106
15175
|
queryFn: async () => await getShareRecoveryStats()
|
|
15107
15176
|
});
|
|
15108
15177
|
const hasRecoveryData = serverRecoveryStatus?.created || serverRecoveryStatus?.devices?.length > 0;
|
|
15109
|
-
(0,
|
|
15178
|
+
(0, import_react46.useEffect)(() => {
|
|
15110
15179
|
if (!!hasRecoveryData) useRestoreStore.getState().setMethod("server");
|
|
15111
15180
|
}, [hasRecoveryData]);
|
|
15112
15181
|
const {
|
|
@@ -15225,14 +15294,14 @@ function KeyshareBackupMenu() {
|
|
|
15225
15294
|
}
|
|
15226
15295
|
);
|
|
15227
15296
|
}
|
|
15228
|
-
var import_react_query22, import_lucide_react36,
|
|
15297
|
+
var import_react_query22, import_lucide_react36, import_react46, import_jsx_runtime67, COMPONENTS;
|
|
15229
15298
|
var init_KeyshareBackupMenu = __esm({
|
|
15230
15299
|
"src/internal/components/KeyshareRestoreMenu/KeyshareBackupMenu.tsx"() {
|
|
15231
15300
|
init_SessionContext();
|
|
15232
15301
|
init_i18n();
|
|
15233
15302
|
import_react_query22 = require("@tanstack/react-query");
|
|
15234
15303
|
import_lucide_react36 = require("lucide-react");
|
|
15235
|
-
|
|
15304
|
+
import_react46 = require("react");
|
|
15236
15305
|
init_useLayoutDataStore();
|
|
15237
15306
|
init_useLayoutStore();
|
|
15238
15307
|
init_vaultClient();
|
|
@@ -15270,14 +15339,14 @@ function useColorMode() {
|
|
|
15270
15339
|
const preferedColorMode = config?.preferedColorMode;
|
|
15271
15340
|
const colorMode = useLayoutStore((st) => st.colorMode);
|
|
15272
15341
|
const handleStoreColorMode = useLayoutStore((st) => st.setColorMode);
|
|
15273
|
-
const setColorMode = (0,
|
|
15342
|
+
const setColorMode = (0, import_react47.useCallback)(
|
|
15274
15343
|
(mode) => {
|
|
15275
15344
|
localStorage.setItem(LOCAL_COLOR_MODE_KEY, mode);
|
|
15276
15345
|
handleStoreColorMode(mode);
|
|
15277
15346
|
},
|
|
15278
15347
|
[handleStoreColorMode]
|
|
15279
15348
|
);
|
|
15280
|
-
(0,
|
|
15349
|
+
(0, import_react47.useEffect)(() => {
|
|
15281
15350
|
let targetColorMode = localStorage.getItem(LOCAL_COLOR_MODE_KEY);
|
|
15282
15351
|
if (!targetColorMode && !preferedColorMode) {
|
|
15283
15352
|
const systemMode = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
@@ -15292,10 +15361,10 @@ function useColorMode() {
|
|
|
15292
15361
|
}, []);
|
|
15293
15362
|
return { colorMode, setColorMode };
|
|
15294
15363
|
}
|
|
15295
|
-
var
|
|
15364
|
+
var import_react47;
|
|
15296
15365
|
var init_useColorMode = __esm({
|
|
15297
15366
|
"src/hooks/useColorMode.ts"() {
|
|
15298
|
-
|
|
15367
|
+
import_react47 = require("react");
|
|
15299
15368
|
init_ProviderContext();
|
|
15300
15369
|
init_constants();
|
|
15301
15370
|
init_useLayoutStore();
|
|
@@ -15397,13 +15466,13 @@ var init_SumsubIframeManager = __esm({
|
|
|
15397
15466
|
function useSumsubIframe({ iframeUrl }) {
|
|
15398
15467
|
const config = useProviderConfig().config;
|
|
15399
15468
|
const { colorMode } = useColorMode();
|
|
15400
|
-
const iframeRef = (0,
|
|
15401
|
-
const [isLoading, setIsLoading] = (0,
|
|
15402
|
-
const [error, setError] = (0,
|
|
15403
|
-
const [height, setHeight] = (0,
|
|
15404
|
-
const [status, setStatus] = (0,
|
|
15469
|
+
const iframeRef = (0, import_react48.useRef)(null);
|
|
15470
|
+
const [isLoading, setIsLoading] = (0, import_react48.useState)(true);
|
|
15471
|
+
const [error, setError] = (0, import_react48.useState)(null);
|
|
15472
|
+
const [height, setHeight] = (0, import_react48.useState)(0);
|
|
15473
|
+
const [status, setStatus] = (0, import_react48.useState)("");
|
|
15405
15474
|
const levelName = config.current?.kyc?.options?.levelName;
|
|
15406
|
-
(0,
|
|
15475
|
+
(0, import_react48.useEffect)(() => {
|
|
15407
15476
|
setError(null);
|
|
15408
15477
|
setIsLoading(true);
|
|
15409
15478
|
setStatus("Preparing verification...");
|
|
@@ -15444,12 +15513,12 @@ function useSumsubIframe({ iframeUrl }) {
|
|
|
15444
15513
|
status
|
|
15445
15514
|
};
|
|
15446
15515
|
}
|
|
15447
|
-
var
|
|
15516
|
+
var import_react48;
|
|
15448
15517
|
var init_useSumsubIframe = __esm({
|
|
15449
15518
|
"src/internal/components/KYC/useSumsubIframe.ts"() {
|
|
15450
15519
|
init_ProviderContext();
|
|
15451
15520
|
init_useColorMode();
|
|
15452
|
-
|
|
15521
|
+
import_react48 = require("react");
|
|
15453
15522
|
init_sumsub();
|
|
15454
15523
|
init_SumsubIframeManager();
|
|
15455
15524
|
}
|
|
@@ -15723,7 +15792,7 @@ function MainMenu() {
|
|
|
15723
15792
|
const { t } = useT();
|
|
15724
15793
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
15725
15794
|
const setTransitionPageHeight = useLayoutDataStore((st) => st.setTransitionPageHeight);
|
|
15726
|
-
(0,
|
|
15795
|
+
(0, import_react49.useEffect)(() => setTransitionPageHeight(DEFAULT_MAIN_MENU_HEIGHT), []);
|
|
15727
15796
|
useProvidersList();
|
|
15728
15797
|
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "w-full p-[var(--ui-kit-pd)] flex flex-col gap-[var(--ui-kit-gap)]", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "w-full grid grid-cols-4 gap-0 md:gap-[var(--ui-kit-gap)] py-[10px] md:py-1", children: MAIN_MENU_BUTTONS.map(({ id, label, icon: Icon2 }) => /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
|
|
15729
15798
|
Button,
|
|
@@ -15741,13 +15810,13 @@ function MainMenu() {
|
|
|
15741
15810
|
id
|
|
15742
15811
|
)) }) });
|
|
15743
15812
|
}
|
|
15744
|
-
var import_lucide_react41,
|
|
15813
|
+
var import_lucide_react41, import_react49, import_jsx_runtime72, MAIN_MENU_BUTTONS;
|
|
15745
15814
|
var init_MainMenu = __esm({
|
|
15746
15815
|
"src/internal/components/MainMenu/MainMenu.tsx"() {
|
|
15747
15816
|
init_SessionContext();
|
|
15748
15817
|
init_useT();
|
|
15749
15818
|
import_lucide_react41 = require("lucide-react");
|
|
15750
|
-
|
|
15819
|
+
import_react49 = require("react");
|
|
15751
15820
|
init_constants();
|
|
15752
15821
|
init_useLayoutDataStore();
|
|
15753
15822
|
init_useProvidersList();
|
|
@@ -15793,16 +15862,16 @@ function useLinkedProfiles() {
|
|
|
15793
15862
|
}
|
|
15794
15863
|
});
|
|
15795
15864
|
const { profiles = [], avatar = null } = data || {};
|
|
15796
|
-
const refresh = (0,
|
|
15865
|
+
const refresh = (0, import_react50.useCallback)(async () => {
|
|
15797
15866
|
await qc.invalidateQueries({ queryKey: [LINKED_PROFILES_QUERY_KEY, address] });
|
|
15798
15867
|
}, [qc, address]);
|
|
15799
15868
|
return { profiles, avatar, isLoading, isFetching, error, refresh };
|
|
15800
15869
|
}
|
|
15801
|
-
var import_react_query25,
|
|
15870
|
+
var import_react_query25, import_react50, LINKED_PROFILES_QUERY_KEY;
|
|
15802
15871
|
var init_linkedProfiles = __esm({
|
|
15803
15872
|
"src/modules/linkedProfiles.ts"() {
|
|
15804
15873
|
import_react_query25 = require("@tanstack/react-query");
|
|
15805
|
-
|
|
15874
|
+
import_react50 = require("react");
|
|
15806
15875
|
init_SessionContext();
|
|
15807
15876
|
init_auth();
|
|
15808
15877
|
init_common();
|
|
@@ -16293,7 +16362,7 @@ function useLinkSocial() {
|
|
|
16293
16362
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
16294
16363
|
const isWalletLinking = useLayoutDataStore((st) => st.isWalletLinking);
|
|
16295
16364
|
const { providerType, linkIsLoading, setProviderType, setAlert, setLinkIsLoading } = useManageWalletStore();
|
|
16296
|
-
const handleLinkSocialProvider =
|
|
16365
|
+
const handleLinkSocialProvider = import_react51.default.useCallback(
|
|
16297
16366
|
async (providerIdRaw) => {
|
|
16298
16367
|
const providerKey = providerIdRaw.toLowerCase();
|
|
16299
16368
|
const normalizedKey = providerKey === "twitter" ? "x" : providerKey;
|
|
@@ -16351,8 +16420,8 @@ function useLinkSocial() {
|
|
|
16351
16420
|
},
|
|
16352
16421
|
[config.social?.providers]
|
|
16353
16422
|
);
|
|
16354
|
-
const [socialLinkStarted, setSocialLinkStarted] =
|
|
16355
|
-
(0,
|
|
16423
|
+
const [socialLinkStarted, setSocialLinkStarted] = import_react51.default.useState(false);
|
|
16424
|
+
(0, import_react51.useEffect)(() => {
|
|
16356
16425
|
const key = providerType?.toLowerCase();
|
|
16357
16426
|
console.log("[useLinkSocial] Effect triggered:", { key, linkIsLoading, socialLinkStarted, isWalletLinking });
|
|
16358
16427
|
if (isWalletLinking) {
|
|
@@ -16370,7 +16439,7 @@ function useLinkSocial() {
|
|
|
16370
16439
|
}
|
|
16371
16440
|
}, [providerType, linkIsLoading, socialLinkStarted, isWalletLinking, handleLinkSocialProvider]);
|
|
16372
16441
|
}
|
|
16373
|
-
var import_react_query30,
|
|
16442
|
+
var import_react_query30, import_react51;
|
|
16374
16443
|
var init_useLinkSocial = __esm({
|
|
16375
16444
|
"src/internal/components/ManageWalletMenu/hooks/useLinkSocial.ts"() {
|
|
16376
16445
|
init_useLayoutDataStore();
|
|
@@ -16378,7 +16447,7 @@ var init_useLinkSocial = __esm({
|
|
|
16378
16447
|
init_SessionContext();
|
|
16379
16448
|
init_linkedProfiles();
|
|
16380
16449
|
import_react_query30 = require("@tanstack/react-query");
|
|
16381
|
-
|
|
16450
|
+
import_react51 = __toESM(require("react"), 1);
|
|
16382
16451
|
init_auth();
|
|
16383
16452
|
init_telegramBrowser();
|
|
16384
16453
|
init_useProvidersList();
|
|
@@ -16447,7 +16516,7 @@ function useLinkTelegram() {
|
|
|
16447
16516
|
const isWalletLinking = useLayoutDataStore((st) => st.isWalletLinking);
|
|
16448
16517
|
const { providerType, linkIsLoading, setLinkIsLoading, setProviderType, setAlert } = useManageWalletStore();
|
|
16449
16518
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
16450
|
-
const handleLinkTelegram = (0,
|
|
16519
|
+
const handleLinkTelegram = (0, import_react52.useCallback)(async () => {
|
|
16451
16520
|
try {
|
|
16452
16521
|
if (shouldBlockSocialAuthInTelegram("telegram")) {
|
|
16453
16522
|
setAlert(buildTelegramBrowserRestriction("Telegram", "linking"));
|
|
@@ -16494,8 +16563,8 @@ function useLinkTelegram() {
|
|
|
16494
16563
|
setLinkIsLoading(false);
|
|
16495
16564
|
}
|
|
16496
16565
|
}, [config.social?.providers]);
|
|
16497
|
-
const [telegramLinkStarted, setTelegramLinkStarted] = (0,
|
|
16498
|
-
(0,
|
|
16566
|
+
const [telegramLinkStarted, setTelegramLinkStarted] = (0, import_react52.useState)(false);
|
|
16567
|
+
(0, import_react52.useEffect)(() => {
|
|
16499
16568
|
console.log("[useLinkTelegram] Effect triggered:", {
|
|
16500
16569
|
providerType,
|
|
16501
16570
|
linkIsLoading,
|
|
@@ -16512,20 +16581,20 @@ function useLinkTelegram() {
|
|
|
16512
16581
|
handleLinkTelegram();
|
|
16513
16582
|
}
|
|
16514
16583
|
}, [providerType, handleLinkTelegram, linkIsLoading, telegramLinkStarted, isWalletLinking]);
|
|
16515
|
-
(0,
|
|
16584
|
+
(0, import_react52.useEffect)(() => {
|
|
16516
16585
|
if (providerType !== "telegram") {
|
|
16517
16586
|
setTelegramLinkStarted(false);
|
|
16518
16587
|
}
|
|
16519
16588
|
}, [providerType]);
|
|
16520
16589
|
}
|
|
16521
|
-
var import_react_query31,
|
|
16590
|
+
var import_react_query31, import_react52;
|
|
16522
16591
|
var init_useLinkTelegram = __esm({
|
|
16523
16592
|
"src/internal/components/ManageWalletMenu/hooks/useLinkTelegram.ts"() {
|
|
16524
16593
|
init_ProviderContext();
|
|
16525
16594
|
init_SessionContext();
|
|
16526
16595
|
init_linkedProfiles();
|
|
16527
16596
|
import_react_query31 = require("@tanstack/react-query");
|
|
16528
|
-
|
|
16597
|
+
import_react52 = require("react");
|
|
16529
16598
|
init_telegram2();
|
|
16530
16599
|
init_useLayoutDataStore();
|
|
16531
16600
|
init_telegramBrowser();
|
|
@@ -16636,7 +16705,7 @@ function getConfiguredProviders(config) {
|
|
|
16636
16705
|
});
|
|
16637
16706
|
return acc;
|
|
16638
16707
|
},
|
|
16639
|
-
(0,
|
|
16708
|
+
(0, import_lodash_es9.fromPairs)(POSSIBLE_PROVIDERS.map((p) => [p, false]))
|
|
16640
16709
|
);
|
|
16641
16710
|
}
|
|
16642
16711
|
function ManageWalletMenu() {
|
|
@@ -16658,7 +16727,7 @@ function ManageWalletMenu() {
|
|
|
16658
16727
|
} = useManageWalletStore();
|
|
16659
16728
|
const configuredProviders = getConfiguredProviders(config.current);
|
|
16660
16729
|
const { data: providers = [], isLoading: isProvidersLoading, error: providersError } = useProvidersList();
|
|
16661
|
-
const renderProviders = (0,
|
|
16730
|
+
const renderProviders = (0, import_react53.useMemo)(() => {
|
|
16662
16731
|
const normalizeProviderName = (name) => {
|
|
16663
16732
|
if (name === "x") return "twitter";
|
|
16664
16733
|
return name;
|
|
@@ -16780,16 +16849,16 @@ function ManageWalletMenu() {
|
|
|
16780
16849
|
}
|
|
16781
16850
|
);
|
|
16782
16851
|
}
|
|
16783
|
-
var
|
|
16852
|
+
var import_lodash_es9, import_lucide_react45, import_react53, import_jsx_runtime77, POSSIBLE_PROVIDERS, MULTI_PROVIDERS;
|
|
16784
16853
|
var init_ManageWallet = __esm({
|
|
16785
16854
|
"src/internal/components/ManageWalletMenu/ManageWallet.tsx"() {
|
|
16786
16855
|
init_useLayoutDataStore();
|
|
16787
16856
|
init_useLayoutStore();
|
|
16788
16857
|
init_ProviderContext();
|
|
16789
16858
|
init_i18n();
|
|
16790
|
-
|
|
16859
|
+
import_lodash_es9 = require("lodash-es");
|
|
16791
16860
|
import_lucide_react45 = require("lucide-react");
|
|
16792
|
-
|
|
16861
|
+
import_react53 = require("react");
|
|
16793
16862
|
init_constants();
|
|
16794
16863
|
init_telegramBrowser();
|
|
16795
16864
|
init_Expandable2();
|
|
@@ -16826,7 +16895,7 @@ function UnlinkProviderMenu() {
|
|
|
16826
16895
|
const { t } = useT();
|
|
16827
16896
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
16828
16897
|
const { confirmUnlink, setConfirmUnlink, setAlert } = useManageWalletStore();
|
|
16829
|
-
const [confirmInput, setConfirmInput] = (0,
|
|
16898
|
+
const [confirmInput, setConfirmInput] = (0, import_react54.useState)("");
|
|
16830
16899
|
const { mutate: handleUnlinkProvider, isPending: isProviderUnlinking } = (0, import_react_query32.useMutation)({
|
|
16831
16900
|
mutationFn: async () => {
|
|
16832
16901
|
if (!confirmUnlink) {
|
|
@@ -16908,7 +16977,7 @@ function UnlinkProviderMenu() {
|
|
|
16908
16977
|
] })
|
|
16909
16978
|
] });
|
|
16910
16979
|
}
|
|
16911
|
-
var import_react_query32, import_lucide_react46,
|
|
16980
|
+
var import_react_query32, import_lucide_react46, import_react54, import_wagmi2, import_jsx_runtime78;
|
|
16912
16981
|
var init_UnlinkProviderMenu = __esm({
|
|
16913
16982
|
"src/internal/components/ManageWalletMenu/UnlinkProviderMenu.tsx"() {
|
|
16914
16983
|
init_useLayoutDataStore();
|
|
@@ -16918,7 +16987,7 @@ var init_UnlinkProviderMenu = __esm({
|
|
|
16918
16987
|
init_linkedProfiles();
|
|
16919
16988
|
import_react_query32 = require("@tanstack/react-query");
|
|
16920
16989
|
import_lucide_react46 = require("lucide-react");
|
|
16921
|
-
|
|
16990
|
+
import_react54 = require("react");
|
|
16922
16991
|
import_wagmi2 = require("wagmi");
|
|
16923
16992
|
init_auth();
|
|
16924
16993
|
init_useExternalWalletStore();
|
|
@@ -17039,7 +17108,7 @@ var init_useNicknameStore = __esm({
|
|
|
17039
17108
|
function useNicknameAvailability(currentNickname) {
|
|
17040
17109
|
const { t } = useT();
|
|
17041
17110
|
const nicknameValue = useNicknameStore((st) => st.nicknameValue);
|
|
17042
|
-
(0,
|
|
17111
|
+
(0, import_react55.useEffect)(() => {
|
|
17043
17112
|
if (!currentNickname) return;
|
|
17044
17113
|
useNicknameStore.getState().setNicknameValue(currentNickname);
|
|
17045
17114
|
}, [currentNickname]);
|
|
@@ -17060,8 +17129,8 @@ function useNicknameAvailability(currentNickname) {
|
|
|
17060
17129
|
useNicknameStore.getState().setError(error?.message || "Failed to check nickname availability");
|
|
17061
17130
|
}
|
|
17062
17131
|
});
|
|
17063
|
-
const debouncedCheckAvailability = (0,
|
|
17064
|
-
(0,
|
|
17132
|
+
const debouncedCheckAvailability = (0, import_react55.useCallback)((0, import_lodash_es10.debounce)(checkAvailability, DEBOUNCE_MS), [checkAvailability]);
|
|
17133
|
+
(0, import_react55.useEffect)(() => {
|
|
17065
17134
|
if (!currentNickname) return;
|
|
17066
17135
|
const normalizedInputValue = normalizeNickname(nicknameValue);
|
|
17067
17136
|
const { valid: isNicknameValid } = validateNickname(nicknameValue);
|
|
@@ -17075,13 +17144,13 @@ function useNicknameAvailability(currentNickname) {
|
|
|
17075
17144
|
}, [nicknameValue, currentNickname, debouncedCheckAvailability]);
|
|
17076
17145
|
return { isCheckingAvailability };
|
|
17077
17146
|
}
|
|
17078
|
-
var import_react_query33,
|
|
17147
|
+
var import_react_query33, import_lodash_es10, import_react55, DEBOUNCE_MS;
|
|
17079
17148
|
var init_useNicknameAvailability = __esm({
|
|
17080
17149
|
"src/internal/components/NicknameMenu/useNicknameAvailability.ts"() {
|
|
17081
17150
|
init_i18n();
|
|
17082
17151
|
import_react_query33 = require("@tanstack/react-query");
|
|
17083
|
-
|
|
17084
|
-
|
|
17152
|
+
import_lodash_es10 = require("lodash-es");
|
|
17153
|
+
import_react55 = require("react");
|
|
17085
17154
|
init_nickname();
|
|
17086
17155
|
init_nickname_errors();
|
|
17087
17156
|
init_nickname_validation();
|
|
@@ -17102,7 +17171,7 @@ function NicknameEditForm(props) {
|
|
|
17102
17171
|
const nicknameValue = useNicknameStore((st) => st.nicknameValue);
|
|
17103
17172
|
const nicknameAvailability = useNicknameStore((st) => st.availability);
|
|
17104
17173
|
const { isCheckingAvailability } = useNicknameAvailability(nicknameInfo ? nicknameInfo.handle : "");
|
|
17105
|
-
const [isNicknameCopied, setIsNicknameCopied] = (0,
|
|
17174
|
+
const [isNicknameCopied, setIsNicknameCopied] = (0, import_react56.useState)(false);
|
|
17106
17175
|
const {
|
|
17107
17176
|
mutate: changeNickname2,
|
|
17108
17177
|
isError: isNicknameChangeError,
|
|
@@ -17131,7 +17200,7 @@ function NicknameEditForm(props) {
|
|
|
17131
17200
|
);
|
|
17132
17201
|
}
|
|
17133
17202
|
});
|
|
17134
|
-
const handleNicknameInputChange = (0,
|
|
17203
|
+
const handleNicknameInputChange = (0, import_react56.useCallback)(
|
|
17135
17204
|
(e) => {
|
|
17136
17205
|
const { error, setError, setNicknameValue } = useNicknameStore.getState();
|
|
17137
17206
|
const value = e.target.value;
|
|
@@ -17146,7 +17215,7 @@ function NicknameEditForm(props) {
|
|
|
17146
17215
|
},
|
|
17147
17216
|
[isNicknameChangeError, isNicknameChangeSuccess, reset, t]
|
|
17148
17217
|
);
|
|
17149
|
-
const handleSubmit = (0,
|
|
17218
|
+
const handleSubmit = (0, import_react56.useCallback)(
|
|
17150
17219
|
(e) => {
|
|
17151
17220
|
const { nicknameValue: nicknameValue2, setError } = useNicknameStore.getState();
|
|
17152
17221
|
if (!canChange) {
|
|
@@ -17229,7 +17298,7 @@ function NicknameEditForm(props) {
|
|
|
17229
17298
|
!!canChange && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("span", { className: "w-full flex items-center leadding-4 text-[10px] text-[var(--ui-kit-fg-muted)]", children: t("passport:nicknameMenu.hint") })
|
|
17230
17299
|
] });
|
|
17231
17300
|
}
|
|
17232
|
-
var import_react_query34, import_lucide_react47,
|
|
17301
|
+
var import_react_query34, import_lucide_react47, import_react56, import_jsx_runtime79;
|
|
17233
17302
|
var init_NicknameEditForm = __esm({
|
|
17234
17303
|
"src/internal/components/NicknameMenu/NicknameEditForm.tsx"() {
|
|
17235
17304
|
init_ProviderContext();
|
|
@@ -17237,7 +17306,7 @@ var init_NicknameEditForm = __esm({
|
|
|
17237
17306
|
init_i18n();
|
|
17238
17307
|
import_react_query34 = require("@tanstack/react-query");
|
|
17239
17308
|
import_lucide_react47 = require("lucide-react");
|
|
17240
|
-
|
|
17309
|
+
import_react56 = require("react");
|
|
17241
17310
|
init_icons();
|
|
17242
17311
|
init_nickname();
|
|
17243
17312
|
init_profile();
|
|
@@ -17256,7 +17325,7 @@ var init_NicknameEditForm = __esm({
|
|
|
17256
17325
|
|
|
17257
17326
|
// src/internal/components/NicknameMenu/NicknameMenu.tsx
|
|
17258
17327
|
function NicknameMenu() {
|
|
17259
|
-
const { isInitialUser } = usePageParams();
|
|
17328
|
+
const { isInitialUser } = usePageParams().current;
|
|
17260
17329
|
const { t } = useT();
|
|
17261
17330
|
const address = useSession((st) => st.address);
|
|
17262
17331
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
@@ -17391,11 +17460,11 @@ function useResolvedPublicClient(chainId, logScope = "useResolvedPublicClient")
|
|
|
17391
17460
|
const activeChainConfig = useSession((st) => st.chainConfig);
|
|
17392
17461
|
const resolvedChainId = chainId ?? activeChainId;
|
|
17393
17462
|
const shouldUseActiveClient = !chainId || chainId === activeChainId;
|
|
17394
|
-
const chainConfig = (0,
|
|
17463
|
+
const chainConfig = (0, import_react57.useMemo)(() => {
|
|
17395
17464
|
if (shouldUseActiveClient) return activeChainConfig;
|
|
17396
17465
|
return (0, import_read15.getChainConfig)(chainId);
|
|
17397
17466
|
}, [activeChainConfig, chainId, shouldUseActiveClient]);
|
|
17398
|
-
const publicClient = (0,
|
|
17467
|
+
const publicClient = (0, import_react57.useMemo)(() => {
|
|
17399
17468
|
if (shouldUseActiveClient) return activePublicClient;
|
|
17400
17469
|
if (!chainId) return activePublicClient;
|
|
17401
17470
|
try {
|
|
@@ -17412,12 +17481,12 @@ function useResolvedPublicClient(chainId, logScope = "useResolvedPublicClient")
|
|
|
17412
17481
|
resolvedChainId
|
|
17413
17482
|
};
|
|
17414
17483
|
}
|
|
17415
|
-
var import_read15,
|
|
17484
|
+
var import_read15, import_react57, publicClientByChainId;
|
|
17416
17485
|
var init_useResolvedPublicClient = __esm({
|
|
17417
17486
|
"src/internal/hooks/useResolvedPublicClient.ts"() {
|
|
17418
17487
|
init_SessionContext();
|
|
17419
17488
|
import_read15 = require("@embarkai/core/read");
|
|
17420
|
-
|
|
17489
|
+
import_react57 = require("react");
|
|
17421
17490
|
publicClientByChainId = /* @__PURE__ */ new Map();
|
|
17422
17491
|
}
|
|
17423
17492
|
});
|
|
@@ -17427,7 +17496,7 @@ function useWatchTokens(options) {
|
|
|
17427
17496
|
const { address, chainId, enabled = true } = options;
|
|
17428
17497
|
const { config } = useProviderConfig();
|
|
17429
17498
|
const { publicClient, resolvedChainId } = useResolvedPublicClient(chainId, "useWatchTokens");
|
|
17430
|
-
const watchTokens = (0,
|
|
17499
|
+
const watchTokens = (0, import_react58.useMemo)(() => {
|
|
17431
17500
|
const allWatchTokens = config.current.watchTokens;
|
|
17432
17501
|
const tokensForChain = resolvedChainId ? allWatchTokens?.[resolvedChainId] || [] : [];
|
|
17433
17502
|
return tokensForChain;
|
|
@@ -17435,6 +17504,7 @@ function useWatchTokens(options) {
|
|
|
17435
17504
|
const {
|
|
17436
17505
|
data: assets,
|
|
17437
17506
|
isLoading,
|
|
17507
|
+
isFetching,
|
|
17438
17508
|
error,
|
|
17439
17509
|
refetch
|
|
17440
17510
|
} = (0, import_react_query36.useQuery)({
|
|
@@ -17505,16 +17575,17 @@ function useWatchTokens(options) {
|
|
|
17505
17575
|
return {
|
|
17506
17576
|
assets: assets || [],
|
|
17507
17577
|
isLoading,
|
|
17578
|
+
isFetching,
|
|
17508
17579
|
error: error || null,
|
|
17509
17580
|
refetch
|
|
17510
17581
|
};
|
|
17511
17582
|
}
|
|
17512
|
-
var import_react_query36,
|
|
17583
|
+
var import_react_query36, import_react58, import_viem6, WATCH_TOKENS_QUERY_KEY;
|
|
17513
17584
|
var init_useWatchTokens = __esm({
|
|
17514
17585
|
"src/internal/hooks/useWatchTokens.ts"() {
|
|
17515
17586
|
init_ProviderContext();
|
|
17516
17587
|
import_react_query36 = require("@tanstack/react-query");
|
|
17517
|
-
|
|
17588
|
+
import_react58 = require("react");
|
|
17518
17589
|
import_viem6 = require("viem");
|
|
17519
17590
|
init_useResolvedPublicClient();
|
|
17520
17591
|
WATCH_TOKENS_QUERY_KEY = "watch-tokens";
|
|
@@ -17653,19 +17724,21 @@ function useBlockscoutAssets(options) {
|
|
|
17653
17724
|
const customTokenBalancesQuery = portfolioConfig?.tokenBalancesQuery;
|
|
17654
17725
|
const customTokenBalancesQueryKey = portfolioConfig?.tokenBalancesQueryKey;
|
|
17655
17726
|
const blockscoutApiUrl = getBlockscoutApiUrl(chainConfig);
|
|
17656
|
-
const blockscoutClient = (0,
|
|
17727
|
+
const blockscoutClient = (0, import_react59.useMemo)(
|
|
17657
17728
|
() => blockscoutApiUrl ? (0, import_clients2.createBlockscoutClient)({ baseUrl: blockscoutApiUrl }) : null,
|
|
17658
17729
|
[blockscoutApiUrl]
|
|
17659
17730
|
);
|
|
17660
|
-
const lastRefreshRef = (0,
|
|
17731
|
+
const lastRefreshRef = (0, import_react59.useRef)(0);
|
|
17661
17732
|
const {
|
|
17662
17733
|
assets: watchTokenAssets,
|
|
17663
|
-
isLoading: watchTokensLoading
|
|
17734
|
+
isLoading: watchTokensLoading,
|
|
17735
|
+
isFetching: watchTokensFetching
|
|
17664
17736
|
// refetch: refetchWatchTokens
|
|
17665
17737
|
} = useWatchTokens({ address, chainId: resolvedChainId, enabled });
|
|
17666
17738
|
const {
|
|
17667
17739
|
data: nativeBalanceData,
|
|
17668
|
-
isLoading: nativeLoading
|
|
17740
|
+
isLoading: nativeLoading,
|
|
17741
|
+
isFetching: nativeFetching
|
|
17669
17742
|
// refetch: refetchNative
|
|
17670
17743
|
} = (0, import_react_query37.useQuery)({
|
|
17671
17744
|
queryKey: [NATIVE_BALANCE_QUERY_KEY, resolvedChainId, address],
|
|
@@ -17689,6 +17762,7 @@ function useBlockscoutAssets(options) {
|
|
|
17689
17762
|
const {
|
|
17690
17763
|
data: tokenBalances,
|
|
17691
17764
|
isLoading: tokensLoading,
|
|
17765
|
+
isFetching: tokensFetching,
|
|
17692
17766
|
error: tokensError,
|
|
17693
17767
|
// refetch: refetchTokens,
|
|
17694
17768
|
dataUpdatedAt
|
|
@@ -17714,7 +17788,8 @@ function useBlockscoutAssets(options) {
|
|
|
17714
17788
|
});
|
|
17715
17789
|
const {
|
|
17716
17790
|
data: nftItems,
|
|
17717
|
-
isLoading: nftsLoading
|
|
17791
|
+
isLoading: nftsLoading,
|
|
17792
|
+
isFetching: nftsFetching
|
|
17718
17793
|
// refetch: refetchNfts
|
|
17719
17794
|
} = (0, import_react_query37.useQuery)({
|
|
17720
17795
|
queryKey: [BLOCKSCOUT_QUERY_KEY, "nfts", resolvedChainId, address, blockscoutApiUrl],
|
|
@@ -17726,7 +17801,7 @@ function useBlockscoutAssets(options) {
|
|
|
17726
17801
|
retry: 2,
|
|
17727
17802
|
retryDelay: 1e3
|
|
17728
17803
|
});
|
|
17729
|
-
const erc20TokenAddresses = (0,
|
|
17804
|
+
const erc20TokenAddresses = (0, import_react59.useMemo)(() => {
|
|
17730
17805
|
if (!tokenBalances) return [];
|
|
17731
17806
|
return tokenBalances.filter((tb) => tb.token.type === "ERC-20").map((tb) => tb.token.address_hash);
|
|
17732
17807
|
}, [tokenBalances]);
|
|
@@ -17770,7 +17845,7 @@ function useBlockscoutAssets(options) {
|
|
|
17770
17845
|
gcTime: BLOCKSCOUT_QUERY_GC_TIME,
|
|
17771
17846
|
retry: 1
|
|
17772
17847
|
});
|
|
17773
|
-
const assets = (0,
|
|
17848
|
+
const assets = (0, import_react59.useMemo)(() => {
|
|
17774
17849
|
const result = [];
|
|
17775
17850
|
const addedAddresses = /* @__PURE__ */ new Set();
|
|
17776
17851
|
if (nativeBalanceData) {
|
|
@@ -17816,7 +17891,7 @@ function useBlockscoutAssets(options) {
|
|
|
17816
17891
|
}
|
|
17817
17892
|
return result;
|
|
17818
17893
|
}, [nativeBalanceData, tokenBalances, nftItems, erc3643Results, watchTokenAssets, chainConfig]);
|
|
17819
|
-
const nativeBalance = (0,
|
|
17894
|
+
const nativeBalance = (0, import_react59.useMemo)(() => {
|
|
17820
17895
|
if (!nativeBalanceData) return null;
|
|
17821
17896
|
return {
|
|
17822
17897
|
value: nativeBalanceData.value,
|
|
@@ -17824,11 +17899,11 @@ function useBlockscoutAssets(options) {
|
|
|
17824
17899
|
symbol: nativeBalanceData.symbol
|
|
17825
17900
|
};
|
|
17826
17901
|
}, [nativeBalanceData]);
|
|
17827
|
-
const error = (0,
|
|
17902
|
+
const error = (0, import_react59.useMemo)(() => {
|
|
17828
17903
|
if (!tokensError) return null;
|
|
17829
17904
|
return createError(tokensError);
|
|
17830
17905
|
}, [tokensError]);
|
|
17831
|
-
const refreshBalances = (0,
|
|
17906
|
+
const refreshBalances = (0, import_react59.useCallback)(async () => {
|
|
17832
17907
|
const now = Date.now();
|
|
17833
17908
|
if (now - lastRefreshRef.current < BLOCKSCOUT_REFRESH_DEBOUNCE) {
|
|
17834
17909
|
return;
|
|
@@ -17845,7 +17920,7 @@ function useBlockscoutAssets(options) {
|
|
|
17845
17920
|
qc.invalidateQueries({ queryKey: [WATCH_TOKENS_QUERY_KEY] })
|
|
17846
17921
|
]);
|
|
17847
17922
|
}, [qc]);
|
|
17848
|
-
const getTokenBalance = (0,
|
|
17923
|
+
const getTokenBalance = (0, import_react59.useCallback)(
|
|
17849
17924
|
(tokenAddress) => {
|
|
17850
17925
|
return assets.find((a) => a.address?.toLowerCase() === tokenAddress.toLowerCase()) || null;
|
|
17851
17926
|
},
|
|
@@ -17855,6 +17930,7 @@ function useBlockscoutAssets(options) {
|
|
|
17855
17930
|
nativeBalance,
|
|
17856
17931
|
assets,
|
|
17857
17932
|
isLoading: nativeLoading || tokensLoading || nftsLoading || watchTokensLoading,
|
|
17933
|
+
isFetching: nativeFetching || tokensFetching || nftsFetching || watchTokensFetching,
|
|
17858
17934
|
isInitialLoading: nativeLoading && !nativeBalanceData,
|
|
17859
17935
|
error,
|
|
17860
17936
|
isBlockscoutAvailable: !!blockscoutClient && !tokensError,
|
|
@@ -17863,13 +17939,13 @@ function useBlockscoutAssets(options) {
|
|
|
17863
17939
|
lastUpdated: dataUpdatedAt || null
|
|
17864
17940
|
};
|
|
17865
17941
|
}
|
|
17866
|
-
var import_clients2, import_react_query37,
|
|
17942
|
+
var import_clients2, import_react_query37, import_react59, import_viem7, NATIVE_BALANCE_QUERY_KEY, BLOCKSCOUT_QUERY_KEY, ERC3643_DETECTION_QUERY_KEY, ERC3643_ABI;
|
|
17867
17943
|
var init_useBlockscoutAssets = __esm({
|
|
17868
17944
|
"src/internal/hooks/useBlockscoutAssets.ts"() {
|
|
17869
17945
|
init_ProviderContext();
|
|
17870
17946
|
import_clients2 = require("@embarkai/core/clients");
|
|
17871
17947
|
import_react_query37 = require("@tanstack/react-query");
|
|
17872
|
-
|
|
17948
|
+
import_react59 = require("react");
|
|
17873
17949
|
import_viem7 = require("viem");
|
|
17874
17950
|
init_initial();
|
|
17875
17951
|
init_constants();
|
|
@@ -18160,23 +18236,24 @@ function PortfolioMenu() {
|
|
|
18160
18236
|
const { t } = useT();
|
|
18161
18237
|
const qc = (0, import_react_query39.useQueryClient)();
|
|
18162
18238
|
const address = useSession((st) => st.address);
|
|
18163
|
-
const
|
|
18239
|
+
const chainConfig = useSession((st) => st.chainConfig);
|
|
18164
18240
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
18165
18241
|
const {
|
|
18166
18242
|
assets: blockscoutAssets,
|
|
18167
18243
|
refreshBalances: refreshBlockscoutBalances,
|
|
18168
18244
|
isLoading: isBlockscoutLoading,
|
|
18245
|
+
isFetching: isBlockscoutFetching,
|
|
18169
18246
|
error: blockscoutError,
|
|
18170
18247
|
isBlockscoutAvailable
|
|
18171
18248
|
} = useBlockscoutAssets({
|
|
18172
18249
|
address,
|
|
18173
18250
|
enabled: !!address
|
|
18174
18251
|
});
|
|
18175
|
-
const
|
|
18176
|
-
const refreshAllAssetsBalances = (0,
|
|
18177
|
-
Promise.all(
|
|
18252
|
+
const shownProjectAssets = projectAssets.filter((asset) => !asset.hideInPortfolio);
|
|
18253
|
+
const refreshAllAssetsBalances = (0, import_react60.useCallback)(() => {
|
|
18254
|
+
Promise.all(shownProjectAssets.map((asset) => qc.invalidateQueries({ queryKey: asset.balanceQueryKey })));
|
|
18178
18255
|
refreshBlockscoutBalances();
|
|
18179
|
-
}, [qc,
|
|
18256
|
+
}, [qc, shownProjectAssets, refreshBlockscoutBalances]);
|
|
18180
18257
|
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
18181
18258
|
"div",
|
|
18182
18259
|
{
|
|
@@ -18187,7 +18264,16 @@ function PortfolioMenu() {
|
|
|
18187
18264
|
className: "list-scrollbar-y w-full p-[var(--ui-kit-pd)]",
|
|
18188
18265
|
children: /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(Expandable, { isExpanded: true, contentClassName: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: [
|
|
18189
18266
|
/* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "flex items-center gap-[var(--ui-kit-gap)]", children: [
|
|
18190
|
-
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
18267
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
18268
|
+
Button,
|
|
18269
|
+
{
|
|
18270
|
+
variant: "ghost",
|
|
18271
|
+
size: "icon",
|
|
18272
|
+
title: "Back",
|
|
18273
|
+
onClick: () => useLayoutDataStore.getState().setPage("main-menu" /* MAIN_MENU */),
|
|
18274
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react50.ArrowLeft, { className: "h-4 w-4" })
|
|
18275
|
+
}
|
|
18276
|
+
),
|
|
18191
18277
|
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "text-xl font-semibold", children: t("passport:portfolioMenu.title") }),
|
|
18192
18278
|
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
18193
18279
|
Button,
|
|
@@ -18196,8 +18282,8 @@ function PortfolioMenu() {
|
|
|
18196
18282
|
variant: "ghost",
|
|
18197
18283
|
size: "icon",
|
|
18198
18284
|
onClick: refreshAllAssetsBalances,
|
|
18199
|
-
disabled: isBlockscoutLoading,
|
|
18200
|
-
children: isBlockscoutLoading ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react50.Loader, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react50.RefreshCw, { className: "h-4 w-4" })
|
|
18285
|
+
disabled: isBlockscoutLoading || isBlockscoutFetching,
|
|
18286
|
+
children: isBlockscoutLoading || isBlockscoutFetching ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react50.Loader, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react50.RefreshCw, { className: "h-4 w-4" })
|
|
18201
18287
|
}
|
|
18202
18288
|
)
|
|
18203
18289
|
] }),
|
|
@@ -18206,7 +18292,7 @@ function PortfolioMenu() {
|
|
|
18206
18292
|
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react50.Gem, { className: "w-8 h-8" }),
|
|
18207
18293
|
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "block", children: t("passport:portfolioMenu.noAssets") })
|
|
18208
18294
|
] }),
|
|
18209
|
-
!isBlockscoutLoading &&
|
|
18295
|
+
!isBlockscoutLoading && shownProjectAssets?.map((asset, index) => /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(PortfolioItem, { isProjectAsset: true, address, asset }, `project-${asset.symbol}-${index}`)),
|
|
18210
18296
|
!isBlockscoutLoading && blockscoutAssets?.length > 0 && blockscoutAssets.map((asset, index) => /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
18211
18297
|
PortfolioItem,
|
|
18212
18298
|
{
|
|
@@ -18215,15 +18301,17 @@ function PortfolioMenu() {
|
|
|
18215
18301
|
},
|
|
18216
18302
|
`${asset.type}-${asset.address || "native"}-${asset.tokenId || index}`
|
|
18217
18303
|
)),
|
|
18218
|
-
|
|
18219
|
-
|
|
18220
|
-
|
|
18221
|
-
|
|
18304
|
+
!isBlockscoutAvailable && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Highlight, {
|
|
18305
|
+
type: "warning",
|
|
18306
|
+
//@ts-expect-error i18n typings
|
|
18307
|
+
children: t("passport:portfolioMenu.noBlockscout", { chain: chainConfig?.name?.toUpperCase() || "UNKNOWN" })
|
|
18308
|
+
}),
|
|
18309
|
+
blockscoutError && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Highlight, { type: "error", children: blockscoutError?.message })
|
|
18222
18310
|
] })
|
|
18223
18311
|
}
|
|
18224
18312
|
);
|
|
18225
18313
|
}
|
|
18226
|
-
var import_react_query39, import_lucide_react50,
|
|
18314
|
+
var import_react_query39, import_lucide_react50, import_react60, import_jsx_runtime83;
|
|
18227
18315
|
var init_PortfolioMenu = __esm({
|
|
18228
18316
|
"src/internal/components/PortfolioMenu/PortfolioMenu.tsx"() {
|
|
18229
18317
|
init_ProviderContext();
|
|
@@ -18231,7 +18319,7 @@ var init_PortfolioMenu = __esm({
|
|
|
18231
18319
|
init_i18n();
|
|
18232
18320
|
import_react_query39 = require("@tanstack/react-query");
|
|
18233
18321
|
import_lucide_react50 = require("lucide-react");
|
|
18234
|
-
|
|
18322
|
+
import_react60 = require("react");
|
|
18235
18323
|
init_useBlockscoutAssets();
|
|
18236
18324
|
init_useLayoutDataStore();
|
|
18237
18325
|
init_useLayoutStore();
|
|
@@ -18340,10 +18428,10 @@ function ReceiveMenu() {
|
|
|
18340
18428
|
const { t } = useT();
|
|
18341
18429
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
18342
18430
|
const open = page === "receive";
|
|
18343
|
-
const [qrCodeUrl, setQrCodeUrl] = (0,
|
|
18344
|
-
const [copied, setCopied] = (0,
|
|
18345
|
-
const [fingerprintCopied, setFingerprintCopied] = (0,
|
|
18346
|
-
const fingerprint = (0,
|
|
18431
|
+
const [qrCodeUrl, setQrCodeUrl] = (0, import_react61.useState)("");
|
|
18432
|
+
const [copied, setCopied] = (0, import_react61.useState)(false);
|
|
18433
|
+
const [fingerprintCopied, setFingerprintCopied] = (0, import_react61.useState)(false);
|
|
18434
|
+
const fingerprint = (0, import_react61.useMemo)(() => {
|
|
18347
18435
|
if (!session?.ownerAddress) return null;
|
|
18348
18436
|
try {
|
|
18349
18437
|
return generateFingerprint(session.ownerAddress);
|
|
@@ -18351,7 +18439,7 @@ function ReceiveMenu() {
|
|
|
18351
18439
|
return null;
|
|
18352
18440
|
}
|
|
18353
18441
|
}, [session?.ownerAddress]);
|
|
18354
|
-
(0,
|
|
18442
|
+
(0, import_react61.useEffect)(() => {
|
|
18355
18443
|
if (open && address) {
|
|
18356
18444
|
import_qrcode.default.toDataURL(address, {
|
|
18357
18445
|
width: 200,
|
|
@@ -18364,7 +18452,7 @@ function ReceiveMenu() {
|
|
|
18364
18452
|
});
|
|
18365
18453
|
}
|
|
18366
18454
|
}, [open, address]);
|
|
18367
|
-
const handleCopy = (0,
|
|
18455
|
+
const handleCopy = (0, import_react61.useCallback)(async () => {
|
|
18368
18456
|
if (!address) return;
|
|
18369
18457
|
try {
|
|
18370
18458
|
await navigator.clipboard.writeText(address);
|
|
@@ -18374,7 +18462,7 @@ function ReceiveMenu() {
|
|
|
18374
18462
|
console.error("Failed to copy address:", error);
|
|
18375
18463
|
}
|
|
18376
18464
|
}, [address]);
|
|
18377
|
-
const handleCopyFingerprint = (0,
|
|
18465
|
+
const handleCopyFingerprint = (0, import_react61.useCallback)(async () => {
|
|
18378
18466
|
if (!fingerprint) return;
|
|
18379
18467
|
try {
|
|
18380
18468
|
await navigator.clipboard.writeText(fingerprint);
|
|
@@ -18435,14 +18523,14 @@ function ReceiveMenu() {
|
|
|
18435
18523
|
}
|
|
18436
18524
|
);
|
|
18437
18525
|
}
|
|
18438
|
-
var import_lucide_react51, import_qrcode,
|
|
18526
|
+
var import_lucide_react51, import_qrcode, import_react61, import_jsx_runtime84;
|
|
18439
18527
|
var init_ReceiveMenu = __esm({
|
|
18440
18528
|
"src/internal/components/ReceiveMenu/ReceiveMenu.tsx"() {
|
|
18441
18529
|
init_SessionContext();
|
|
18442
18530
|
init_i18n();
|
|
18443
18531
|
import_lucide_react51 = require("lucide-react");
|
|
18444
18532
|
import_qrcode = __toESM(require("qrcode"), 1);
|
|
18445
|
-
|
|
18533
|
+
import_react61 = require("react");
|
|
18446
18534
|
init_useLayoutDataStore();
|
|
18447
18535
|
init_useLayoutStore();
|
|
18448
18536
|
init_nickname_fingerprint();
|
|
@@ -18459,6 +18547,24 @@ var init_ReceiveMenu2 = __esm({
|
|
|
18459
18547
|
}
|
|
18460
18548
|
});
|
|
18461
18549
|
|
|
18550
|
+
// src/internal/components/SecurityMenu/useSecurityStore.ts
|
|
18551
|
+
var import_lodash_es11, import_zustand10, useSecurityStore;
|
|
18552
|
+
var init_useSecurityStore = __esm({
|
|
18553
|
+
"src/internal/components/SecurityMenu/useSecurityStore.ts"() {
|
|
18554
|
+
import_lodash_es11 = require("lodash-es");
|
|
18555
|
+
import_zustand10 = require("zustand");
|
|
18556
|
+
useSecurityStore = (0, import_zustand10.create)((set) => ({
|
|
18557
|
+
renderKey: "security-store",
|
|
18558
|
+
setRenderKey: (0, import_lodash_es11.debounce)((renderKey) => {
|
|
18559
|
+
console.log("[SecurityMenu] Setting render key:", renderKey);
|
|
18560
|
+
set({ renderKey });
|
|
18561
|
+
}, 200),
|
|
18562
|
+
appToUntrust: null,
|
|
18563
|
+
untrustApp: (app) => set({ appToUntrust: app })
|
|
18564
|
+
}));
|
|
18565
|
+
}
|
|
18566
|
+
});
|
|
18567
|
+
|
|
18462
18568
|
// src/internal/components/SecurityMenu/constants.ts
|
|
18463
18569
|
var KEYSHARE_RECOVERY_STATS_QUERY, CONNECTED_TRUSTED_APPS_QUERY;
|
|
18464
18570
|
var init_constants5 = __esm({
|
|
@@ -18468,7 +18574,7 @@ var init_constants5 = __esm({
|
|
|
18468
18574
|
}
|
|
18469
18575
|
});
|
|
18470
18576
|
|
|
18471
|
-
// src/internal/components/SecurityMenu/
|
|
18577
|
+
// src/internal/components/SecurityMenu/ConnectedApps/useConnectedApps.ts
|
|
18472
18578
|
function useConnectedApps() {
|
|
18473
18579
|
const session = useSession((st) => st.session);
|
|
18474
18580
|
const userId = session?.mpcUserId || null;
|
|
@@ -18485,44 +18591,29 @@ function useConnectedApps() {
|
|
|
18485
18591
|
}
|
|
18486
18592
|
});
|
|
18487
18593
|
}
|
|
18488
|
-
function useKeyshareRecoveryStats() {
|
|
18489
|
-
const session = useSession((st) => st.session);
|
|
18490
|
-
const userId = session?.mpcUserId || null;
|
|
18491
|
-
return (0, import_react_query40.useQuery)({
|
|
18492
|
-
enabled: !!userId,
|
|
18493
|
-
queryKey: [KEYSHARE_RECOVERY_STATS_QUERY, userId],
|
|
18494
|
-
queryFn: async () => {
|
|
18495
|
-
const iframeManager = getIframeManager();
|
|
18496
|
-
if (!iframeManager) {
|
|
18497
|
-
throw new Error("Iframe manager not available");
|
|
18498
|
-
}
|
|
18499
|
-
const keyshareInfo = await getKeyshareInfo(userId);
|
|
18500
|
-
const shareRecoveryStats = await getShareRecoveryStats();
|
|
18501
|
-
return {
|
|
18502
|
-
keyshareInfo,
|
|
18503
|
-
shareRecoveryStats
|
|
18504
|
-
};
|
|
18505
|
-
}
|
|
18506
|
-
});
|
|
18507
|
-
}
|
|
18508
18594
|
var import_react_query40;
|
|
18509
|
-
var
|
|
18510
|
-
"src/internal/components/SecurityMenu/
|
|
18595
|
+
var init_useConnectedApps = __esm({
|
|
18596
|
+
"src/internal/components/SecurityMenu/ConnectedApps/useConnectedApps.ts"() {
|
|
18511
18597
|
init_SessionContext();
|
|
18512
18598
|
import_react_query40 = require("@tanstack/react-query");
|
|
18513
|
-
init_keyshare();
|
|
18514
18599
|
init_httpClient();
|
|
18515
|
-
init_iframe_manager();
|
|
18516
|
-
init_vaultClient();
|
|
18517
18600
|
init_constants5();
|
|
18518
18601
|
}
|
|
18519
18602
|
});
|
|
18520
18603
|
|
|
18521
|
-
// src/internal/components/SecurityMenu/ConnectedApps.tsx
|
|
18604
|
+
// src/internal/components/SecurityMenu/ConnectedApps/ConnectedApps.tsx
|
|
18522
18605
|
function Application(props) {
|
|
18523
|
-
const {
|
|
18606
|
+
const {
|
|
18607
|
+
projectId,
|
|
18608
|
+
appUrl = null,
|
|
18609
|
+
//
|
|
18610
|
+
logo,
|
|
18611
|
+
name,
|
|
18612
|
+
trustedAuthorizedApp,
|
|
18613
|
+
firstConnectedAt
|
|
18614
|
+
// untrustApp
|
|
18615
|
+
} = props;
|
|
18524
18616
|
const { t } = useT();
|
|
18525
|
-
const projectUrl = appUrl || null;
|
|
18526
18617
|
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
|
|
18527
18618
|
"div",
|
|
18528
18619
|
{
|
|
@@ -18531,14 +18622,14 @@ function Application(props) {
|
|
|
18531
18622
|
"select-none text-[10px] leading-tight",
|
|
18532
18623
|
"p-2 rounded-[var(--ui-kit-el-bdrs)] bg-[var(--ui-kit-secondary)]",
|
|
18533
18624
|
{
|
|
18534
|
-
"cursor-default": !
|
|
18535
|
-
"cursor-pointer transition-colors duration-200": !!
|
|
18536
|
-
"hover:bg-[var(--ui-kit-secondary-h)] active:bg-[var(--ui-kit-secondary-a)]": !!
|
|
18625
|
+
"cursor-default": !appUrl,
|
|
18626
|
+
"cursor-pointer transition-colors duration-200": !!appUrl,
|
|
18627
|
+
"hover:bg-[var(--ui-kit-secondary-h)] active:bg-[var(--ui-kit-secondary-a)]": !!appUrl
|
|
18537
18628
|
}
|
|
18538
18629
|
),
|
|
18539
18630
|
onClick: () => {
|
|
18540
|
-
if (!
|
|
18541
|
-
window.open(
|
|
18631
|
+
if (!appUrl) return;
|
|
18632
|
+
window.open(appUrl, "_blank", "noopener,noreferrer");
|
|
18542
18633
|
},
|
|
18543
18634
|
children: [
|
|
18544
18635
|
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
|
|
@@ -18568,9 +18659,9 @@ function Application(props) {
|
|
|
18568
18659
|
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
18569
18660
|
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("span", { className: "flex flex-col", children: [
|
|
18570
18661
|
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "text-sm font-semibold truncate", children: name }),
|
|
18571
|
-
|
|
18662
|
+
appUrl && /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("span", { className: "flex items-center gap-[var(--ui-kit-gap)]", children: [
|
|
18572
18663
|
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_lucide_react52.ExternalLinkIcon, { className: "w-3 h-3 flex-none", strokeWidth: 1 }),
|
|
18573
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "flex-1 truncate", children: new URL(
|
|
18664
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "flex-1 truncate", children: new URL(appUrl).hostname })
|
|
18574
18665
|
] })
|
|
18575
18666
|
] }),
|
|
18576
18667
|
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "text-[var(--ui-kit-fg-muted)] truncate", children: t(
|
|
@@ -18591,10 +18682,10 @@ function Application(props) {
|
|
|
18591
18682
|
),
|
|
18592
18683
|
onClick: (e) => {
|
|
18593
18684
|
e.stopPropagation();
|
|
18594
|
-
untrustApp({
|
|
18685
|
+
useSecurityStore.getState().untrustApp({
|
|
18595
18686
|
projectId,
|
|
18596
|
-
origin:
|
|
18597
|
-
hostname:
|
|
18687
|
+
origin: appUrl || void 0,
|
|
18688
|
+
hostname: appUrl ? new URL(appUrl).hostname : void 0,
|
|
18598
18689
|
appName: name,
|
|
18599
18690
|
appLogo: logo
|
|
18600
18691
|
});
|
|
@@ -18606,50 +18697,156 @@ function Application(props) {
|
|
|
18606
18697
|
}
|
|
18607
18698
|
);
|
|
18608
18699
|
}
|
|
18609
|
-
function ConnectedApps(
|
|
18610
|
-
const { isLoading: isParentLoading, untrustApp } = props;
|
|
18700
|
+
function ConnectedApps() {
|
|
18611
18701
|
const { t } = useT();
|
|
18612
18702
|
const { data: connectedApps = [], isLoading: isConnectedAppsLoading } = useConnectedApps();
|
|
18613
|
-
|
|
18614
|
-
|
|
18615
|
-
|
|
18703
|
+
(0, import_react62.useEffect)(() => {
|
|
18704
|
+
if (!connectedApps.length || isConnectedAppsLoading) return;
|
|
18705
|
+
useSecurityStore.getState().setRenderKey(`connected-apps-loaded-${Date.now()}`);
|
|
18706
|
+
}, [connectedApps, isConnectedAppsLoading]);
|
|
18707
|
+
if (!isConnectedAppsLoading && connectedApps.length === 0)
|
|
18616
18708
|
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(Highlight, { type: "info", className: "flex gap-[var(--ui-kit-gap)] ", children: [
|
|
18617
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_lucide_react52.
|
|
18709
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_lucide_react52.InfoIcon, { className: "w-4 h-4" }),
|
|
18618
18710
|
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { children: t("passport:securityMenu.connectedApps.noConnectedApps") })
|
|
18619
18711
|
] });
|
|
18620
18712
|
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(import_jsx_runtime85.Fragment, { children: [
|
|
18621
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.
|
|
18622
|
-
|
|
18623
|
-
|
|
18624
|
-
|
|
18625
|
-
|
|
18626
|
-
untrustApp
|
|
18627
|
-
},
|
|
18628
|
-
index
|
|
18629
|
-
)) })
|
|
18713
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "flex items-center justify-between gap-[var(--ui-kit-gap)]", children: [
|
|
18714
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "leading-4 text-xs", children: t("passport:securityMenu.connectedApps.connectedApps") }),
|
|
18715
|
+
isConnectedAppsLoading && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_lucide_react52.LoaderIcon, { className: "h-4 w-4 animate-spin" })
|
|
18716
|
+
] }),
|
|
18717
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: connectedApps.map((app, index) => /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Application, { ...app }, index)) })
|
|
18630
18718
|
] });
|
|
18631
18719
|
}
|
|
18632
|
-
var import_dayjs5, import_lucide_react52, import_jsx_runtime85;
|
|
18720
|
+
var import_dayjs5, import_lucide_react52, import_react62, import_jsx_runtime85;
|
|
18633
18721
|
var init_ConnectedApps = __esm({
|
|
18634
|
-
"src/internal/components/SecurityMenu/ConnectedApps.tsx"() {
|
|
18722
|
+
"src/internal/components/SecurityMenu/ConnectedApps/ConnectedApps.tsx"() {
|
|
18635
18723
|
init_utils2();
|
|
18636
18724
|
init_i18n();
|
|
18637
18725
|
import_dayjs5 = __toESM(require("dayjs"), 1);
|
|
18638
18726
|
import_lucide_react52 = require("lucide-react");
|
|
18727
|
+
import_react62 = require("react");
|
|
18639
18728
|
init_button();
|
|
18640
18729
|
init_highlight();
|
|
18641
|
-
|
|
18730
|
+
init_useSecurityStore();
|
|
18731
|
+
init_useConnectedApps();
|
|
18642
18732
|
import_jsx_runtime85 = require("react/jsx-runtime");
|
|
18643
18733
|
}
|
|
18644
18734
|
});
|
|
18645
18735
|
|
|
18736
|
+
// src/internal/components/SecurityMenu/ConnectedApps/UntrustApplication.tsx
|
|
18737
|
+
function UntrustApplication() {
|
|
18738
|
+
const { t } = useT();
|
|
18739
|
+
const qc = (0, import_react_query41.useQueryClient)();
|
|
18740
|
+
const userId = useSession((st) => st?.session?.mpcUserId);
|
|
18741
|
+
const appToUntrust = useSecurityStore((st) => st.appToUntrust);
|
|
18742
|
+
const { mutate: handleUntrustApp, isPending: isUntrustingApp } = (0, import_react_query41.useMutation)({
|
|
18743
|
+
mutationFn: async () => {
|
|
18744
|
+
if (!userId || !appToUntrust) return;
|
|
18745
|
+
const iframeManager = getIframeManager();
|
|
18746
|
+
if (!iframeManager) {
|
|
18747
|
+
throw new Error("Iframe manager not available");
|
|
18748
|
+
}
|
|
18749
|
+
return await iframeManager.removeTrustedApp(userId, appToUntrust.projectId, appToUntrust.origin);
|
|
18750
|
+
},
|
|
18751
|
+
onSuccess: (success) => {
|
|
18752
|
+
if (!success) {
|
|
18753
|
+
console.error("[SecurityMenu] Failed to remove trusted app from iframe");
|
|
18754
|
+
return;
|
|
18755
|
+
}
|
|
18756
|
+
qc.invalidateQueries({ queryKey: [CONNECTED_TRUSTED_APPS_QUERY, userId] });
|
|
18757
|
+
useSecurityStore.getState().untrustApp(null);
|
|
18758
|
+
},
|
|
18759
|
+
onError: (error) => {
|
|
18760
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
18761
|
+
console.error("[SecurityMenu] Error removing trusted app:", errorMessage);
|
|
18762
|
+
}
|
|
18763
|
+
});
|
|
18764
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "flex flex-col gap-[var(--ui-kit-gap)]", children: [
|
|
18765
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(Highlight, { className: "flex flex-col gap-[var(--ui-kit-gap)]", type: "warning", children: [
|
|
18766
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("span", { className: "text-sm leading-5 font-bold", children: [
|
|
18767
|
+
t("passport:securityMenu.connectedApps.untrustApp"),
|
|
18768
|
+
"?"
|
|
18769
|
+
] }),
|
|
18770
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "w-full flex items-center justify-center gap-[var(--ui-kit-gap)]", children: [
|
|
18771
|
+
appToUntrust.appLogo ? /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "w-12 h-12 rounded-[var(--ui-kit-el-bdrs)] bg-[var(--ui-kit-bg)] flex-shrink-0 p-1", children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("img", { src: appToUntrust.appLogo, alt: appToUntrust.appName, className: "w-full h-full object-contain" }) }) : /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "w-12 h-12 rounded-[var(--ui-kit-el-bdrs)] bg-[var(--ui-kit-bg)] flex items-center justify-center flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react53.AppWindowMac, { className: "w-6 h-6" }) }),
|
|
18772
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "flex-1 text-left", children: [
|
|
18773
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "font-medium", children: appToUntrust.appName }),
|
|
18774
|
+
appToUntrust.hostname && /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "text-[10px]", children: [
|
|
18775
|
+
"(",
|
|
18776
|
+
appToUntrust.hostname,
|
|
18777
|
+
")"
|
|
18778
|
+
] })
|
|
18779
|
+
] })
|
|
18780
|
+
] })
|
|
18781
|
+
] }),
|
|
18782
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "text-[10px] text-[var(--ui-kit-fg-muted)] text-left space-y-1", children: [
|
|
18783
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("p", { children: [
|
|
18784
|
+
t("passport:securityMenu.connectedApps.removalNoteTitle"),
|
|
18785
|
+
":"
|
|
18786
|
+
] }),
|
|
18787
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("ul", { className: "list-disc list-inside ml-2 space-y-0.5", children: [
|
|
18788
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("li", { children: t("passport:securityMenu.connectedApps.removalNoteMsg1") }),
|
|
18789
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("li", { children: t("passport:securityMenu.connectedApps.removalNoteMsg2") })
|
|
18790
|
+
] })
|
|
18791
|
+
] }),
|
|
18792
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "w-full flex gap-[var(--ui-kit-gap)]", children: [
|
|
18793
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
18794
|
+
Button,
|
|
18795
|
+
{
|
|
18796
|
+
variant: "outline",
|
|
18797
|
+
size: "large",
|
|
18798
|
+
className: "flex-1",
|
|
18799
|
+
onClick: () => useSecurityStore.getState().untrustApp(null),
|
|
18800
|
+
disabled: isUntrustingApp,
|
|
18801
|
+
children: t("passport:common.cancel")
|
|
18802
|
+
}
|
|
18803
|
+
),
|
|
18804
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
18805
|
+
Button,
|
|
18806
|
+
{
|
|
18807
|
+
variant: "default",
|
|
18808
|
+
size: "large",
|
|
18809
|
+
className: "flex-1",
|
|
18810
|
+
onClick: () => handleUntrustApp(),
|
|
18811
|
+
disabled: isUntrustingApp,
|
|
18812
|
+
children: isUntrustingApp ? /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react53.Loader, { className: "h-4 w-4 animate-spin" }) : t("passport:common.delete")
|
|
18813
|
+
}
|
|
18814
|
+
)
|
|
18815
|
+
] })
|
|
18816
|
+
] });
|
|
18817
|
+
}
|
|
18818
|
+
var import_react_query41, import_lucide_react53, import_jsx_runtime86;
|
|
18819
|
+
var init_UntrustApplication = __esm({
|
|
18820
|
+
"src/internal/components/SecurityMenu/ConnectedApps/UntrustApplication.tsx"() {
|
|
18821
|
+
init_SessionContext();
|
|
18822
|
+
init_i18n();
|
|
18823
|
+
import_react_query41 = require("@tanstack/react-query");
|
|
18824
|
+
import_lucide_react53 = require("lucide-react");
|
|
18825
|
+
init_iframe_manager();
|
|
18826
|
+
init_button();
|
|
18827
|
+
init_highlight();
|
|
18828
|
+
init_constants5();
|
|
18829
|
+
init_useSecurityStore();
|
|
18830
|
+
import_jsx_runtime86 = require("react/jsx-runtime");
|
|
18831
|
+
}
|
|
18832
|
+
});
|
|
18833
|
+
|
|
18834
|
+
// src/internal/components/SecurityMenu/ConnectedApps/index.ts
|
|
18835
|
+
var init_ConnectedApps2 = __esm({
|
|
18836
|
+
"src/internal/components/SecurityMenu/ConnectedApps/index.ts"() {
|
|
18837
|
+
init_ConnectedApps();
|
|
18838
|
+
init_UntrustApplication();
|
|
18839
|
+
init_useConnectedApps();
|
|
18840
|
+
}
|
|
18841
|
+
});
|
|
18842
|
+
|
|
18646
18843
|
// src/internal/components/SecurityMenu/Keyshare/KeyshareStatus.tsx
|
|
18647
18844
|
function KeyshareStatus(props) {
|
|
18648
18845
|
const { isLoading, content, icon: Icon2, children } = props;
|
|
18649
|
-
if (isLoading) return /* @__PURE__ */ (0,
|
|
18650
|
-
return /* @__PURE__ */ (0,
|
|
18846
|
+
if (isLoading) return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_lucide_react54.Loader, { className: "w-4 h-4 animate-spin" });
|
|
18847
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "group relative w-full h-full", children: [
|
|
18651
18848
|
children,
|
|
18652
|
-
/* @__PURE__ */ (0,
|
|
18849
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
18653
18850
|
"div",
|
|
18654
18851
|
{
|
|
18655
18852
|
className: cn(
|
|
@@ -18657,10 +18854,10 @@ function KeyshareStatus(props) {
|
|
|
18657
18854
|
"rounded-full bg-[var(--ui-kit-bg)]"
|
|
18658
18855
|
// 'border border-[var(--ui-kit-bd)]'
|
|
18659
18856
|
),
|
|
18660
|
-
children: /* @__PURE__ */ (0,
|
|
18857
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Icon2, { className: "w-4 h-4" })
|
|
18661
18858
|
}
|
|
18662
18859
|
),
|
|
18663
|
-
/* @__PURE__ */ (0,
|
|
18860
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
18664
18861
|
"div",
|
|
18665
18862
|
{
|
|
18666
18863
|
style: { transform: "translateY(calc(var(--ui-kit-gap) * -4))" },
|
|
@@ -18676,12 +18873,12 @@ function KeyshareStatus(props) {
|
|
|
18676
18873
|
)
|
|
18677
18874
|
] });
|
|
18678
18875
|
}
|
|
18679
|
-
var
|
|
18876
|
+
var import_lucide_react54, import_jsx_runtime87;
|
|
18680
18877
|
var init_KeyshareStatus = __esm({
|
|
18681
18878
|
"src/internal/components/SecurityMenu/Keyshare/KeyshareStatus.tsx"() {
|
|
18682
|
-
|
|
18879
|
+
import_lucide_react54 = require("lucide-react");
|
|
18683
18880
|
init_utils2();
|
|
18684
|
-
|
|
18881
|
+
import_jsx_runtime87 = require("react/jsx-runtime");
|
|
18685
18882
|
}
|
|
18686
18883
|
});
|
|
18687
18884
|
|
|
@@ -18711,29 +18908,29 @@ function LastBackup(props) {
|
|
|
18711
18908
|
} = createdRecoveryStats || {};
|
|
18712
18909
|
const hasBackupData = backup?.server?.enabled && backup.server.lastBackup || !backup.server.lastBackup && recoveryCreatedAt || backup.cloud.enabled && backup.cloud?.lastBackup || backup.local.enabled && backup.local.lastBackup;
|
|
18713
18910
|
if (!hasBackupData || !createdRecoveryStats) return null;
|
|
18714
|
-
return /* @__PURE__ */ (0,
|
|
18715
|
-
/* @__PURE__ */ (0,
|
|
18716
|
-
/* @__PURE__ */ (0,
|
|
18717
|
-
/* @__PURE__ */ (0,
|
|
18911
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(Highlight, { type: "info", className: "text-[10px] leading-4", children: [
|
|
18912
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("span", { className: "flex items-center gap-[var(--ui-kit-gap)]", children: [
|
|
18913
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_lucide_react55.DatabaseBackup, { className: "w-4 h-4 flex-none" }),
|
|
18914
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "font-medium text-xs", children: t("passport:securityMenu.lastBackup") })
|
|
18718
18915
|
] }),
|
|
18719
|
-
recoveryCreatedAt && /* @__PURE__ */ (0,
|
|
18720
|
-
/* @__PURE__ */ (0,
|
|
18916
|
+
recoveryCreatedAt && /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(import_jsx_runtime88.Fragment, { children: [
|
|
18917
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "block font-mono! ", children: t("passport:securityMenu.lastBackupMeta", {
|
|
18721
18918
|
browser: cleanStringArtifacts(recoveryBrowser || "unknown"),
|
|
18722
18919
|
os: parseOS(recoveryUa) || "unknown os",
|
|
18723
18920
|
deviceName: cleanStringArtifacts(recoveryDeviceName || recoveryDeviceId || "")
|
|
18724
18921
|
}) }),
|
|
18725
|
-
/* @__PURE__ */ (0,
|
|
18922
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "block font-mono! text-[var(--ui-kit-fg-muted)]", children: (0, import_dayjs6.default)(recoveryCreatedAt).format("MMMM DD, YYYY HH:mm") })
|
|
18726
18923
|
] })
|
|
18727
18924
|
] });
|
|
18728
18925
|
}
|
|
18729
|
-
var import_dayjs6,
|
|
18926
|
+
var import_dayjs6, import_lucide_react55, import_jsx_runtime88;
|
|
18730
18927
|
var init_LastBackup = __esm({
|
|
18731
18928
|
"src/internal/components/SecurityMenu/Keyshare/LastBackup.tsx"() {
|
|
18732
18929
|
init_useT();
|
|
18733
18930
|
import_dayjs6 = __toESM(require("dayjs"), 1);
|
|
18734
|
-
|
|
18931
|
+
import_lucide_react55 = require("lucide-react");
|
|
18735
18932
|
init_highlight();
|
|
18736
|
-
|
|
18933
|
+
import_jsx_runtime88 = require("react/jsx-runtime");
|
|
18737
18934
|
{
|
|
18738
18935
|
}
|
|
18739
18936
|
{
|
|
@@ -18741,86 +18938,135 @@ var init_LastBackup = __esm({
|
|
|
18741
18938
|
}
|
|
18742
18939
|
});
|
|
18743
18940
|
|
|
18744
|
-
// src/internal/components/SecurityMenu/Keyshare/
|
|
18745
|
-
function
|
|
18746
|
-
const
|
|
18747
|
-
const
|
|
18748
|
-
|
|
18749
|
-
|
|
18750
|
-
|
|
18751
|
-
|
|
18752
|
-
|
|
18753
|
-
|
|
18754
|
-
|
|
18755
|
-
|
|
18756
|
-
|
|
18757
|
-
|
|
18758
|
-
|
|
18759
|
-
|
|
18760
|
-
|
|
18761
|
-
|
|
18762
|
-
|
|
18763
|
-
|
|
18764
|
-
|
|
18765
|
-
|
|
18766
|
-
|
|
18767
|
-
|
|
18768
|
-
|
|
18769
|
-
|
|
18770
|
-
|
|
18771
|
-
|
|
18772
|
-
|
|
18773
|
-
|
|
18774
|
-
|
|
18775
|
-
|
|
18776
|
-
|
|
18777
|
-
|
|
18778
|
-
|
|
18779
|
-
|
|
18780
|
-
|
|
18781
|
-
|
|
18782
|
-
|
|
18783
|
-
|
|
18784
|
-
|
|
18785
|
-
|
|
18786
|
-
|
|
18787
|
-
|
|
18788
|
-
|
|
18789
|
-
|
|
18790
|
-
|
|
18791
|
-
|
|
18792
|
-
|
|
18793
|
-
|
|
18794
|
-
|
|
18795
|
-
icon: hasServerBackup ? PositiveIcon : NegativeIcon,
|
|
18796
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(
|
|
18797
|
-
Highlight,
|
|
18798
|
-
{
|
|
18799
|
-
type: hasServerBackup ? "success" : "warning",
|
|
18800
|
-
className: "w-full h-full flex flex-col items-center gap-0",
|
|
18801
|
-
children: [
|
|
18802
|
-
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_lucide_react55.Server, { className: "h-6 w-6" }),
|
|
18803
|
-
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "text-[10px] font-medium leading-4", children: "Vault Backup" })
|
|
18804
|
-
]
|
|
18805
|
-
}
|
|
18806
|
-
)
|
|
18807
|
-
}
|
|
18808
|
-
)
|
|
18941
|
+
// src/internal/components/SecurityMenu/Keyshare/useKeyshareRecoveryStats.ts
|
|
18942
|
+
function useKeyshareRecoveryStats() {
|
|
18943
|
+
const session = useSession((st) => st.session);
|
|
18944
|
+
const userId = session?.mpcUserId || null;
|
|
18945
|
+
return (0, import_react_query42.useQuery)({
|
|
18946
|
+
enabled: !!userId,
|
|
18947
|
+
queryKey: [KEYSHARE_RECOVERY_STATS_QUERY, userId],
|
|
18948
|
+
queryFn: async () => {
|
|
18949
|
+
const iframeManager = getIframeManager();
|
|
18950
|
+
if (!iframeManager) {
|
|
18951
|
+
throw new Error("Iframe manager not available");
|
|
18952
|
+
}
|
|
18953
|
+
const keyshareInfo = await getKeyshareInfo(userId);
|
|
18954
|
+
const shareRecoveryStats = await getShareRecoveryStats();
|
|
18955
|
+
return {
|
|
18956
|
+
keyshareInfo,
|
|
18957
|
+
shareRecoveryStats
|
|
18958
|
+
};
|
|
18959
|
+
}
|
|
18960
|
+
});
|
|
18961
|
+
}
|
|
18962
|
+
var import_react_query42;
|
|
18963
|
+
var init_useKeyshareRecoveryStats = __esm({
|
|
18964
|
+
"src/internal/components/SecurityMenu/Keyshare/useKeyshareRecoveryStats.ts"() {
|
|
18965
|
+
init_SessionContext();
|
|
18966
|
+
import_react_query42 = require("@tanstack/react-query");
|
|
18967
|
+
init_keyshare();
|
|
18968
|
+
init_iframe_manager();
|
|
18969
|
+
init_vaultClient();
|
|
18970
|
+
init_constants5();
|
|
18971
|
+
}
|
|
18972
|
+
});
|
|
18973
|
+
|
|
18974
|
+
// src/internal/components/SecurityMenu/Keyshare/Keyshare.tsx
|
|
18975
|
+
function Keyshare() {
|
|
18976
|
+
const userId = useSession((st) => st?.session?.mpcUserId);
|
|
18977
|
+
const { t } = useT();
|
|
18978
|
+
const serverHasKeyshare = import_auth23.jwtTokenManager.getHasKeyshare() ?? false;
|
|
18979
|
+
const { data: recoveryData, isLoading: isRecoveryLoading } = useKeyshareRecoveryStats();
|
|
18980
|
+
(0, import_react63.useEffect)(() => {
|
|
18981
|
+
if (!recoveryData?.keyshareInfo || isRecoveryLoading) return;
|
|
18982
|
+
useSecurityStore.getState().setRenderKey(`keyshare-loaded-${Date.now()}`);
|
|
18983
|
+
}, [recoveryData, isRecoveryLoading]);
|
|
18984
|
+
const localInfo = recoveryData?.keyshareInfo || {};
|
|
18985
|
+
const hasServerBackup = !!recoveryData?.shareRecoveryStats?.created || recoveryData?.shareRecoveryStats?.devices?.length > 0;
|
|
18986
|
+
const backup = userId ? getBackupStatus(userId) : { server: { enabled: false }, cloud: { enabled: false }, local: { enabled: false } };
|
|
18987
|
+
const createdRecoveryStats = recoveryData?.shareRecoveryStats?.created;
|
|
18988
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(import_jsx_runtime89.Fragment, { children: [
|
|
18989
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "flex items-center justify-between gap-[var(--ui-kit-gap)]", children: [
|
|
18990
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { className: "text-xs leading-4", children: t("passport:securityMenu.keyshareStatus.title") }),
|
|
18991
|
+
isRecoveryLoading && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_lucide_react56.LoaderIcon, { className: "h-4 w-4 animate-spin" })
|
|
18809
18992
|
] }),
|
|
18810
|
-
/* @__PURE__ */ (0,
|
|
18993
|
+
!isRecoveryLoading && /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(import_jsx_runtime89.Fragment, { children: [
|
|
18994
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "grid grid-cols-3 gap-[var(--ui-kit-gap)] px-[var(--ui-kit-gap)]", children: [
|
|
18995
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
18996
|
+
KeyshareStatus,
|
|
18997
|
+
{
|
|
18998
|
+
content: serverHasKeyshare ? t("passport:securityMenu.keyshareStatus.serverReady") : t("passport:securityMenu.keyshareStatus.serverMissing"),
|
|
18999
|
+
icon: serverHasKeyshare ? PositiveIcon : NegativeIcon,
|
|
19000
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(
|
|
19001
|
+
Highlight,
|
|
19002
|
+
{
|
|
19003
|
+
type: serverHasKeyshare ? "success" : "warning",
|
|
19004
|
+
className: "w-full h-full flex flex-col items-center gap-0",
|
|
19005
|
+
children: [
|
|
19006
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_lucide_react56.Cloud, { className: "h-6 w-6" }),
|
|
19007
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { className: "text-[10px] font-medium leading-4", children: "Server Share" })
|
|
19008
|
+
]
|
|
19009
|
+
}
|
|
19010
|
+
)
|
|
19011
|
+
}
|
|
19012
|
+
),
|
|
19013
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
19014
|
+
KeyshareStatus,
|
|
19015
|
+
{
|
|
19016
|
+
content: localInfo?.hasKeyshare ? t("passport:securityMenu.keyshareStatus.localReady") : t("passport:securityMenu.keyshareStatus.localMissing"),
|
|
19017
|
+
icon: localInfo?.hasKeyshare ? PositiveIcon : NegativeIcon,
|
|
19018
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(
|
|
19019
|
+
Highlight,
|
|
19020
|
+
{
|
|
19021
|
+
type: localInfo?.hasKeyshare ? "success" : "warning",
|
|
19022
|
+
className: "w-full h-full flex flex-col items-center gap-0",
|
|
19023
|
+
children: [
|
|
19024
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_lucide_react56.Laptop, { className: "h-6 w-6" }),
|
|
19025
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { className: "text-[10px] font-medium leading-4", children: "Local Share" })
|
|
19026
|
+
]
|
|
19027
|
+
}
|
|
19028
|
+
)
|
|
19029
|
+
}
|
|
19030
|
+
),
|
|
19031
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
19032
|
+
KeyshareStatus,
|
|
19033
|
+
{
|
|
19034
|
+
content: hasServerBackup ? t("passport:securityMenu.keyshareStatus.valutBackupCreated") : t("passport:securityMenu.keyshareStatus.valutBackupMissing"),
|
|
19035
|
+
icon: hasServerBackup ? PositiveIcon : NegativeIcon,
|
|
19036
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(
|
|
19037
|
+
Highlight,
|
|
19038
|
+
{
|
|
19039
|
+
type: hasServerBackup ? "success" : "warning",
|
|
19040
|
+
className: "w-full h-full flex flex-col items-center gap-0",
|
|
19041
|
+
children: [
|
|
19042
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_lucide_react56.Server, { className: "h-6 w-6" }),
|
|
19043
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { className: "text-[10px] font-medium leading-4", children: "Vault Backup" })
|
|
19044
|
+
]
|
|
19045
|
+
}
|
|
19046
|
+
)
|
|
19047
|
+
}
|
|
19048
|
+
)
|
|
19049
|
+
] }),
|
|
19050
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(LastBackup, { backup, createdRecoveryStats })
|
|
19051
|
+
] })
|
|
18811
19052
|
] });
|
|
18812
19053
|
}
|
|
18813
|
-
var
|
|
19054
|
+
var import_lucide_react56, import_react63, import_jsx_runtime89;
|
|
18814
19055
|
var init_Keyshare = __esm({
|
|
18815
19056
|
"src/internal/components/SecurityMenu/Keyshare/Keyshare.tsx"() {
|
|
19057
|
+
init_SessionContext();
|
|
18816
19058
|
init_useT();
|
|
18817
|
-
|
|
19059
|
+
import_lucide_react56 = require("lucide-react");
|
|
19060
|
+
import_react63 = require("react");
|
|
18818
19061
|
init_icons();
|
|
19062
|
+
init_auth();
|
|
18819
19063
|
init_vaultClient();
|
|
18820
19064
|
init_highlight();
|
|
19065
|
+
init_useSecurityStore();
|
|
18821
19066
|
init_KeyshareStatus();
|
|
18822
19067
|
init_LastBackup();
|
|
18823
|
-
|
|
19068
|
+
init_useKeyshareRecoveryStats();
|
|
19069
|
+
import_jsx_runtime89 = require("react/jsx-runtime");
|
|
18824
19070
|
{
|
|
18825
19071
|
}
|
|
18826
19072
|
{
|
|
@@ -18832,92 +19078,16 @@ var init_Keyshare = __esm({
|
|
|
18832
19078
|
var init_Keyshare2 = __esm({
|
|
18833
19079
|
"src/internal/components/SecurityMenu/Keyshare/index.ts"() {
|
|
18834
19080
|
init_Keyshare();
|
|
18835
|
-
|
|
18836
|
-
});
|
|
18837
|
-
|
|
18838
|
-
// src/internal/components/SecurityMenu/UntrustApplication.tsx
|
|
18839
|
-
function UntrustApplication(props) {
|
|
18840
|
-
const { appToUntrust, isPending, cancelUntrust, handleUntrustApp } = props;
|
|
18841
|
-
const { t } = useT();
|
|
18842
|
-
return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "flex flex-col gap-[var(--ui-kit-gap)]", children: [
|
|
18843
|
-
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(Highlight, { className: "flex flex-col gap-[var(--ui-kit-gap)]", type: "warning", children: [
|
|
18844
|
-
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("span", { className: "text-sm leading-5 font-bold", children: [
|
|
18845
|
-
t("passport:securityMenu.connectedApps.untrustApp"),
|
|
18846
|
-
"?"
|
|
18847
|
-
] }),
|
|
18848
|
-
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "w-full flex items-center justify-center gap-[var(--ui-kit-gap)]", children: [
|
|
18849
|
-
appToUntrust.appLogo ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "w-12 h-12 rounded-[var(--ui-kit-el-bdrs)] bg-[var(--ui-kit-bg)] flex-shrink-0 p-1", children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("img", { src: appToUntrust.appLogo, alt: appToUntrust.appName, className: "w-full h-full object-contain" }) }) : /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "w-12 h-12 rounded-[var(--ui-kit-el-bdrs)] bg-[var(--ui-kit-bg)] flex items-center justify-center flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_lucide_react56.AppWindowMac, { className: "w-6 h-6" }) }),
|
|
18850
|
-
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "flex-1 text-left", children: [
|
|
18851
|
-
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "font-medium", children: appToUntrust.appName }),
|
|
18852
|
-
appToUntrust.hostname && /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "text-[10px]", children: [
|
|
18853
|
-
"(",
|
|
18854
|
-
appToUntrust.hostname,
|
|
18855
|
-
")"
|
|
18856
|
-
] })
|
|
18857
|
-
] })
|
|
18858
|
-
] })
|
|
18859
|
-
] }),
|
|
18860
|
-
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "text-[10px] text-[var(--ui-kit-fg-muted)] text-left space-y-1", children: [
|
|
18861
|
-
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("p", { children: [
|
|
18862
|
-
t("passport:securityMenu.connectedApps.removalNoteTitle"),
|
|
18863
|
-
":"
|
|
18864
|
-
] }),
|
|
18865
|
-
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("ul", { className: "list-disc list-inside ml-2 space-y-0.5", children: [
|
|
18866
|
-
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("li", { children: t("passport:securityMenu.connectedApps.removalNoteMsg1") }),
|
|
18867
|
-
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("li", { children: t("passport:securityMenu.connectedApps.removalNoteMsg2") })
|
|
18868
|
-
] })
|
|
18869
|
-
] }),
|
|
18870
|
-
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "w-full flex gap-[var(--ui-kit-gap)]", children: [
|
|
18871
|
-
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Button, { variant: "outline", size: "large", className: "flex-1", onClick: () => cancelUntrust(), disabled: isPending, children: t("passport:common.cancel") }),
|
|
18872
|
-
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Button, { variant: "default", size: "large", className: "flex-1", onClick: handleUntrustApp, disabled: isPending, children: isPending ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_lucide_react56.Loader, { className: "h-4 w-4 animate-spin" }) : t("passport:common.delete") })
|
|
18873
|
-
] })
|
|
18874
|
-
] });
|
|
18875
|
-
}
|
|
18876
|
-
var import_lucide_react56, import_jsx_runtime89;
|
|
18877
|
-
var init_UntrustApplication = __esm({
|
|
18878
|
-
"src/internal/components/SecurityMenu/UntrustApplication.tsx"() {
|
|
18879
|
-
init_i18n();
|
|
18880
|
-
import_lucide_react56 = require("lucide-react");
|
|
18881
|
-
init_button();
|
|
18882
|
-
init_highlight();
|
|
18883
|
-
import_jsx_runtime89 = require("react/jsx-runtime");
|
|
19081
|
+
init_useKeyshareRecoveryStats();
|
|
18884
19082
|
}
|
|
18885
19083
|
});
|
|
18886
19084
|
|
|
18887
19085
|
// src/internal/components/SecurityMenu/SecurityMenu.tsx
|
|
18888
19086
|
function SecurityMenu() {
|
|
18889
|
-
const qc = (0, import_react_query41.useQueryClient)();
|
|
18890
19087
|
const { t } = useT();
|
|
18891
19088
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
18892
|
-
const
|
|
18893
|
-
const
|
|
18894
|
-
const serverHasKeyshare = import_auth23.jwtTokenManager.getHasKeyshare() ?? false;
|
|
18895
|
-
const [appToUntrust, untrustApp] = (0, import_react61.useState)(null);
|
|
18896
|
-
const { data: recoveryData, isLoading: isRecoveryLoading } = useKeyshareRecoveryStats();
|
|
18897
|
-
const localInfo = recoveryData?.keyshareInfo || {};
|
|
18898
|
-
const hasServerBackup = !!recoveryData?.shareRecoveryStats?.created || recoveryData?.shareRecoveryStats?.devices?.length > 0;
|
|
18899
|
-
const { mutate: handleUntrustApp, isPending: isUntrustingApp } = (0, import_react_query41.useMutation)({
|
|
18900
|
-
mutationFn: async () => {
|
|
18901
|
-
if (!userId || !appToUntrust) return;
|
|
18902
|
-
const iframeManager = getIframeManager();
|
|
18903
|
-
if (!iframeManager) {
|
|
18904
|
-
throw new Error("Iframe manager not available");
|
|
18905
|
-
}
|
|
18906
|
-
return await iframeManager.removeTrustedApp(userId, appToUntrust.projectId, appToUntrust.origin);
|
|
18907
|
-
},
|
|
18908
|
-
onSuccess: (success) => {
|
|
18909
|
-
if (!success) {
|
|
18910
|
-
console.error("[SecurityMenu] Failed to remove trusted app from iframe");
|
|
18911
|
-
return;
|
|
18912
|
-
}
|
|
18913
|
-
qc.invalidateQueries({ queryKey: [CONNECTED_TRUSTED_APPS_QUERY, userId] });
|
|
18914
|
-
untrustApp(null);
|
|
18915
|
-
},
|
|
18916
|
-
onError: (error) => {
|
|
18917
|
-
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
18918
|
-
console.error("[SecurityMenu] Error removing trusted app:", errorMessage);
|
|
18919
|
-
}
|
|
18920
|
-
});
|
|
19089
|
+
const appToUntrust = useSecurityStore((st) => st.appToUntrust);
|
|
19090
|
+
const renderKey = useSecurityStore((st) => st.renderKey);
|
|
18921
19091
|
return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
18922
19092
|
"div",
|
|
18923
19093
|
{
|
|
@@ -18935,57 +19105,40 @@ function SecurityMenu() {
|
|
|
18935
19105
|
size: "icon",
|
|
18936
19106
|
title: t("passport:common.back"),
|
|
18937
19107
|
onClick: () => {
|
|
18938
|
-
|
|
18939
|
-
|
|
19108
|
+
const { appToUntrust: appToUntrust2, untrustApp } = useSecurityStore.getState();
|
|
19109
|
+
if (!!appToUntrust2) {
|
|
19110
|
+
untrustApp(null);
|
|
19111
|
+
} else {
|
|
19112
|
+
useLayoutDataStore.getState().setPage("settings" /* SETTINGS */);
|
|
19113
|
+
}
|
|
18940
19114
|
},
|
|
18941
19115
|
children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_lucide_react57.ArrowLeft, { className: "h-4 w-4" })
|
|
18942
19116
|
}
|
|
18943
19117
|
),
|
|
18944
19118
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { className: "text-xl font-semibold", children: t("passport:securityMenu.title") })
|
|
18945
19119
|
] }),
|
|
18946
|
-
appToUntrust && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
18947
|
-
|
|
18948
|
-
{
|
|
18949
|
-
|
|
18950
|
-
|
|
18951
|
-
|
|
18952
|
-
handleUntrustApp: async () => await handleUntrustApp()
|
|
18953
|
-
}
|
|
18954
|
-
),
|
|
18955
|
-
!appToUntrust && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
18956
|
-
Keyshare,
|
|
18957
|
-
{
|
|
18958
|
-
userId,
|
|
18959
|
-
serverHasKeyshare,
|
|
18960
|
-
localInfo,
|
|
18961
|
-
hasServerBackup,
|
|
18962
|
-
isLoading: isRecoveryLoading,
|
|
18963
|
-
createdRecoveryStats: recoveryData?.shareRecoveryStats?.created
|
|
18964
|
-
}
|
|
18965
|
-
),
|
|
18966
|
-
!appToUntrust && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(ConnectedApps, { isLoading: isRecoveryLoading, untrustApp })
|
|
19120
|
+
appToUntrust && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(UntrustApplication, {}),
|
|
19121
|
+
!appToUntrust && /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(import_jsx_runtime90.Fragment, { children: [
|
|
19122
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Keyshare, {}),
|
|
19123
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(ConnectedApps, {})
|
|
19124
|
+
] }),
|
|
19125
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: "w-full" }, renderKey)
|
|
18967
19126
|
] })
|
|
18968
19127
|
}
|
|
18969
19128
|
);
|
|
18970
19129
|
}
|
|
18971
|
-
var
|
|
19130
|
+
var import_lucide_react57, import_jsx_runtime90;
|
|
18972
19131
|
var init_SecurityMenu = __esm({
|
|
18973
19132
|
"src/internal/components/SecurityMenu/SecurityMenu.tsx"() {
|
|
18974
19133
|
init_i18n();
|
|
18975
|
-
import_react_query41 = require("@tanstack/react-query");
|
|
18976
19134
|
import_lucide_react57 = require("lucide-react");
|
|
18977
|
-
import_react61 = require("react");
|
|
18978
|
-
init_auth();
|
|
18979
19135
|
init_useLayoutDataStore();
|
|
18980
19136
|
init_useLayoutStore();
|
|
18981
|
-
init_iframe_manager();
|
|
18982
19137
|
init_Expandable2();
|
|
18983
19138
|
init_button();
|
|
18984
|
-
|
|
18985
|
-
init_constants5();
|
|
18986
|
-
init_hooks2();
|
|
19139
|
+
init_ConnectedApps2();
|
|
18987
19140
|
init_Keyshare2();
|
|
18988
|
-
|
|
19141
|
+
init_useSecurityStore();
|
|
18989
19142
|
import_jsx_runtime90 = require("react/jsx-runtime");
|
|
18990
19143
|
}
|
|
18991
19144
|
});
|
|
@@ -18994,6 +19147,8 @@ var init_SecurityMenu = __esm({
|
|
|
18994
19147
|
var init_SecurityMenu2 = __esm({
|
|
18995
19148
|
"src/internal/components/SecurityMenu/index.ts"() {
|
|
18996
19149
|
init_SecurityMenu();
|
|
19150
|
+
init_ConnectedApps2();
|
|
19151
|
+
init_Keyshare2();
|
|
18997
19152
|
}
|
|
18998
19153
|
});
|
|
18999
19154
|
|
|
@@ -19089,12 +19244,12 @@ var init_wallet = __esm({
|
|
|
19089
19244
|
});
|
|
19090
19245
|
|
|
19091
19246
|
// src/internal/components/SendMenu/useFlowSelector.ts
|
|
19092
|
-
var
|
|
19247
|
+
var import_zustand11, import_middleware2, useFlowSelectorStore;
|
|
19093
19248
|
var init_useFlowSelector = __esm({
|
|
19094
19249
|
"src/internal/components/SendMenu/useFlowSelector.ts"() {
|
|
19095
|
-
|
|
19250
|
+
import_zustand11 = require("zustand");
|
|
19096
19251
|
import_middleware2 = require("zustand/middleware");
|
|
19097
|
-
useFlowSelectorStore = (0,
|
|
19252
|
+
useFlowSelectorStore = (0, import_zustand11.create)()(
|
|
19098
19253
|
(0, import_middleware2.persist)(
|
|
19099
19254
|
(set) => ({
|
|
19100
19255
|
renderKey: Date.now().toString(),
|
|
@@ -19159,10 +19314,10 @@ var init_chains = __esm({
|
|
|
19159
19314
|
});
|
|
19160
19315
|
|
|
19161
19316
|
// src/internal/components/SendMenu/hyperbridge/useBridgeStore.ts
|
|
19162
|
-
var
|
|
19317
|
+
var import_zustand12, import_middleware3, RESETABLE_STATES, useBridgeStore;
|
|
19163
19318
|
var init_useBridgeStore = __esm({
|
|
19164
19319
|
"src/internal/components/SendMenu/hyperbridge/useBridgeStore.ts"() {
|
|
19165
|
-
|
|
19320
|
+
import_zustand12 = require("zustand");
|
|
19166
19321
|
import_middleware3 = require("zustand/middleware");
|
|
19167
19322
|
init_useFlowSelector();
|
|
19168
19323
|
RESETABLE_STATES = {
|
|
@@ -19175,7 +19330,7 @@ var init_useBridgeStore = __esm({
|
|
|
19175
19330
|
isQuoteEstimating: false,
|
|
19176
19331
|
bridgeHistoryItem: null
|
|
19177
19332
|
};
|
|
19178
|
-
useBridgeStore = (0,
|
|
19333
|
+
useBridgeStore = (0, import_zustand12.create)()(
|
|
19179
19334
|
(0, import_middleware3.persist)(
|
|
19180
19335
|
(set, get) => ({
|
|
19181
19336
|
bridgeSenders: [],
|
|
@@ -19239,15 +19394,15 @@ function SenderSelector(props) {
|
|
|
19239
19394
|
const { openConnectModal } = (0, import_rainbowkit.useConnectModal)();
|
|
19240
19395
|
const directWalletAddress = useExternalWalletStore((st) => st.externalAddress);
|
|
19241
19396
|
const directWalletIsConnected = useExternalWalletStore((st) => st.isExternalConnected);
|
|
19242
|
-
const pendingWalletRef = (0,
|
|
19397
|
+
const pendingWalletRef = (0, import_react64.useRef)(null);
|
|
19243
19398
|
const originChain = useBridgeStore((st) => st.originChain);
|
|
19244
19399
|
const bridgeSender = useBridgeStore((st) => st.bridgeSender);
|
|
19245
19400
|
const bridgeSenders = useBridgeStore((st) => st.bridgeSenders);
|
|
19246
|
-
const [walletMessage, setWalletMessage] = (0,
|
|
19247
|
-
(0,
|
|
19401
|
+
const [walletMessage, setWalletMessage] = (0, import_react64.useState)(null);
|
|
19402
|
+
(0, import_react64.useEffect)(() => {
|
|
19248
19403
|
useFlowSelectorStore.getState().setRenderKey(`sender-selected-${Date.now()}`);
|
|
19249
19404
|
}, [walletMessage]);
|
|
19250
|
-
const { mutate: loginDirectWallet, isPending: isDirectWalletLoggingIn } = (0,
|
|
19405
|
+
const { mutate: loginDirectWallet, isPending: isDirectWalletLoggingIn } = (0, import_react_query43.useMutation)({
|
|
19251
19406
|
mutationFn: async (walletProfile) => {
|
|
19252
19407
|
if (!walletProfile?.meta?.walletName || !walletProfile?.externalId || !walletProfile?.meta?.walletType) {
|
|
19253
19408
|
console.error("[SENDER SELECTOR] Invalid wallet profile:", walletProfile);
|
|
@@ -19300,7 +19455,7 @@ function SenderSelector(props) {
|
|
|
19300
19455
|
setWalletMessage(error instanceof Error ? error.message : "Wallet login failed. Please try again.");
|
|
19301
19456
|
}
|
|
19302
19457
|
});
|
|
19303
|
-
(0,
|
|
19458
|
+
(0, import_react64.useEffect)(() => {
|
|
19304
19459
|
const pendingProfile = pendingWalletRef.current;
|
|
19305
19460
|
if (!pendingProfile || !directWalletIsConnected || !directWalletAddress) return;
|
|
19306
19461
|
if (directWalletAddress.toLowerCase() !== pendingProfile.externalId?.toLowerCase()) return;
|
|
@@ -19375,14 +19530,14 @@ function SenderSelector(props) {
|
|
|
19375
19530
|
] })
|
|
19376
19531
|
] });
|
|
19377
19532
|
}
|
|
19378
|
-
var import_rainbowkit,
|
|
19533
|
+
var import_rainbowkit, import_react_query43, import_react64, import_wagmi3, import_jsx_runtime91;
|
|
19379
19534
|
var init_SenderSelector = __esm({
|
|
19380
19535
|
"src/internal/components/SendMenu/hyperbridge/components/SenderSelector.tsx"() {
|
|
19381
19536
|
init_ProviderContext();
|
|
19382
19537
|
init_i18n();
|
|
19383
19538
|
import_rainbowkit = require("@rainbow-me/rainbowkit");
|
|
19384
|
-
|
|
19385
|
-
|
|
19539
|
+
import_react_query43 = require("@tanstack/react-query");
|
|
19540
|
+
import_react64 = require("react");
|
|
19386
19541
|
import_wagmi3 = require("wagmi");
|
|
19387
19542
|
init_wallet();
|
|
19388
19543
|
init_useLayoutDataStore();
|
|
@@ -19482,8 +19637,8 @@ var init_wallets = __esm({
|
|
|
19482
19637
|
function useAvailableSenders() {
|
|
19483
19638
|
const address = useSession((st) => st.address);
|
|
19484
19639
|
const { profiles } = useLinkedProfiles();
|
|
19485
|
-
const lastCalcedSenders = (0,
|
|
19486
|
-
(0,
|
|
19640
|
+
const lastCalcedSenders = (0, import_react65.useRef)([]);
|
|
19641
|
+
(0, import_react65.useEffect)(() => {
|
|
19487
19642
|
const sendersAccumulator = [
|
|
19488
19643
|
{
|
|
19489
19644
|
type: "embarkai-wallet",
|
|
@@ -19514,13 +19669,13 @@ function useAvailableSenders() {
|
|
|
19514
19669
|
directWalletProfile: profiles.filter((p) => p.provider === "wallet")[0] || null
|
|
19515
19670
|
};
|
|
19516
19671
|
}
|
|
19517
|
-
var
|
|
19672
|
+
var import_react65;
|
|
19518
19673
|
var init_useAvailableSenders = __esm({
|
|
19519
19674
|
"src/internal/components/SendMenu/hyperbridge/hooks/useAvailableSenders.ts"() {
|
|
19520
19675
|
init_SessionContext();
|
|
19521
19676
|
init_tokens();
|
|
19522
19677
|
init_linkedProfiles();
|
|
19523
|
-
|
|
19678
|
+
import_react65 = require("react");
|
|
19524
19679
|
init_wallets();
|
|
19525
19680
|
init_useFlowSelector();
|
|
19526
19681
|
init_useBridgeStore();
|
|
@@ -19853,7 +20008,7 @@ function useHyperlaneHistory() {
|
|
|
19853
20008
|
const page = useLayoutDataStore((st) => st.page);
|
|
19854
20009
|
const flow = useFlowSelectorStore((st) => st.flow);
|
|
19855
20010
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
19856
|
-
const query = (0,
|
|
20011
|
+
const query = (0, import_react_query44.useInfiniteQuery)({
|
|
19857
20012
|
retry: false,
|
|
19858
20013
|
initialPageParam: 1,
|
|
19859
20014
|
refetchInterval: TX_HISTORY_POLLING_INTERVAL,
|
|
@@ -19863,29 +20018,29 @@ function useHyperlaneHistory() {
|
|
|
19863
20018
|
queryFn: async ({ pageParam }) => await getHyperlaneBridgeHistory({ page: pageParam, pageSize: TX_HISTORY_PAGE_SIZE })
|
|
19864
20019
|
});
|
|
19865
20020
|
const { data: txHistoryData, isLoading: isBridgeTxHistoryLoading } = query;
|
|
19866
|
-
const txList = (0,
|
|
20021
|
+
const txList = (0, import_react66.useMemo)(
|
|
19867
20022
|
() => txHistoryData?.pages?.map((p) => p.data).flat(Infinity) || [],
|
|
19868
20023
|
[txHistoryData]
|
|
19869
20024
|
);
|
|
19870
|
-
const updateExpandable = (0,
|
|
19871
|
-
(0,
|
|
20025
|
+
const updateExpandable = (0, import_react66.useCallback)(
|
|
20026
|
+
(0, import_lodash_es12.debounce)(() => {
|
|
19872
20027
|
useFlowSelectorStore.getState().setRenderKey(`hyperlane-history-loaded-${Date.now()}`);
|
|
19873
20028
|
}, 250),
|
|
19874
20029
|
[]
|
|
19875
20030
|
);
|
|
19876
|
-
(0,
|
|
20031
|
+
(0, import_react66.useEffect)(() => {
|
|
19877
20032
|
if (isBridgeTxHistoryLoading || txList.length === 0) return;
|
|
19878
20033
|
updateExpandable();
|
|
19879
20034
|
}, [isBridgeTxHistoryLoading, txList]);
|
|
19880
20035
|
return { query, txList };
|
|
19881
20036
|
}
|
|
19882
|
-
var
|
|
20037
|
+
var import_react_query44, import_lodash_es12, import_react66, HYPERLANE_HISTORY_QUERY_KEY, TX_HISTORY_PAGE_SIZE, TX_HISTORY_POLLING_INTERVAL;
|
|
19883
20038
|
var init_useHyperlaneHistory = __esm({
|
|
19884
20039
|
"src/internal/components/SendMenu/hyperbridge/hooks/useHyperlaneHistory.ts"() {
|
|
19885
20040
|
init_SessionContext();
|
|
19886
|
-
|
|
19887
|
-
|
|
19888
|
-
|
|
20041
|
+
import_react_query44 = require("@tanstack/react-query");
|
|
20042
|
+
import_lodash_es12 = require("lodash-es");
|
|
20043
|
+
import_react66 = require("react");
|
|
19889
20044
|
init_useLayoutDataStore();
|
|
19890
20045
|
init_useFlowSelector();
|
|
19891
20046
|
init_api3();
|
|
@@ -19897,11 +20052,11 @@ var init_useHyperlaneHistory = __esm({
|
|
|
19897
20052
|
});
|
|
19898
20053
|
|
|
19899
20054
|
// src/internal/components/SendMenu/hyperbridge/hooks/useOperationHashesStore.ts
|
|
19900
|
-
var
|
|
20055
|
+
var import_zustand13, useOperationHashesStore;
|
|
19901
20056
|
var init_useOperationHashesStore = __esm({
|
|
19902
20057
|
"src/internal/components/SendMenu/hyperbridge/hooks/useOperationHashesStore.ts"() {
|
|
19903
|
-
|
|
19904
|
-
useOperationHashesStore = (0,
|
|
20058
|
+
import_zustand13 = require("zustand");
|
|
20059
|
+
useOperationHashesStore = (0, import_zustand13.create)((set) => ({
|
|
19905
20060
|
hyperlaneDatabaseTx: null,
|
|
19906
20061
|
operationHashes: [],
|
|
19907
20062
|
setHyperlaneDatabaseTx: (hyperlaneDatabaseTx) => set({ hyperlaneDatabaseTx }),
|
|
@@ -19912,12 +20067,12 @@ var init_useOperationHashesStore = __esm({
|
|
|
19912
20067
|
|
|
19913
20068
|
// src/internal/components/SendMenu/hyperbridge/hooks/useBridge.ts
|
|
19914
20069
|
function useBridge() {
|
|
19915
|
-
const qc = (0,
|
|
20070
|
+
const qc = (0, import_react_query45.useQueryClient)();
|
|
19916
20071
|
const { t } = useT();
|
|
19917
20072
|
const address = useSession((st) => st.address);
|
|
19918
20073
|
const { data: walletClient } = (0, import_wagmi4.useWalletClient)();
|
|
19919
20074
|
const { switchChainAsync } = (0, import_wagmi4.useSwitchChain)();
|
|
19920
|
-
const swapDirection = (0,
|
|
20075
|
+
const swapDirection = (0, import_react67.useCallback)(() => {
|
|
19921
20076
|
const {
|
|
19922
20077
|
bridgeStep,
|
|
19923
20078
|
originChain,
|
|
@@ -19931,7 +20086,7 @@ function useBridge() {
|
|
|
19931
20086
|
setOriginChain(destinationChain);
|
|
19932
20087
|
setDestinationChain(originChain);
|
|
19933
20088
|
}, []);
|
|
19934
|
-
const { mutate: estimateQuote } = (0,
|
|
20089
|
+
const { mutate: estimateQuote } = (0, import_react_query45.useMutation)({
|
|
19935
20090
|
mutationFn: async (amountToBridge) => {
|
|
19936
20091
|
useFlowSelectorStore.getState().setError(null);
|
|
19937
20092
|
useFlowSelectorStore.getState().setIsUiLocked(true);
|
|
@@ -19969,7 +20124,7 @@ function useBridge() {
|
|
|
19969
20124
|
useFlowSelectorStore.getState().setError(error instanceof Error ? error.message : String(error));
|
|
19970
20125
|
}
|
|
19971
20126
|
});
|
|
19972
|
-
const handleQuoteEstimation = (0,
|
|
20127
|
+
const handleQuoteEstimation = (0, import_react67.useCallback)((amnt) => {
|
|
19973
20128
|
const { originChain, destinationChain, bridgeSender } = useBridgeStore.getState();
|
|
19974
20129
|
if (!amnt || !Number(amnt)) {
|
|
19975
20130
|
useBridgeStore.getState().setQuote(null);
|
|
@@ -19999,7 +20154,7 @@ function useBridge() {
|
|
|
19999
20154
|
})
|
|
20000
20155
|
);
|
|
20001
20156
|
}, []);
|
|
20002
|
-
const { mutate: bridgeAsset, isPending: isAssetBridging } = (0,
|
|
20157
|
+
const { mutate: bridgeAsset, isPending: isAssetBridging } = (0, import_react_query45.useMutation)({
|
|
20003
20158
|
mutationFn: async () => {
|
|
20004
20159
|
const {
|
|
20005
20160
|
hyperRoute,
|
|
@@ -20094,14 +20249,14 @@ function useBridge() {
|
|
|
20094
20249
|
isAssetBridging
|
|
20095
20250
|
};
|
|
20096
20251
|
}
|
|
20097
|
-
var
|
|
20252
|
+
var import_react_query45, import_react67, import_wagmi4;
|
|
20098
20253
|
var init_useBridge = __esm({
|
|
20099
20254
|
"src/internal/components/SendMenu/hyperbridge/hooks/useBridge.ts"() {
|
|
20100
20255
|
init_SessionContext();
|
|
20101
20256
|
init_i18n();
|
|
20102
20257
|
init_useExternalWalletStore();
|
|
20103
|
-
|
|
20104
|
-
|
|
20258
|
+
import_react_query45 = require("@tanstack/react-query");
|
|
20259
|
+
import_react67 = require("react");
|
|
20105
20260
|
import_wagmi4 = require("wagmi");
|
|
20106
20261
|
init_useLayoutStore();
|
|
20107
20262
|
init_useFlowSelector();
|
|
@@ -20125,7 +20280,7 @@ function useHyperlaneRoutes() {
|
|
|
20125
20280
|
data: hyperlaneWarpRoutes = [],
|
|
20126
20281
|
isLoading: isLoadingWarpRoutes,
|
|
20127
20282
|
error: errorWarpRoutes
|
|
20128
|
-
} = (0,
|
|
20283
|
+
} = (0, import_react_query46.useQuery)({
|
|
20129
20284
|
retry: false,
|
|
20130
20285
|
enabled: !!address && page === "send" /* SEND */ && flow === "bridge",
|
|
20131
20286
|
queryKey: [HYPERLANE_WARP_ROUTES_QUERY_KEY, address],
|
|
@@ -20135,7 +20290,7 @@ function useHyperlaneRoutes() {
|
|
|
20135
20290
|
return warpRoutes;
|
|
20136
20291
|
}
|
|
20137
20292
|
});
|
|
20138
|
-
(0,
|
|
20293
|
+
(0, import_react68.useEffect)(() => {
|
|
20139
20294
|
if (!errorWarpRoutes) return;
|
|
20140
20295
|
useFlowSelectorStore.getState().setError(errorWarpRoutes.message);
|
|
20141
20296
|
const { resetSelections, setRecipient, setOriginChain, setDestinationChain } = useBridgeStore.getState();
|
|
@@ -20144,7 +20299,7 @@ function useHyperlaneRoutes() {
|
|
|
20144
20299
|
setOriginChain(null);
|
|
20145
20300
|
setDestinationChain(null);
|
|
20146
20301
|
}, [errorWarpRoutes]);
|
|
20147
|
-
(0,
|
|
20302
|
+
(0, import_react68.useEffect)(() => {
|
|
20148
20303
|
if (!!hyperRoute || !hyperlaneWarpRoutes.length) return;
|
|
20149
20304
|
const warpRouteToAutoSelect = hyperlaneWarpRoutes.find((route) => route.routeId === hyperRoute);
|
|
20150
20305
|
if (!warpRouteToAutoSelect) return;
|
|
@@ -20163,12 +20318,12 @@ function useHyperlaneRoutes() {
|
|
|
20163
20318
|
}, [hyperRoute, hyperlaneWarpRoutes]);
|
|
20164
20319
|
return { hyperlaneWarpRoutes, isLoadingWarpRoutes };
|
|
20165
20320
|
}
|
|
20166
|
-
var
|
|
20321
|
+
var import_react_query46, import_react68, HYPERLANE_WARP_ROUTES_QUERY_KEY;
|
|
20167
20322
|
var init_useHyperlaneRoutes = __esm({
|
|
20168
20323
|
"src/internal/components/SendMenu/hyperbridge/hooks/useHyperlaneRoutes.ts"() {
|
|
20169
20324
|
init_SessionContext();
|
|
20170
|
-
|
|
20171
|
-
|
|
20325
|
+
import_react_query46 = require("@tanstack/react-query");
|
|
20326
|
+
import_react68 = require("react");
|
|
20172
20327
|
init_useLayoutDataStore();
|
|
20173
20328
|
init_useFlowSelector();
|
|
20174
20329
|
init_api3();
|
|
@@ -20184,7 +20339,7 @@ function useMenuTitle(warpRoutes) {
|
|
|
20184
20339
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
20185
20340
|
const hyperRoute = useBridgeStore((st) => st.hyperRoute);
|
|
20186
20341
|
const hyperRouteMeta = warpRoutes?.length ? warpRoutes.find((route) => route.routeId === hyperRoute) : null;
|
|
20187
|
-
(0,
|
|
20342
|
+
(0, import_react69.useEffect)(() => {
|
|
20188
20343
|
const updateMenuTitle = useFlowSelectorStore.getState().setMenuTitle;
|
|
20189
20344
|
switch (true) {
|
|
20190
20345
|
case bridgeStep === "sender-selector":
|
|
@@ -20212,11 +20367,11 @@ function useMenuTitle(warpRoutes) {
|
|
|
20212
20367
|
}
|
|
20213
20368
|
}, [bridgeStep, hyperRouteMeta, t]);
|
|
20214
20369
|
}
|
|
20215
|
-
var
|
|
20370
|
+
var import_react69;
|
|
20216
20371
|
var init_useMenuTitle = __esm({
|
|
20217
20372
|
"src/internal/components/SendMenu/hyperbridge/hooks/useMenuTitle.ts"() {
|
|
20218
20373
|
init_i18n();
|
|
20219
|
-
|
|
20374
|
+
import_react69 = require("react");
|
|
20220
20375
|
init_useFlowSelector();
|
|
20221
20376
|
init_useBridgeStore();
|
|
20222
20377
|
}
|
|
@@ -20244,7 +20399,7 @@ function checkWrapedTokenSymbol2(symbol) {
|
|
|
20244
20399
|
return symbol.toUpperCase();
|
|
20245
20400
|
}
|
|
20246
20401
|
function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
20247
|
-
const qc = (0,
|
|
20402
|
+
const qc = (0, import_react_query47.useQueryClient)();
|
|
20248
20403
|
const { t } = useT();
|
|
20249
20404
|
const address = useSession((st) => st.address);
|
|
20250
20405
|
const directWalletAddress = useExternalWalletStore((st) => st.externalAddress);
|
|
@@ -20271,7 +20426,7 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
|
20271
20426
|
const embarkTokenBalanace = assets.find((a) => selectedWarpRoute?.symbol === checkWrapedTokenSymbol2(a.symbol));
|
|
20272
20427
|
const originChainMeta = CHAINS_UI_META[originChain];
|
|
20273
20428
|
const isSelectedTokenNative = selectedWarpRoute?.symbol?.toUpperCase() === originChainMeta?.chain?.nativeCurrency?.symbol?.toUpperCase();
|
|
20274
|
-
const { data: externalBalanceData, isLoading: isExternalBalanceLoading } = (0,
|
|
20429
|
+
const { data: externalBalanceData, isLoading: isExternalBalanceLoading } = (0, import_react_query47.useQuery)({
|
|
20275
20430
|
retry: false,
|
|
20276
20431
|
enabled: bridgeSender === "direct-wallet" && !isSelectedTokenNative && !!directWalletAddress && !!routeTokenAddress && !!originChain,
|
|
20277
20432
|
queryKey: [EXTERNAL_WALLET_BRIDGING_BALANCE_QUERY, originChain, directWalletAddress, routeTokenAddress],
|
|
@@ -20314,7 +20469,7 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
|
20314
20469
|
return { value, decimals, symbol, formatted };
|
|
20315
20470
|
}
|
|
20316
20471
|
});
|
|
20317
|
-
const { data: externalNativeBalanceData, isLoading: isExternalNativeBalanceLoading } = (0,
|
|
20472
|
+
const { data: externalNativeBalanceData, isLoading: isExternalNativeBalanceLoading } = (0, import_react_query47.useQuery)({
|
|
20318
20473
|
retry: false,
|
|
20319
20474
|
enabled: bridgeSender === "direct-wallet" && isSelectedTokenNative && !!directWalletAddress && !!originChain,
|
|
20320
20475
|
queryKey: [EXTERNAL_WALLET_BRIDGING_NATIVE_BALANCE_QUERY, originChain, directWalletAddress],
|
|
@@ -20329,7 +20484,7 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
|
20329
20484
|
};
|
|
20330
20485
|
}
|
|
20331
20486
|
});
|
|
20332
|
-
const refreshRouteTokenBalance = (0,
|
|
20487
|
+
const refreshRouteTokenBalance = (0, import_react70.useCallback)(
|
|
20333
20488
|
(senderWallet) => {
|
|
20334
20489
|
switch (true) {
|
|
20335
20490
|
case senderWallet === "embarkai-wallet":
|
|
@@ -20345,7 +20500,7 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
|
20345
20500
|
},
|
|
20346
20501
|
[refreshBalances, qc]
|
|
20347
20502
|
);
|
|
20348
|
-
(0,
|
|
20503
|
+
(0, import_react70.useEffect)(() => {
|
|
20349
20504
|
if (!bridgeSender || !originChain) return;
|
|
20350
20505
|
switch (bridgeSender) {
|
|
20351
20506
|
case "embarkai-wallet":
|
|
@@ -20376,15 +20531,15 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
|
20376
20531
|
isRouteTokenBalanceLoading: isAssetsLoading || isExternalBalanceLoading || isExternalNativeBalanceLoading
|
|
20377
20532
|
};
|
|
20378
20533
|
}
|
|
20379
|
-
var import_core6,
|
|
20534
|
+
var import_core6, import_react_query47, import_react70, import_viem13, import_wagmi5, EXTERNAL_WALLET_BRIDGING_BALANCE_QUERY, EXTERNAL_WALLET_BRIDGING_NATIVE_BALANCE_QUERY;
|
|
20380
20535
|
var init_useBridgeBalance = __esm({
|
|
20381
20536
|
"src/internal/components/SendMenu/hyperbridge/hooks/useBridgeBalance.ts"() {
|
|
20382
20537
|
init_constants();
|
|
20383
20538
|
init_SessionContext();
|
|
20384
20539
|
init_i18n();
|
|
20385
20540
|
import_core6 = require("@embarkai/core");
|
|
20386
|
-
|
|
20387
|
-
|
|
20541
|
+
import_react_query47 = require("@tanstack/react-query");
|
|
20542
|
+
import_react70 = require("react");
|
|
20388
20543
|
import_viem13 = require("viem");
|
|
20389
20544
|
import_wagmi5 = require("wagmi");
|
|
20390
20545
|
init_useBlockscoutAssets();
|
|
@@ -20502,7 +20657,7 @@ function SelectStep(props) {
|
|
|
20502
20657
|
variant: "outline",
|
|
20503
20658
|
size: "medium",
|
|
20504
20659
|
className: "bg-[var(--ui-kit-bg)] flex items-center gap-[var(--ui-kit-gap)]",
|
|
20505
|
-
children: selectedWarpRoute.chainPair.map((chain, chIdx) => /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(
|
|
20660
|
+
children: selectedWarpRoute.chainPair.map((chain, chIdx) => /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(import_react71.Fragment, { children: [
|
|
20506
20661
|
chIdx > 0 && /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(import_lucide_react59.ArrowLeftRightIcon, { className: "w-4 h-4 " }),
|
|
20507
20662
|
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(ResolveChainIcon, { chainName: chain.chainName, className: "w-4 h-4" })
|
|
20508
20663
|
] }, `${selectedWarpRoute.id}-icon-${chain.chainID}-${chIdx}`))
|
|
@@ -20637,13 +20792,13 @@ function SelectStep(props) {
|
|
|
20637
20792
|
)
|
|
20638
20793
|
] });
|
|
20639
20794
|
}
|
|
20640
|
-
var import_lucide_react59,
|
|
20795
|
+
var import_lucide_react59, import_react71, import_jsx_runtime95;
|
|
20641
20796
|
var init_SelectStep = __esm({
|
|
20642
20797
|
"src/internal/components/SendMenu/hyperbridge/steps/SelectStep.tsx"() {
|
|
20643
20798
|
init_tokens();
|
|
20644
20799
|
init_i18n();
|
|
20645
20800
|
import_lucide_react59 = require("lucide-react");
|
|
20646
|
-
|
|
20801
|
+
import_react71 = require("react");
|
|
20647
20802
|
init_priceFormatter();
|
|
20648
20803
|
init_utils2();
|
|
20649
20804
|
init_badge();
|
|
@@ -20692,7 +20847,7 @@ var init_checkbox = __esm({
|
|
|
20692
20847
|
// src/internal/components/SendMenu/hyperbridge/steps/ConfirmStep.tsx
|
|
20693
20848
|
function ConfirmStep(props) {
|
|
20694
20849
|
const { isAssetBridging, bridgeAsset, hyperlaneWarpRoutes } = props;
|
|
20695
|
-
const [userConsent, setUserConsent] = (0,
|
|
20850
|
+
const [userConsent, setUserConsent] = (0, import_react72.useState)(false);
|
|
20696
20851
|
const { t } = useT();
|
|
20697
20852
|
const address = useSession((st) => st.address);
|
|
20698
20853
|
const bridgeSender = useBridgeStore((st) => st.bridgeSenders.find((s) => s.type === st.bridgeSender));
|
|
@@ -20801,13 +20956,13 @@ function ConfirmStep(props) {
|
|
|
20801
20956
|
)
|
|
20802
20957
|
] });
|
|
20803
20958
|
}
|
|
20804
|
-
var import_lucide_react61,
|
|
20959
|
+
var import_lucide_react61, import_react72, import_jsx_runtime97, P_CN;
|
|
20805
20960
|
var init_ConfirmStep = __esm({
|
|
20806
20961
|
"src/internal/components/SendMenu/hyperbridge/steps/ConfirmStep.tsx"() {
|
|
20807
20962
|
init_SessionContext();
|
|
20808
20963
|
init_i18n();
|
|
20809
20964
|
import_lucide_react61 = require("lucide-react");
|
|
20810
|
-
|
|
20965
|
+
import_react72 = require("react");
|
|
20811
20966
|
init_priceFormatter();
|
|
20812
20967
|
init_utils2();
|
|
20813
20968
|
init_button();
|
|
@@ -21029,7 +21184,7 @@ function HistoryItem(props) {
|
|
|
21029
21184
|
txStatus
|
|
21030
21185
|
} = props;
|
|
21031
21186
|
const { t } = useT();
|
|
21032
|
-
const qc = (0,
|
|
21187
|
+
const qc = (0, import_react_query48.useQueryClient)();
|
|
21033
21188
|
const address = useSession((st) => st.address);
|
|
21034
21189
|
const warpRoutes = qc.getQueryData([HYPERLANE_WARP_ROUTES_QUERY_KEY, address]);
|
|
21035
21190
|
const assetWarpRoute = warpRoutes?.find((route) => {
|
|
@@ -21154,12 +21309,12 @@ function HistoryStep() {
|
|
|
21154
21309
|
)
|
|
21155
21310
|
] });
|
|
21156
21311
|
}
|
|
21157
|
-
var
|
|
21312
|
+
var import_react_query48, import_dayjs7, import_lucide_react62, import_jsx_runtime99, P_CN3;
|
|
21158
21313
|
var init_HistoryStep = __esm({
|
|
21159
21314
|
"src/internal/components/SendMenu/hyperbridge/steps/HistoryStep.tsx"() {
|
|
21160
21315
|
init_SessionContext();
|
|
21161
21316
|
init_i18n();
|
|
21162
|
-
|
|
21317
|
+
import_react_query48 = require("@tanstack/react-query");
|
|
21163
21318
|
import_dayjs7 = __toESM(require("dayjs"), 1);
|
|
21164
21319
|
import_lucide_react62 = require("lucide-react");
|
|
21165
21320
|
init_tokens();
|
|
@@ -21182,9 +21337,9 @@ var init_HistoryStep = __esm({
|
|
|
21182
21337
|
function SelectAssetRoute(props) {
|
|
21183
21338
|
const { hyperlaneWarpRoutes } = props;
|
|
21184
21339
|
const { t } = useT();
|
|
21185
|
-
const [isTokenSymbolSelector, setIsTokenSymbolSelector] = (0,
|
|
21340
|
+
const [isTokenSymbolSelector, setIsTokenSymbolSelector] = (0, import_react73.useState)(false);
|
|
21186
21341
|
const selectedAssetSymbol = useBridgeStore((st) => st.bridgeAssetSymbol);
|
|
21187
|
-
const tokenList = (0,
|
|
21342
|
+
const tokenList = (0, import_react73.useMemo)(() => {
|
|
21188
21343
|
const tokens = hyperlaneWarpRoutes.map((route) => route.symbol);
|
|
21189
21344
|
const uniqueTokens = Array.from(new Set(tokens));
|
|
21190
21345
|
return uniqueTokens.map((symbol) => ({
|
|
@@ -21281,13 +21436,13 @@ function SelectAssetRoute(props) {
|
|
|
21281
21436
|
] })
|
|
21282
21437
|
] });
|
|
21283
21438
|
}
|
|
21284
|
-
var import_lucide_react63,
|
|
21439
|
+
var import_lucide_react63, import_react73, import_jsx_runtime100;
|
|
21285
21440
|
var init_SelectAssetRoute = __esm({
|
|
21286
21441
|
"src/internal/components/SendMenu/hyperbridge/steps/SelectAssetRoute.tsx"() {
|
|
21287
21442
|
init_tokens();
|
|
21288
21443
|
init_i18n();
|
|
21289
21444
|
import_lucide_react63 = require("lucide-react");
|
|
21290
|
-
|
|
21445
|
+
import_react73 = require("react");
|
|
21291
21446
|
init_button();
|
|
21292
21447
|
init_useFlowSelector();
|
|
21293
21448
|
init_ResolveChainIcon();
|
|
@@ -21315,7 +21470,7 @@ function HyperlaneBridge() {
|
|
|
21315
21470
|
const { hyperlaneWarpRoutes, isLoadingWarpRoutes } = useHyperlaneRoutes();
|
|
21316
21471
|
const { directWalletProfile } = useAvailableSenders();
|
|
21317
21472
|
useMenuTitle(hyperlaneWarpRoutes);
|
|
21318
|
-
(0,
|
|
21473
|
+
(0, import_react74.useEffect)(() => {
|
|
21319
21474
|
return () => {
|
|
21320
21475
|
useBridgeStore.getState().resetSelections();
|
|
21321
21476
|
};
|
|
@@ -21348,10 +21503,10 @@ function HyperlaneBridge() {
|
|
|
21348
21503
|
bridgeStep === "tx-history-details" && /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(HistoryDetailsStep, {})
|
|
21349
21504
|
] });
|
|
21350
21505
|
}
|
|
21351
|
-
var
|
|
21506
|
+
var import_react74, import_jsx_runtime101;
|
|
21352
21507
|
var init_HyperlaneBridge = __esm({
|
|
21353
21508
|
"src/internal/components/SendMenu/hyperbridge/HyperlaneBridge.tsx"() {
|
|
21354
|
-
|
|
21509
|
+
import_react74 = require("react");
|
|
21355
21510
|
init_SenderSelector();
|
|
21356
21511
|
init_useAvailableSenders();
|
|
21357
21512
|
init_useBridge();
|
|
@@ -21369,7 +21524,7 @@ function BridgeHistorySwitch(props) {
|
|
|
21369
21524
|
const selectorFlow = useFlowSelectorStore((st) => st.flow);
|
|
21370
21525
|
const isUiLocked = useFlowSelectorStore((st) => st.isUiLocked);
|
|
21371
21526
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
21372
|
-
const lastBridgeStepRef = (0,
|
|
21527
|
+
const lastBridgeStepRef = (0, import_react75.useRef)(null);
|
|
21373
21528
|
if (selectorFlow !== "bridge" || bridgeStep === "confirm" || bridgeStep === "success" || bridgeStep === "sender-selector" || bridgeStep === "select-token" || bridgeStep === "tx-history-details") {
|
|
21374
21529
|
return null;
|
|
21375
21530
|
}
|
|
@@ -21388,10 +21543,10 @@ function BridgeHistorySwitch(props) {
|
|
|
21388
21543
|
}
|
|
21389
21544
|
);
|
|
21390
21545
|
}
|
|
21391
|
-
var
|
|
21546
|
+
var import_react75, import_jsx_runtime102;
|
|
21392
21547
|
var init_HistorySwitch = __esm({
|
|
21393
21548
|
"src/internal/components/SendMenu/hyperbridge/components/HistorySwitch.tsx"() {
|
|
21394
|
-
|
|
21549
|
+
import_react75 = require("react");
|
|
21395
21550
|
init_switch();
|
|
21396
21551
|
init_useFlowSelector();
|
|
21397
21552
|
init_useBridgeStore();
|
|
@@ -21482,11 +21637,11 @@ function looksLikeNickname(input) {
|
|
|
21482
21637
|
}
|
|
21483
21638
|
function useNicknameResolve(input, options) {
|
|
21484
21639
|
const { enabled = true, chainId } = options;
|
|
21485
|
-
const [debouncedInput, setDebouncedInput] = (0,
|
|
21486
|
-
const [isDebouncing, setIsDebouncing] = (0,
|
|
21640
|
+
const [debouncedInput, setDebouncedInput] = (0, import_react76.useState)("");
|
|
21641
|
+
const [isDebouncing, setIsDebouncing] = (0, import_react76.useState)(false);
|
|
21487
21642
|
const normalized = normalizeNickname(input);
|
|
21488
21643
|
const isNicknameInput = looksLikeNickname(input) && normalized.length >= 3;
|
|
21489
|
-
(0,
|
|
21644
|
+
(0, import_react76.useEffect)(() => {
|
|
21490
21645
|
if (!isNicknameInput || !enabled) {
|
|
21491
21646
|
setDebouncedInput("");
|
|
21492
21647
|
setIsDebouncing(false);
|
|
@@ -21501,7 +21656,7 @@ function useNicknameResolve(input, options) {
|
|
|
21501
21656
|
clearTimeout(timer);
|
|
21502
21657
|
};
|
|
21503
21658
|
}, [normalized, isNicknameInput, enabled]);
|
|
21504
|
-
const query = (0,
|
|
21659
|
+
const query = (0, import_react_query49.useQuery)({
|
|
21505
21660
|
queryKey: [...QUERY_KEYS.nicknameResolve(debouncedInput), chainId],
|
|
21506
21661
|
queryFn: async () => await resolveNickname(debouncedInput, chainId),
|
|
21507
21662
|
enabled: enabled && isNicknameInput && debouncedInput.length > 0,
|
|
@@ -21512,7 +21667,7 @@ function useNicknameResolve(input, options) {
|
|
|
21512
21667
|
const isNotFound = query.isError && query.error?.code === "NICKNAME_NOT_FOUND";
|
|
21513
21668
|
const isWalletNotSetup = !!query.data && query.data.resolvedTarget === null;
|
|
21514
21669
|
const isFrozen = query.data?.isFrozen ?? false;
|
|
21515
|
-
const fingerprintVerification = (0,
|
|
21670
|
+
const fingerprintVerification = (0, import_react76.useMemo)(() => {
|
|
21516
21671
|
if (!query.data?.owner || !query.data?.fingerprint) {
|
|
21517
21672
|
return null;
|
|
21518
21673
|
}
|
|
@@ -21534,11 +21689,11 @@ function useNicknameResolve(input, options) {
|
|
|
21534
21689
|
resolvedAddress
|
|
21535
21690
|
};
|
|
21536
21691
|
}
|
|
21537
|
-
var
|
|
21692
|
+
var import_react_query49, import_react76, DEBOUNCE_MS2;
|
|
21538
21693
|
var init_useNicknameResolve = __esm({
|
|
21539
21694
|
"src/hooks/useNicknameResolve.ts"() {
|
|
21540
|
-
|
|
21541
|
-
|
|
21695
|
+
import_react_query49 = require("@tanstack/react-query");
|
|
21696
|
+
import_react76 = require("react");
|
|
21542
21697
|
init_nickname();
|
|
21543
21698
|
init_profile();
|
|
21544
21699
|
init_nickname_fingerprint();
|
|
@@ -21551,10 +21706,10 @@ var init_useNicknameResolve = __esm({
|
|
|
21551
21706
|
function useSendTransaction() {
|
|
21552
21707
|
const session = useSession((st) => st.session);
|
|
21553
21708
|
const address = useSession((st) => st.address);
|
|
21554
|
-
const [isLoading, setIsLoading] = (0,
|
|
21555
|
-
const [error, setError] = (0,
|
|
21556
|
-
const [userOpHash, setUserOpHash] = (0,
|
|
21557
|
-
const sendTransaction = (0,
|
|
21709
|
+
const [isLoading, setIsLoading] = (0, import_react77.useState)(false);
|
|
21710
|
+
const [error, setError] = (0, import_react77.useState)(null);
|
|
21711
|
+
const [userOpHash, setUserOpHash] = (0, import_react77.useState)(null);
|
|
21712
|
+
const sendTransaction = (0, import_react77.useCallback)(
|
|
21558
21713
|
async (params) => {
|
|
21559
21714
|
if (!session || !address) {
|
|
21560
21715
|
setError("No active session");
|
|
@@ -21651,7 +21806,7 @@ function useSendTransaction() {
|
|
|
21651
21806
|
},
|
|
21652
21807
|
[session, address]
|
|
21653
21808
|
);
|
|
21654
|
-
const reset = (0,
|
|
21809
|
+
const reset = (0, import_react77.useCallback)(() => {
|
|
21655
21810
|
setError(null);
|
|
21656
21811
|
setUserOpHash(null);
|
|
21657
21812
|
setIsLoading(false);
|
|
@@ -21664,10 +21819,10 @@ function useSendTransaction() {
|
|
|
21664
21819
|
reset
|
|
21665
21820
|
};
|
|
21666
21821
|
}
|
|
21667
|
-
var
|
|
21822
|
+
var import_react77, import_viem14, ERC20_TRANSFER_ABI, ERC721_SAFE_TRANSFER_ABI, ERC1155_SAFE_TRANSFER_ABI;
|
|
21668
21823
|
var init_useSendTransaction = __esm({
|
|
21669
21824
|
"src/hooks/useSendTransaction.ts"() {
|
|
21670
|
-
|
|
21825
|
+
import_react77 = require("react");
|
|
21671
21826
|
import_viem14 = require("viem");
|
|
21672
21827
|
init_SessionContext();
|
|
21673
21828
|
init_account2();
|
|
@@ -21810,7 +21965,7 @@ var init_AssetInputIcon = __esm({
|
|
|
21810
21965
|
|
|
21811
21966
|
// src/internal/components/SendMenu/send/components/NftDisplayCard.tsx
|
|
21812
21967
|
function NftDisplayCard({ asset }) {
|
|
21813
|
-
const [imageError, setImageError] = (0,
|
|
21968
|
+
const [imageError, setImageError] = (0, import_react78.useState)(false);
|
|
21814
21969
|
const nftImage = asset.image || asset.nftMetadata?.image;
|
|
21815
21970
|
return /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)("div", { className: "flex items-center gap-3 p-3 rounded-[var(--ui-kit-el-bdrs)] bg-[var(--ui-kit-bg-secondary)]", children: [
|
|
21816
21971
|
nftImage && !imageError ? /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|
|
@@ -21838,22 +21993,22 @@ function NftDisplayCard({ asset }) {
|
|
|
21838
21993
|
] })
|
|
21839
21994
|
] });
|
|
21840
21995
|
}
|
|
21841
|
-
var import_lucide_react65,
|
|
21996
|
+
var import_lucide_react65, import_react78, import_jsx_runtime104;
|
|
21842
21997
|
var init_NftDisplayCard = __esm({
|
|
21843
21998
|
"src/internal/components/SendMenu/send/components/NftDisplayCard.tsx"() {
|
|
21844
21999
|
import_lucide_react65 = require("lucide-react");
|
|
21845
|
-
|
|
22000
|
+
import_react78 = require("react");
|
|
21846
22001
|
import_jsx_runtime104 = require("react/jsx-runtime");
|
|
21847
22002
|
}
|
|
21848
22003
|
});
|
|
21849
22004
|
|
|
21850
22005
|
// src/internal/components/SendMenu/send/useSendStore.ts
|
|
21851
|
-
var
|
|
22006
|
+
var import_zustand14, useSendStore;
|
|
21852
22007
|
var init_useSendStore = __esm({
|
|
21853
22008
|
"src/internal/components/SendMenu/send/useSendStore.ts"() {
|
|
21854
|
-
|
|
22009
|
+
import_zustand14 = require("zustand");
|
|
21855
22010
|
init_useFlowSelector();
|
|
21856
|
-
useSendStore = (0,
|
|
22011
|
+
useSendStore = (0, import_zustand14.create)((set) => ({
|
|
21857
22012
|
recipient: "",
|
|
21858
22013
|
//
|
|
21859
22014
|
amount: "",
|
|
@@ -22001,11 +22156,11 @@ function NicknameData(props) {
|
|
|
22001
22156
|
isWalletNotSetup,
|
|
22002
22157
|
isFrozen
|
|
22003
22158
|
} = resolvedNicknameData;
|
|
22004
|
-
(0,
|
|
22159
|
+
(0, import_react79.useEffect)(() => {
|
|
22005
22160
|
if (!resolvedNicknameData?.data?.fingerprint || !isNicknameInput) return;
|
|
22006
22161
|
useFlowSelectorStore.getState().setRenderKey(`nickname-resolved-${Date.now()}`);
|
|
22007
22162
|
}, [resolvedNicknameData, isNicknameInput]);
|
|
22008
|
-
(0,
|
|
22163
|
+
(0, import_react79.useEffect)(() => {
|
|
22009
22164
|
if (isResolving) return;
|
|
22010
22165
|
let errMessage = null;
|
|
22011
22166
|
switch (true) {
|
|
@@ -22060,11 +22215,11 @@ function NicknameData(props) {
|
|
|
22060
22215
|
] })
|
|
22061
22216
|
] });
|
|
22062
22217
|
}
|
|
22063
|
-
var import_lucide_react66,
|
|
22218
|
+
var import_lucide_react66, import_react79, import_jsx_runtime106;
|
|
22064
22219
|
var init_NicknameData = __esm({
|
|
22065
22220
|
"src/internal/components/SendMenu/send/components/NicknameData.tsx"() {
|
|
22066
22221
|
import_lucide_react66 = require("lucide-react");
|
|
22067
|
-
|
|
22222
|
+
import_react79 = require("react");
|
|
22068
22223
|
init_no_image();
|
|
22069
22224
|
init_utils2();
|
|
22070
22225
|
init_useFlowSelector();
|
|
@@ -22090,7 +22245,7 @@ function isNftAsset4(asset) {
|
|
|
22090
22245
|
function useTokenBalance(asset) {
|
|
22091
22246
|
const address = useSession((st) => st.address);
|
|
22092
22247
|
const chainConfig = useSession((st) => st.chainConfig);
|
|
22093
|
-
return (0,
|
|
22248
|
+
return (0, import_react_query50.useQuery)({
|
|
22094
22249
|
retry: false,
|
|
22095
22250
|
enabled: !!address && !!chainConfig?.id && !!asset?.symbol,
|
|
22096
22251
|
refetchInterval: 5e3,
|
|
@@ -22154,11 +22309,11 @@ function useTokenBalance(asset) {
|
|
|
22154
22309
|
}
|
|
22155
22310
|
});
|
|
22156
22311
|
}
|
|
22157
|
-
var
|
|
22312
|
+
var import_react_query50, import_viem17, SEND_TOKEN_BALANCE_QUERY_KEY;
|
|
22158
22313
|
var init_useTokenBalance = __esm({
|
|
22159
22314
|
"src/internal/components/SendMenu/send/useTokenBalance.ts"() {
|
|
22160
22315
|
init_SessionContext();
|
|
22161
|
-
|
|
22316
|
+
import_react_query50 = require("@tanstack/react-query");
|
|
22162
22317
|
import_viem17 = require("viem");
|
|
22163
22318
|
SEND_TOKEN_BALANCE_QUERY_KEY = "current-chain-send-token-balance-query";
|
|
22164
22319
|
}
|
|
@@ -22386,7 +22541,7 @@ function ConfirmSendStep(props) {
|
|
|
22386
22541
|
const isNft = isNftAsset3(selectedAsset);
|
|
22387
22542
|
const isSecurity = isSecurityToken2(selectedAsset);
|
|
22388
22543
|
const effectiveAddress = isNicknameInput ? resolvedAddress : recipient;
|
|
22389
|
-
const { mutate: handleConfirm, isPending: isTransactionPending } = (0,
|
|
22544
|
+
const { mutate: handleConfirm, isPending: isTransactionPending } = (0, import_react_query51.useMutation)({
|
|
22390
22545
|
mutationFn: async () => {
|
|
22391
22546
|
if (!effectiveAddress || !selectedAsset) return;
|
|
22392
22547
|
setTxStep("pending");
|
|
@@ -22540,12 +22695,12 @@ function ConfirmSendStep(props) {
|
|
|
22540
22695
|
)
|
|
22541
22696
|
] });
|
|
22542
22697
|
}
|
|
22543
|
-
var
|
|
22698
|
+
var import_react_query51, import_lucide_react68, import_jsx_runtime108;
|
|
22544
22699
|
var init_ConfirmSendStep = __esm({
|
|
22545
22700
|
"src/internal/components/SendMenu/send/sendSteps/ConfirmSendStep.tsx"() {
|
|
22546
22701
|
init_SessionContext();
|
|
22547
22702
|
init_i18n();
|
|
22548
|
-
|
|
22703
|
+
import_react_query51 = require("@tanstack/react-query");
|
|
22549
22704
|
import_lucide_react68 = require("lucide-react");
|
|
22550
22705
|
init_priceFormatter();
|
|
22551
22706
|
init_utils2();
|
|
@@ -22585,10 +22740,10 @@ function SendMenu() {
|
|
|
22585
22740
|
userOpHash,
|
|
22586
22741
|
reset
|
|
22587
22742
|
} = useSendTransaction();
|
|
22588
|
-
(0,
|
|
22743
|
+
(0, import_react80.useEffect)(() => {
|
|
22589
22744
|
useFlowSelectorStore.getState().setIsUiLocked(isAssetsLoading || isTransactionPending);
|
|
22590
22745
|
}, [isAssetsLoading, isTransactionPending]);
|
|
22591
|
-
(0,
|
|
22746
|
+
(0, import_react80.useEffect)(() => {
|
|
22592
22747
|
useFlowSelectorStore.getState().setError(sendTransactionError || null);
|
|
22593
22748
|
}, [sendTransactionError]);
|
|
22594
22749
|
const {
|
|
@@ -22603,7 +22758,7 @@ function SendMenu() {
|
|
|
22603
22758
|
} = useSendStore();
|
|
22604
22759
|
const isNft = isNftAsset3(selectedAsset);
|
|
22605
22760
|
const isSecurity = isSecurityToken2(selectedAsset);
|
|
22606
|
-
(0,
|
|
22761
|
+
(0, import_react80.useEffect)(() => {
|
|
22607
22762
|
const shouldDefaultAsset = assets.length > 0 && !selectedAsset;
|
|
22608
22763
|
if (!shouldDefaultAsset) return;
|
|
22609
22764
|
const chainNativeCurrency = useSession.getState().chainConfig?.nativeCurrency;
|
|
@@ -22613,7 +22768,7 @@ function SendMenu() {
|
|
|
22613
22768
|
if (isBalance(erc20)) return setSelectedAsset(erc20);
|
|
22614
22769
|
setSelectedAsset(assets[0]);
|
|
22615
22770
|
}, [assets, selectedAsset]);
|
|
22616
|
-
(0,
|
|
22771
|
+
(0, import_react80.useEffect)(
|
|
22617
22772
|
() => () => {
|
|
22618
22773
|
setSelectedAsset(null);
|
|
22619
22774
|
setRecipient("");
|
|
@@ -22626,7 +22781,7 @@ function SendMenu() {
|
|
|
22626
22781
|
const isNicknameInput = looksLikeNickname(recipient);
|
|
22627
22782
|
const resolvedNicknameData = useNicknameResolve(recipient, { enabled: isNicknameInput, chainId: activeChainId });
|
|
22628
22783
|
const effectiveAddress = isNicknameInput ? resolvedNicknameData?.resolvedAddress : recipient;
|
|
22629
|
-
const complianceAmount = (0,
|
|
22784
|
+
const complianceAmount = (0, import_react80.useMemo)(() => {
|
|
22630
22785
|
if (!isSecurity || !amount || !selectedAsset) return void 0;
|
|
22631
22786
|
try {
|
|
22632
22787
|
return (0, import_viem19.parseUnits)(amount, selectedAsset.decimals || 18);
|
|
@@ -22641,7 +22796,7 @@ function SendMenu() {
|
|
|
22641
22796
|
enabled: isSecurity && !!effectiveAddress && !!complianceAmount,
|
|
22642
22797
|
chainId: activeChainId
|
|
22643
22798
|
});
|
|
22644
|
-
(0,
|
|
22799
|
+
(0, import_react80.useEffect)(() => {
|
|
22645
22800
|
const updateMenuTitle = useFlowSelectorStore.getState().setMenuTitle;
|
|
22646
22801
|
switch (true) {
|
|
22647
22802
|
case txStep === "select-asset":
|
|
@@ -22711,7 +22866,7 @@ function SendMenu() {
|
|
|
22711
22866
|
] })
|
|
22712
22867
|
] });
|
|
22713
22868
|
}
|
|
22714
|
-
var import_lucide_react69,
|
|
22869
|
+
var import_lucide_react69, import_react80, import_viem19, import_jsx_runtime109;
|
|
22715
22870
|
var init_SendMenu = __esm({
|
|
22716
22871
|
"src/internal/components/SendMenu/send/SendMenu.tsx"() {
|
|
22717
22872
|
init_SessionContext();
|
|
@@ -22720,7 +22875,7 @@ var init_SendMenu = __esm({
|
|
|
22720
22875
|
init_useSendTransaction();
|
|
22721
22876
|
init_useT();
|
|
22722
22877
|
import_lucide_react69 = require("lucide-react");
|
|
22723
|
-
|
|
22878
|
+
import_react80 = require("react");
|
|
22724
22879
|
import_viem19 = require("viem");
|
|
22725
22880
|
init_useBlockscoutAssets();
|
|
22726
22881
|
init_useLayoutDataStore();
|
|
@@ -22805,7 +22960,7 @@ function SendFlowSelector() {
|
|
|
22805
22960
|
const error = useFlowSelectorStore((st) => st.error);
|
|
22806
22961
|
const menuTitle = useFlowSelectorStore((st) => st.menuTitle);
|
|
22807
22962
|
const selectorFlow = useFlowSelectorStore((st) => st.flow);
|
|
22808
|
-
(0,
|
|
22963
|
+
(0, import_react81.useEffect)(
|
|
22809
22964
|
() => () => {
|
|
22810
22965
|
useFlowSelectorStore.getState().setError(null);
|
|
22811
22966
|
},
|
|
@@ -22882,12 +23037,12 @@ function SendFlowSelector() {
|
|
|
22882
23037
|
}
|
|
22883
23038
|
);
|
|
22884
23039
|
}
|
|
22885
|
-
var import_lucide_react70,
|
|
23040
|
+
var import_lucide_react70, import_react81, import_jsx_runtime110, SELECTOR_FLOW;
|
|
22886
23041
|
var init_SendFlowSelector = __esm({
|
|
22887
23042
|
"src/internal/components/SendMenu/SendFlowSelector.tsx"() {
|
|
22888
23043
|
init_i18n();
|
|
22889
23044
|
import_lucide_react70 = require("lucide-react");
|
|
22890
|
-
|
|
23045
|
+
import_react81 = require("react");
|
|
22891
23046
|
init_useLayoutDataStore();
|
|
22892
23047
|
init_useLayoutStore();
|
|
22893
23048
|
init_utils2();
|
|
@@ -22942,12 +23097,12 @@ function getServerSnapshot() {
|
|
|
22942
23097
|
return false;
|
|
22943
23098
|
}
|
|
22944
23099
|
function useProMode() {
|
|
22945
|
-
return (0,
|
|
23100
|
+
return (0, import_react82.useSyncExternalStore)(subscribe, getSnapshot, getServerSnapshot);
|
|
22946
23101
|
}
|
|
22947
|
-
var
|
|
23102
|
+
var import_react82, STORAGE_KEY, EVENT_NAME;
|
|
22948
23103
|
var init_pro_mode = __esm({
|
|
22949
23104
|
"src/internal/lib/pro-mode.ts"() {
|
|
22950
|
-
|
|
23105
|
+
import_react82 = require("react");
|
|
22951
23106
|
STORAGE_KEY = "embarkai_pro_mode";
|
|
22952
23107
|
EVENT_NAME = "embarkai-pro-mode-changed";
|
|
22953
23108
|
}
|
|
@@ -22989,7 +23144,7 @@ function useSettingsButtons() {
|
|
|
22989
23144
|
if (proMode) {
|
|
22990
23145
|
settingsButtons.push({ id: "devices" /* DEVICES */, name: "Guardians", Icon: import_lucide_react72.HardDrive });
|
|
22991
23146
|
}
|
|
22992
|
-
(0,
|
|
23147
|
+
(0, import_react83.useEffect)(() => {
|
|
22993
23148
|
const cssvEl = document.querySelector(".embarkai-ui-scope");
|
|
22994
23149
|
if (!cssvEl || !window?.getComputedStyle) {
|
|
22995
23150
|
return;
|
|
@@ -23011,7 +23166,7 @@ function SettingsMenu() {
|
|
|
23011
23166
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
23012
23167
|
const settingsButtons = useSettingsButtons();
|
|
23013
23168
|
useProvidersList();
|
|
23014
|
-
(0,
|
|
23169
|
+
(0, import_react_query52.useQuery)({
|
|
23015
23170
|
retry: 1,
|
|
23016
23171
|
enabled: !!address,
|
|
23017
23172
|
queryKey: [QUERY_KEYS.nicknameInfo, address],
|
|
@@ -23053,15 +23208,15 @@ function SettingsMenu() {
|
|
|
23053
23208
|
}
|
|
23054
23209
|
);
|
|
23055
23210
|
}
|
|
23056
|
-
var
|
|
23211
|
+
var import_react_query52, import_lucide_react72, import_react83, import_jsx_runtime111;
|
|
23057
23212
|
var init_SettingsMenu = __esm({
|
|
23058
23213
|
"src/internal/components/SettingsMenu/SettingsMenu.tsx"() {
|
|
23059
23214
|
init_ProviderContext();
|
|
23060
23215
|
init_SessionContext();
|
|
23061
23216
|
init_i18n();
|
|
23062
|
-
|
|
23217
|
+
import_react_query52 = require("@tanstack/react-query");
|
|
23063
23218
|
import_lucide_react72 = require("lucide-react");
|
|
23064
|
-
|
|
23219
|
+
import_react83 = require("react");
|
|
23065
23220
|
init_nickname();
|
|
23066
23221
|
init_profile();
|
|
23067
23222
|
init_useLayoutDataStore();
|
|
@@ -23927,26 +24082,26 @@ var init_TransactionsGroup = __esm({
|
|
|
23927
24082
|
|
|
23928
24083
|
// src/internal/components/TransactionsMenu/TransactionsMenu.tsx
|
|
23929
24084
|
function TransactionsMenu() {
|
|
23930
|
-
const qc = (0,
|
|
24085
|
+
const qc = (0, import_react_query53.useQueryClient)();
|
|
23931
24086
|
const address = useSession((st) => st.address);
|
|
23932
24087
|
const chainConfig = useSession((st) => st.chainConfig);
|
|
23933
24088
|
const { t } = useT();
|
|
23934
24089
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
23935
24090
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
23936
|
-
const [expandedGroups, setExpandedGroups] = (0,
|
|
24091
|
+
const [expandedGroups, setExpandedGroups] = (0, import_react84.useState)({});
|
|
23937
24092
|
const historySupported = isTransactionHistorySupported(chainConfig?.id);
|
|
23938
24093
|
const {
|
|
23939
24094
|
data: txHistoryGroups = [],
|
|
23940
24095
|
isLoading: isTxHistoryLoading,
|
|
23941
24096
|
isFetching: isTxHistoryFetching,
|
|
23942
24097
|
error: txHistoryError
|
|
23943
|
-
} = (0,
|
|
24098
|
+
} = (0, import_react_query53.useQuery)({
|
|
23944
24099
|
retry: false,
|
|
23945
24100
|
enabled: !!address && !!chainConfig?.id && historySupported,
|
|
23946
24101
|
queryKey: [TRANSACTIONS_HISTORY_QUERY_KEY, chainConfig.id, address],
|
|
23947
24102
|
queryFn: () => getTransactionsListQuery({ address, chainConfig })
|
|
23948
24103
|
});
|
|
23949
|
-
const refreshTxHistory = (0,
|
|
24104
|
+
const refreshTxHistory = (0, import_react84.useCallback)(
|
|
23950
24105
|
() => qc.invalidateQueries({ queryKey: [TRANSACTIONS_HISTORY_QUERY_KEY, chainConfig.id, address] }),
|
|
23951
24106
|
[qc, chainConfig.id, address]
|
|
23952
24107
|
);
|
|
@@ -23995,14 +24150,14 @@ function TransactionsMenu() {
|
|
|
23995
24150
|
}
|
|
23996
24151
|
);
|
|
23997
24152
|
}
|
|
23998
|
-
var
|
|
24153
|
+
var import_react_query53, import_lucide_react75, import_react84, import_jsx_runtime114;
|
|
23999
24154
|
var init_TransactionsMenu = __esm({
|
|
24000
24155
|
"src/internal/components/TransactionsMenu/TransactionsMenu.tsx"() {
|
|
24001
24156
|
init_SessionContext();
|
|
24002
24157
|
init_i18n();
|
|
24003
|
-
|
|
24158
|
+
import_react_query53 = require("@tanstack/react-query");
|
|
24004
24159
|
import_lucide_react75 = require("lucide-react");
|
|
24005
|
-
|
|
24160
|
+
import_react84 = require("react");
|
|
24006
24161
|
init_useLayoutDataStore();
|
|
24007
24162
|
init_useLayoutStore();
|
|
24008
24163
|
init_Expandable2();
|
|
@@ -24027,7 +24182,7 @@ var PAGE_MAP;
|
|
|
24027
24182
|
var init_PageMap = __esm({
|
|
24028
24183
|
"src/internal/components/PageMap.tsx"() {
|
|
24029
24184
|
init_AuthMenu2();
|
|
24030
|
-
|
|
24185
|
+
init_BuyMenu2();
|
|
24031
24186
|
init_ChainsMenu2();
|
|
24032
24187
|
init_DeviceLinkScreen();
|
|
24033
24188
|
init_DeviceManageScreen();
|
|
@@ -24200,7 +24355,7 @@ function usePageMapper() {
|
|
|
24200
24355
|
setIsDialogOpen,
|
|
24201
24356
|
setIsDialogClosing
|
|
24202
24357
|
} = useLayoutStore();
|
|
24203
|
-
const closeDialog = (0,
|
|
24358
|
+
const closeDialog = (0, import_react85.useCallback)(() => {
|
|
24204
24359
|
setIsDialogClosing(true);
|
|
24205
24360
|
setTimeout(() => {
|
|
24206
24361
|
setDialogContent(null);
|
|
@@ -24211,7 +24366,7 @@ function usePageMapper() {
|
|
|
24211
24366
|
setIsDialogOpen(false);
|
|
24212
24367
|
}, CLEAR_DIALOG_TIMEOUT);
|
|
24213
24368
|
}, [setDialogContent, setDialogDescription, setDialogTitle, setIsDialogForced, setIsDialogOpen, setIsDialogClosing]);
|
|
24214
|
-
const openDialog = (0,
|
|
24369
|
+
const openDialog = (0, import_react85.useCallback)(
|
|
24215
24370
|
(pageItem) => {
|
|
24216
24371
|
const PageContentComponent = pageItem.component;
|
|
24217
24372
|
setDialogTitle(pageItem.title);
|
|
@@ -24221,7 +24376,7 @@ function usePageMapper() {
|
|
|
24221
24376
|
},
|
|
24222
24377
|
[setDialogContent, setDialogDescription, setDialogTitle, setIsDialogOpen]
|
|
24223
24378
|
);
|
|
24224
|
-
(0,
|
|
24379
|
+
(0, import_react85.useEffect)(() => {
|
|
24225
24380
|
if (page === null) return closeDialog();
|
|
24226
24381
|
const pageItem = PAGE_MAP[page];
|
|
24227
24382
|
if (!pageItem) {
|
|
@@ -24232,10 +24387,10 @@ function usePageMapper() {
|
|
|
24232
24387
|
openDialog(pageItem);
|
|
24233
24388
|
}, [page, closeDialog, openDialog]);
|
|
24234
24389
|
}
|
|
24235
|
-
var
|
|
24390
|
+
var import_react85, import_jsx_runtime115, CLEAR_DIALOG_TIMEOUT;
|
|
24236
24391
|
var init_usePageMapper = __esm({
|
|
24237
24392
|
"src/internal/hooks/usePageMapper.tsx"() {
|
|
24238
|
-
|
|
24393
|
+
import_react85 = require("react");
|
|
24239
24394
|
init_PageMap();
|
|
24240
24395
|
init_constants();
|
|
24241
24396
|
init_useLayoutDataStore();
|
|
@@ -24251,32 +24406,32 @@ function useSettingsNotifications() {
|
|
|
24251
24406
|
const setSettingsNotifications = useLayoutDataStore((st) => st.setSettingsNotifications);
|
|
24252
24407
|
const providers = import_auth23.jwtTokenManager.getProviders();
|
|
24253
24408
|
const hasEmail = providers.includes("email");
|
|
24254
|
-
const { data: userProfile = null } = (0,
|
|
24409
|
+
const { data: userProfile = null } = (0, import_react_query54.useQuery)({
|
|
24255
24410
|
retry: false,
|
|
24256
24411
|
enabled: !!address,
|
|
24257
24412
|
queryKey: [QUERY_KEYS.userProfile, address],
|
|
24258
24413
|
queryFn: getUserProfile
|
|
24259
24414
|
});
|
|
24260
|
-
(0,
|
|
24415
|
+
(0, import_react86.useEffect)(() => {
|
|
24261
24416
|
const isKYCVerified = userProfile?.kycDetails?.kycStatus === "verified";
|
|
24262
24417
|
setSettingsNotifications({
|
|
24263
24418
|
...COMPLETE_KYC_PROGRESS,
|
|
24264
24419
|
status: isKYCVerified ? "resolved" : "active"
|
|
24265
24420
|
});
|
|
24266
24421
|
}, [userProfile, setSettingsNotifications]);
|
|
24267
|
-
(0,
|
|
24422
|
+
(0, import_react86.useEffect)(() => {
|
|
24268
24423
|
setSettingsNotifications({
|
|
24269
24424
|
...EMAIL_NOT_CONNECTED_NOTIFICATION,
|
|
24270
24425
|
status: hasEmail ? "resolved" : "active"
|
|
24271
24426
|
});
|
|
24272
24427
|
}, [hasEmail, setSettingsNotifications]);
|
|
24273
24428
|
}
|
|
24274
|
-
var
|
|
24429
|
+
var import_react_query54, import_react86, EMAIL_NOT_CONNECTED_NOTIFICATION, COMPLETE_KYC_PROGRESS;
|
|
24275
24430
|
var init_useSettingsNotifications = __esm({
|
|
24276
24431
|
"src/internal/hooks/useSettingsNotifications.ts"() {
|
|
24277
24432
|
init_SessionContext();
|
|
24278
|
-
|
|
24279
|
-
|
|
24433
|
+
import_react_query54 = require("@tanstack/react-query");
|
|
24434
|
+
import_react86 = require("react");
|
|
24280
24435
|
init_auth();
|
|
24281
24436
|
init_profile();
|
|
24282
24437
|
init_useLayoutDataStore();
|
|
@@ -24299,7 +24454,7 @@ var init_package = __esm({
|
|
|
24299
24454
|
"package.json"() {
|
|
24300
24455
|
package_default = {
|
|
24301
24456
|
name: "@embarkai/ui-kit",
|
|
24302
|
-
version: "0.4.
|
|
24457
|
+
version: "0.4.58",
|
|
24303
24458
|
description: "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
|
|
24304
24459
|
type: "module",
|
|
24305
24460
|
main: "./dist/index.cjs",
|
|
@@ -24401,7 +24556,7 @@ var init_package = __esm({
|
|
|
24401
24556
|
|
|
24402
24557
|
// src/internal/components/Footer/Footer.tsx
|
|
24403
24558
|
function Footer() {
|
|
24404
|
-
const qc = (0,
|
|
24559
|
+
const qc = (0, import_react_query55.useQueryClient)();
|
|
24405
24560
|
const { callbacksRef } = useProviderConfig();
|
|
24406
24561
|
const { t } = useT();
|
|
24407
24562
|
const address = useSession((st) => st.address);
|
|
@@ -24418,7 +24573,7 @@ function Footer() {
|
|
|
24418
24573
|
}
|
|
24419
24574
|
}
|
|
24420
24575
|
});
|
|
24421
|
-
const { mutate: disconnect, isPending: isDisconnecting } = (0,
|
|
24576
|
+
const { mutate: disconnect, isPending: isDisconnecting } = (0, import_react_query55.useMutation)({
|
|
24422
24577
|
mutationFn: async (disconnectAddress) => {
|
|
24423
24578
|
if (!disconnectAddress) throw new Error("No address to disconnect");
|
|
24424
24579
|
const { setError, setStatus, setIsLoading } = useSession.getState();
|
|
@@ -24504,7 +24659,7 @@ function Footer() {
|
|
|
24504
24659
|
}
|
|
24505
24660
|
);
|
|
24506
24661
|
}
|
|
24507
|
-
var
|
|
24662
|
+
var import_react_query55, import_lucide_react76, import_wagmi7, import_jsx_runtime116;
|
|
24508
24663
|
var init_Footer = __esm({
|
|
24509
24664
|
"src/internal/components/Footer/Footer.tsx"() {
|
|
24510
24665
|
init_package();
|
|
@@ -24512,7 +24667,7 @@ var init_Footer = __esm({
|
|
|
24512
24667
|
init_ProviderContext();
|
|
24513
24668
|
init_SessionContext();
|
|
24514
24669
|
init_i18n();
|
|
24515
|
-
|
|
24670
|
+
import_react_query55 = require("@tanstack/react-query");
|
|
24516
24671
|
import_lucide_react76 = require("lucide-react");
|
|
24517
24672
|
import_wagmi7 = require("wagmi");
|
|
24518
24673
|
init_auth();
|
|
@@ -24545,11 +24700,11 @@ function Header() {
|
|
|
24545
24700
|
const chainConfig = useSession((st) => st.chainConfig);
|
|
24546
24701
|
const { t } = useT();
|
|
24547
24702
|
const proMode = useProMode();
|
|
24548
|
-
const [proToast, setProToast] = (0,
|
|
24549
|
-
const [copied, setCopied] = (0,
|
|
24550
|
-
const clickCountRef = (0,
|
|
24551
|
-
const clickTimerRef = (0,
|
|
24552
|
-
const handleAvatarClick = (0,
|
|
24703
|
+
const [proToast, setProToast] = (0, import_react87.useState)(false);
|
|
24704
|
+
const [copied, setCopied] = (0, import_react87.useState)(false);
|
|
24705
|
+
const clickCountRef = (0, import_react87.useRef)(0);
|
|
24706
|
+
const clickTimerRef = (0, import_react87.useRef)(null);
|
|
24707
|
+
const handleAvatarClick = (0, import_react87.useCallback)(() => {
|
|
24553
24708
|
clickCountRef.current += 1;
|
|
24554
24709
|
if (clickTimerRef.current) {
|
|
24555
24710
|
clearTimeout(clickTimerRef.current);
|
|
@@ -24567,7 +24722,7 @@ function Header() {
|
|
|
24567
24722
|
}, 1e3);
|
|
24568
24723
|
}
|
|
24569
24724
|
}, []);
|
|
24570
|
-
const { data: profile, isLoading: isProfileLoading } = (0,
|
|
24725
|
+
const { data: profile, isLoading: isProfileLoading } = (0, import_react_query56.useQuery)({
|
|
24571
24726
|
retry: false,
|
|
24572
24727
|
enabled: !!address,
|
|
24573
24728
|
queryKey: [QUERY_KEYS.userProfile, address],
|
|
@@ -24649,7 +24804,7 @@ function Header() {
|
|
|
24649
24804
|
}
|
|
24650
24805
|
);
|
|
24651
24806
|
}
|
|
24652
|
-
var
|
|
24807
|
+
var import_react_query56, import_lucide_react77, import_react87, import_jsx_runtime117;
|
|
24653
24808
|
var init_Header = __esm({
|
|
24654
24809
|
"src/internal/components/Header/Header.tsx"() {
|
|
24655
24810
|
init_lumia2();
|
|
@@ -24657,9 +24812,9 @@ var init_Header = __esm({
|
|
|
24657
24812
|
init_ProviderContext();
|
|
24658
24813
|
init_SessionContext();
|
|
24659
24814
|
init_useT();
|
|
24660
|
-
|
|
24815
|
+
import_react_query56 = require("@tanstack/react-query");
|
|
24661
24816
|
import_lucide_react77 = require("lucide-react");
|
|
24662
|
-
|
|
24817
|
+
import_react87 = require("react");
|
|
24663
24818
|
init_icons();
|
|
24664
24819
|
init_auth();
|
|
24665
24820
|
init_profile();
|
|
@@ -24687,26 +24842,26 @@ function useDecideContentStyles() {
|
|
|
24687
24842
|
return {
|
|
24688
24843
|
isClosing,
|
|
24689
24844
|
isMobileView,
|
|
24690
|
-
style: (0,
|
|
24845
|
+
style: (0, import_lodash_es13.merge)({}, mobileStyles)
|
|
24691
24846
|
};
|
|
24692
24847
|
}
|
|
24693
|
-
var DialogPrimitive,
|
|
24848
|
+
var DialogPrimitive, import_lodash_es13, import_lucide_react78, import_react88, import_jsx_runtime118, Dialog, DialogPortal, DialogOverlay, CONTENT_BG_SETUP, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription;
|
|
24694
24849
|
var init_dialog = __esm({
|
|
24695
24850
|
"src/internal/components/ui/dialog.tsx"() {
|
|
24696
24851
|
init_utils2();
|
|
24697
24852
|
init_SessionContext();
|
|
24698
24853
|
init_i18n();
|
|
24699
24854
|
DialogPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
24700
|
-
|
|
24855
|
+
import_lodash_es13 = require("lodash-es");
|
|
24701
24856
|
import_lucide_react78 = require("lucide-react");
|
|
24702
|
-
|
|
24857
|
+
import_react88 = require("react");
|
|
24703
24858
|
init_useLayoutDataStore();
|
|
24704
24859
|
init_useLayoutStore();
|
|
24705
24860
|
init_button();
|
|
24706
24861
|
import_jsx_runtime118 = require("react/jsx-runtime");
|
|
24707
24862
|
Dialog = DialogPrimitive.Root;
|
|
24708
24863
|
DialogPortal = DialogPrimitive.Portal;
|
|
24709
|
-
DialogOverlay = (0,
|
|
24864
|
+
DialogOverlay = (0, import_react88.forwardRef)(
|
|
24710
24865
|
({ className, closing, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
|
|
24711
24866
|
DialogPrimitive.Overlay,
|
|
24712
24867
|
{
|
|
@@ -24728,7 +24883,7 @@ var init_dialog = __esm({
|
|
|
24728
24883
|
border: "1px solid var(--ui-kit-bd)",
|
|
24729
24884
|
boxShadow: "var(--ui-kit-shadow, 0px 4px 10px var(--ui-kit-shadow-c, rgba(0, 0, 0, 0.1)))"
|
|
24730
24885
|
};
|
|
24731
|
-
DialogContent = (0,
|
|
24886
|
+
DialogContent = (0, import_react88.forwardRef)(
|
|
24732
24887
|
({ className, children, colorMode, ...props }, ref) => {
|
|
24733
24888
|
const { t, i18n } = useT();
|
|
24734
24889
|
const isSessionLoading = useSession((st) => st.isLoading);
|
|
@@ -24831,7 +24986,7 @@ var init_dialog = __esm({
|
|
|
24831
24986
|
DialogHeader.displayName = "DialogHeader";
|
|
24832
24987
|
DialogFooter = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("div", { className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className), ...props });
|
|
24833
24988
|
DialogFooter.displayName = "DialogFooter";
|
|
24834
|
-
DialogTitle = (0,
|
|
24989
|
+
DialogTitle = (0, import_react88.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
|
|
24835
24990
|
DialogPrimitive.Title,
|
|
24836
24991
|
{
|
|
24837
24992
|
ref,
|
|
@@ -24840,7 +24995,7 @@ var init_dialog = __esm({
|
|
|
24840
24995
|
}
|
|
24841
24996
|
));
|
|
24842
24997
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
24843
|
-
DialogDescription = (0,
|
|
24998
|
+
DialogDescription = (0, import_react88.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(DialogPrimitive.Description, { ref, className: cn("text-sm text-muted-foreground", className), ...props }));
|
|
24844
24999
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
24845
25000
|
}
|
|
24846
25001
|
});
|
|
@@ -24865,7 +25020,7 @@ function Dialog2() {
|
|
|
24865
25020
|
const isWalletLinking = useLayoutDataStore((st) => st.isWalletLinking);
|
|
24866
25021
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
24867
25022
|
const { colorMode, isDialogOpen, dialogTitle, dialogDescription, dialogContent, isDialogForced, setIsSettings } = useLayoutStore();
|
|
24868
|
-
(0,
|
|
25023
|
+
(0, import_react89.useEffect)(() => setIsSettings(!!session), [session, setIsSettings]);
|
|
24869
25024
|
usePageMapper();
|
|
24870
25025
|
useAutoConnect();
|
|
24871
25026
|
useBackupStatusChanges();
|
|
@@ -24903,13 +25058,13 @@ function Dialog2() {
|
|
|
24903
25058
|
}
|
|
24904
25059
|
);
|
|
24905
25060
|
}
|
|
24906
|
-
var import_framer_motion,
|
|
25061
|
+
var import_framer_motion, import_react89, import_jsx_runtime120;
|
|
24907
25062
|
var init_Dialog = __esm({
|
|
24908
25063
|
"src/internal/components/Dialog/Dialog.tsx"() {
|
|
24909
25064
|
init_ProviderContext();
|
|
24910
25065
|
init_SessionContext();
|
|
24911
25066
|
import_framer_motion = require("framer-motion");
|
|
24912
|
-
|
|
25067
|
+
import_react89 = require("react");
|
|
24913
25068
|
init_constants();
|
|
24914
25069
|
init_useAutoConnect();
|
|
24915
25070
|
init_useBackupStatusChanges();
|
|
@@ -24935,14 +25090,14 @@ var init_Dialog2 = __esm({
|
|
|
24935
25090
|
});
|
|
24936
25091
|
|
|
24937
25092
|
// src/internal/components/TssManager.tsx
|
|
24938
|
-
var
|
|
25093
|
+
var import_react90, TssManagerWithRef;
|
|
24939
25094
|
var init_TssManager = __esm({
|
|
24940
25095
|
"src/internal/components/TssManager.tsx"() {
|
|
24941
25096
|
init_SessionContext();
|
|
24942
|
-
|
|
25097
|
+
import_react90 = __toESM(require("react"), 1);
|
|
24943
25098
|
init_auth();
|
|
24944
25099
|
init_clients();
|
|
24945
|
-
TssManagerWithRef =
|
|
25100
|
+
TssManagerWithRef = import_react90.default.forwardRef((props, ref) => {
|
|
24946
25101
|
const { mpcPin } = props;
|
|
24947
25102
|
const usePaymaster = useSession((st) => st.usePaymaster);
|
|
24948
25103
|
const publicClient = useSession((st) => st.publicClient);
|
|
@@ -24950,14 +25105,14 @@ var init_TssManager = __esm({
|
|
|
24950
25105
|
const setStatus = useSession((st) => st.setStatus);
|
|
24951
25106
|
const setSession = useSession((st) => st.setSession);
|
|
24952
25107
|
const setAddress = useSession((st) => st.setAddress);
|
|
24953
|
-
const onSessionCreated = (0,
|
|
25108
|
+
const onSessionCreated = (0, import_react90.useCallback)(
|
|
24954
25109
|
(session, address) => {
|
|
24955
25110
|
setSession(session);
|
|
24956
25111
|
setAddress(address);
|
|
24957
25112
|
},
|
|
24958
25113
|
[setSession, setAddress]
|
|
24959
25114
|
);
|
|
24960
|
-
const createSessionWithKeyshare =
|
|
25115
|
+
const createSessionWithKeyshare = import_react90.default.useCallback(
|
|
24961
25116
|
async (userId, hasServerKeyshare, isNewUser) => {
|
|
24962
25117
|
setStatus("checking key management setup...");
|
|
24963
25118
|
await ensureKeyshare(userId, hasServerKeyshare, setStatus, isNewUser);
|
|
@@ -24982,7 +25137,7 @@ var init_TssManager = __esm({
|
|
|
24982
25137
|
},
|
|
24983
25138
|
[setStatus, usePaymaster, activeChainId, publicClient, mpcPin]
|
|
24984
25139
|
);
|
|
24985
|
-
|
|
25140
|
+
import_react90.default.useImperativeHandle(ref, () => ({ createSessionWithKeyshare }), [createSessionWithKeyshare]);
|
|
24986
25141
|
return null;
|
|
24987
25142
|
});
|
|
24988
25143
|
}
|
|
@@ -24990,7 +25145,7 @@ var init_TssManager = __esm({
|
|
|
24990
25145
|
|
|
24991
25146
|
// src/internal/components/WalletConnectHandler.tsx
|
|
24992
25147
|
function WalletConnectHandler() {
|
|
24993
|
-
const qc = (0,
|
|
25148
|
+
const qc = (0, import_react_query57.useQueryClient)();
|
|
24994
25149
|
const { callbacksRef } = useProviderConfig();
|
|
24995
25150
|
const passportWalletAddress = useSession((st) => st.address);
|
|
24996
25151
|
const { address: walletAddress, isConnected, chain, connector } = (0, import_wagmi8.useAccount)();
|
|
@@ -25010,7 +25165,7 @@ function WalletConnectHandler() {
|
|
|
25010
25165
|
const projectId = providerConfig?.projectId;
|
|
25011
25166
|
const setExternalWallet = useExternalWalletStore((st) => st.setExternalWallet);
|
|
25012
25167
|
const setPendingWalletLogin = useLayoutDataStore((st) => st.setPendingWalletLogin);
|
|
25013
|
-
const onLinkingComplete = (0,
|
|
25168
|
+
const onLinkingComplete = (0, import_react91.useCallback)(
|
|
25014
25169
|
async (success) => {
|
|
25015
25170
|
setIsWalletLinking(false);
|
|
25016
25171
|
if (!success && !passportWalletAddress) {
|
|
@@ -25039,10 +25194,10 @@ function WalletConnectHandler() {
|
|
|
25039
25194
|
},
|
|
25040
25195
|
[qc, passportWalletAddress, setProviderType, setPage, setIsWalletLinking]
|
|
25041
25196
|
);
|
|
25042
|
-
const [hasStartedLinking, setHasStartedLinking] =
|
|
25043
|
-
const [modalWasOpened, setModalWasOpened] =
|
|
25044
|
-
const [pendingModalOpen, setPendingModalOpen] =
|
|
25045
|
-
(0,
|
|
25197
|
+
const [hasStartedLinking, setHasStartedLinking] = import_react91.default.useState(false);
|
|
25198
|
+
const [modalWasOpened, setModalWasOpened] = import_react91.default.useState(false);
|
|
25199
|
+
const [pendingModalOpen, setPendingModalOpen] = import_react91.default.useState(false);
|
|
25200
|
+
(0, import_react91.useEffect)(() => {
|
|
25046
25201
|
if (isWalletLinking && !hasStartedLinking) {
|
|
25047
25202
|
console.log("[WalletConnectHandler] Starting wallet link flow:", {
|
|
25048
25203
|
isConnected,
|
|
@@ -25080,18 +25235,18 @@ function WalletConnectHandler() {
|
|
|
25080
25235
|
setProviderType,
|
|
25081
25236
|
walletMode
|
|
25082
25237
|
]);
|
|
25083
|
-
(0,
|
|
25238
|
+
(0, import_react91.useEffect)(() => {
|
|
25084
25239
|
if (pendingModalOpen && !isConnected && openConnectModal) {
|
|
25085
25240
|
setPendingModalOpen(false);
|
|
25086
25241
|
openConnectModal();
|
|
25087
25242
|
}
|
|
25088
25243
|
}, [pendingModalOpen, isConnected, openConnectModal]);
|
|
25089
|
-
(0,
|
|
25244
|
+
(0, import_react91.useEffect)(() => {
|
|
25090
25245
|
if (connectModalOpen && hasStartedLinking) {
|
|
25091
25246
|
setModalWasOpened(true);
|
|
25092
25247
|
}
|
|
25093
25248
|
}, [connectModalOpen, hasStartedLinking]);
|
|
25094
|
-
(0,
|
|
25249
|
+
(0, import_react91.useEffect)(() => {
|
|
25095
25250
|
if (modalWasOpened && !connectModalOpen && !isConnected && isWalletLinking) {
|
|
25096
25251
|
console.log("[WalletConnectHandler] Modal closed without connecting");
|
|
25097
25252
|
onLinkingComplete(false);
|
|
@@ -25099,7 +25254,7 @@ function WalletConnectHandler() {
|
|
|
25099
25254
|
setModalWasOpened(false);
|
|
25100
25255
|
}
|
|
25101
25256
|
}, [connectModalOpen, modalWasOpened, isConnected, isWalletLinking]);
|
|
25102
|
-
(0,
|
|
25257
|
+
(0, import_react91.useEffect)(() => {
|
|
25103
25258
|
if (isWalletLinking) {
|
|
25104
25259
|
const timeout = setTimeout(() => {
|
|
25105
25260
|
console.warn("[WalletConnectHandler] Wallet linking timed out, resetting state");
|
|
@@ -25118,7 +25273,7 @@ function WalletConnectHandler() {
|
|
|
25118
25273
|
}
|
|
25119
25274
|
}, [isWalletLinking, setIsWalletLinking, disconnect]);
|
|
25120
25275
|
const isAuthFlow = !passportWalletAddress;
|
|
25121
|
-
const { mutate: handleWalletSign, isPending: isWalletSigning } = (0,
|
|
25276
|
+
const { mutate: handleWalletSign, isPending: isWalletSigning } = (0, import_react_query57.useMutation)({
|
|
25122
25277
|
mutationFn: async (payload) => {
|
|
25123
25278
|
const { chainId, signingWalletAddress } = payload;
|
|
25124
25279
|
if (!signingWalletAddress || !chainId) {
|
|
@@ -25219,7 +25374,7 @@ function WalletConnectHandler() {
|
|
|
25219
25374
|
setPage(passportWalletAddress ? "manage-wallet" /* MANAGE_WALLET */ : "auth" /* AUTH */);
|
|
25220
25375
|
}
|
|
25221
25376
|
});
|
|
25222
|
-
(0,
|
|
25377
|
+
(0, import_react91.useEffect)(() => {
|
|
25223
25378
|
if (!!chain?.id && isConnected && walletAddress && isWalletLinking && hasStartedLinking && modalWasOpened && !pendingModalOpen) {
|
|
25224
25379
|
console.log("[WalletConnectHandler] handleWalletSign triggered");
|
|
25225
25380
|
if (!passportWalletAddress) {
|
|
@@ -25229,7 +25384,7 @@ function WalletConnectHandler() {
|
|
|
25229
25384
|
handleWalletSign({ chainId: chain.id, signingWalletAddress: walletAddress });
|
|
25230
25385
|
}
|
|
25231
25386
|
}, [chain, isConnected, walletAddress, isWalletLinking, hasStartedLinking, modalWasOpened, pendingModalOpen]);
|
|
25232
|
-
(0,
|
|
25387
|
+
(0, import_react91.useEffect)(() => {
|
|
25233
25388
|
if (isConnected && !chain?.id && isWalletLinking && hasStartedLinking && !connectModalOpen && !isWalletSigning) {
|
|
25234
25389
|
const timeout = setTimeout(() => {
|
|
25235
25390
|
console.warn("[WalletConnectHandler] Wallet connected but chain info missing, resetting");
|
|
@@ -25251,15 +25406,15 @@ function WalletConnectHandler() {
|
|
|
25251
25406
|
]);
|
|
25252
25407
|
return null;
|
|
25253
25408
|
}
|
|
25254
|
-
var import_rainbowkit2,
|
|
25409
|
+
var import_rainbowkit2, import_react_query57, import_react91, import_wagmi8;
|
|
25255
25410
|
var init_WalletConnectHandler = __esm({
|
|
25256
25411
|
"src/internal/components/WalletConnectHandler.tsx"() {
|
|
25257
25412
|
init_ProviderContext();
|
|
25258
25413
|
init_SessionContext();
|
|
25259
25414
|
init_linkedProfiles();
|
|
25260
25415
|
import_rainbowkit2 = require("@rainbow-me/rainbowkit");
|
|
25261
|
-
|
|
25262
|
-
|
|
25416
|
+
import_react_query57 = require("@tanstack/react-query");
|
|
25417
|
+
import_react91 = __toESM(require("react"), 1);
|
|
25263
25418
|
import_wagmi8 = require("wagmi");
|
|
25264
25419
|
init_wallet();
|
|
25265
25420
|
init_AuthMenu2();
|
|
@@ -25280,13 +25435,13 @@ function DirectWalletHandler() {
|
|
|
25280
25435
|
const setExternalChainId = useExternalWalletStore((st) => st.setExternalChainId);
|
|
25281
25436
|
const setConfigMode = useExternalWalletStore((st) => st.setConfigMode);
|
|
25282
25437
|
const setActiveMode = useExternalWalletStore((st) => st.setActiveMode);
|
|
25283
|
-
(0,
|
|
25438
|
+
(0, import_react92.useEffect)(() => {
|
|
25284
25439
|
setConfigMode(walletMode);
|
|
25285
25440
|
if (walletMode !== "both") {
|
|
25286
25441
|
setActiveMode(walletMode);
|
|
25287
25442
|
}
|
|
25288
25443
|
}, [walletMode, setConfigMode, setActiveMode]);
|
|
25289
|
-
(0,
|
|
25444
|
+
(0, import_react92.useEffect)(() => {
|
|
25290
25445
|
if (isConnected && address && !isExternalConnected && connector && chain?.id) {
|
|
25291
25446
|
setExternalWallet({
|
|
25292
25447
|
address,
|
|
@@ -25295,17 +25450,17 @@ function DirectWalletHandler() {
|
|
|
25295
25450
|
});
|
|
25296
25451
|
}
|
|
25297
25452
|
}, [isConnected, address, isExternalConnected, connector, chain?.id, setExternalWallet]);
|
|
25298
|
-
(0,
|
|
25453
|
+
(0, import_react92.useEffect)(() => {
|
|
25299
25454
|
if (isExternalConnected && !isConnected) {
|
|
25300
25455
|
clearExternalWallet();
|
|
25301
25456
|
}
|
|
25302
25457
|
}, [isConnected, isExternalConnected, clearExternalWallet]);
|
|
25303
|
-
(0,
|
|
25458
|
+
(0, import_react92.useEffect)(() => {
|
|
25304
25459
|
if (isExternalConnected && isConnected && chain?.id) {
|
|
25305
25460
|
setExternalChainId(chain.id);
|
|
25306
25461
|
}
|
|
25307
25462
|
}, [chain?.id, isConnected, isExternalConnected, setExternalChainId]);
|
|
25308
|
-
(0,
|
|
25463
|
+
(0, import_react92.useEffect)(() => {
|
|
25309
25464
|
if (isExternalConnected && isConnected && address && address !== externalAddress && connector && chain?.id) {
|
|
25310
25465
|
setExternalWallet({
|
|
25311
25466
|
address,
|
|
@@ -25316,10 +25471,10 @@ function DirectWalletHandler() {
|
|
|
25316
25471
|
}, [address, isConnected, isExternalConnected, externalAddress, chain?.id, connector, setExternalWallet]);
|
|
25317
25472
|
return null;
|
|
25318
25473
|
}
|
|
25319
|
-
var
|
|
25474
|
+
var import_react92, import_wagmi9;
|
|
25320
25475
|
var init_DirectWalletHandler = __esm({
|
|
25321
25476
|
"src/internal/components/DirectWalletHandler.tsx"() {
|
|
25322
|
-
|
|
25477
|
+
import_react92 = require("react");
|
|
25323
25478
|
import_wagmi9 = require("wagmi");
|
|
25324
25479
|
init_ProviderContext();
|
|
25325
25480
|
init_useExternalWalletStore();
|
|
@@ -25344,7 +25499,7 @@ function waitForStoreHydration() {
|
|
|
25344
25499
|
}
|
|
25345
25500
|
function SessionProvider({ children }) {
|
|
25346
25501
|
const config = useProviderConfig().config;
|
|
25347
|
-
return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(
|
|
25502
|
+
return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(import_react93.Fragment, { children: [
|
|
25348
25503
|
children,
|
|
25349
25504
|
config.current?.wallet?.enabled && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(WalletConnectHandler, {}),
|
|
25350
25505
|
config.current?.wallet?.enabled && (config.current?.wallet?.mode === "direct" || config.current?.wallet?.mode === "both") && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(DirectWalletHandler, {}),
|
|
@@ -25359,12 +25514,12 @@ function SessionProvider({ children }) {
|
|
|
25359
25514
|
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Dialog2, {})
|
|
25360
25515
|
] });
|
|
25361
25516
|
}
|
|
25362
|
-
var import_read21,
|
|
25517
|
+
var import_read21, import_react93, import_zustand15, import_middleware4, import_jsx_runtime121, useSession, requireActiveChainId;
|
|
25363
25518
|
var init_SessionContext = __esm({
|
|
25364
25519
|
"src/context/SessionContext.tsx"() {
|
|
25365
25520
|
import_read21 = require("@embarkai/core/read");
|
|
25366
|
-
|
|
25367
|
-
|
|
25521
|
+
import_react93 = require("react");
|
|
25522
|
+
import_zustand15 = require("zustand");
|
|
25368
25523
|
import_middleware4 = require("zustand/middleware");
|
|
25369
25524
|
init_BalanceFeedProvider2();
|
|
25370
25525
|
init_ChainSync2();
|
|
@@ -25374,7 +25529,7 @@ var init_SessionContext = __esm({
|
|
|
25374
25529
|
init_DirectWalletHandler();
|
|
25375
25530
|
init_ProviderContext();
|
|
25376
25531
|
import_jsx_runtime121 = require("react/jsx-runtime");
|
|
25377
|
-
useSession = (0,
|
|
25532
|
+
useSession = (0, import_zustand15.create)()(
|
|
25378
25533
|
(0, import_middleware4.persist)(
|
|
25379
25534
|
(set) => ({
|
|
25380
25535
|
isLoading: false,
|
|
@@ -26342,13 +26497,13 @@ async function clearLocalKeyshare(userId) {
|
|
|
26342
26497
|
console.log("[clearLocalKeyshare] Keyshares are now managed by secure iframe");
|
|
26343
26498
|
console.log("[clearLocalKeyshare] To clear keyshares, user must revoke authorization in iframe");
|
|
26344
26499
|
if (typeof window !== "undefined" && window.localStorage) {
|
|
26345
|
-
const
|
|
26500
|
+
const keys2 = [
|
|
26346
26501
|
`tss.${userId}.keyshare`,
|
|
26347
26502
|
`tss.${userId}.ownerAddress`,
|
|
26348
26503
|
`tss.${userId}.sessionId`,
|
|
26349
26504
|
...Object.keys(window.localStorage).filter((key) => key.startsWith(`tss.${userId}.dkg.`))
|
|
26350
26505
|
];
|
|
26351
|
-
|
|
26506
|
+
keys2.forEach((key) => window.localStorage.removeItem(key));
|
|
26352
26507
|
console.log("[clearLocalKeyshare] Cleared old localStorage keys for migration");
|
|
26353
26508
|
}
|
|
26354
26509
|
}
|
|
@@ -28032,7 +28187,7 @@ var init_rainbowkit = __esm({
|
|
|
28032
28187
|
function RainbowKitProvider({ children }) {
|
|
28033
28188
|
const config = useProviderConfig().config;
|
|
28034
28189
|
const colorMode = useLayoutStore((st) => st.colorMode);
|
|
28035
|
-
const rainbowConfig = (0,
|
|
28190
|
+
const rainbowConfig = (0, import_react94.useMemo)(
|
|
28036
28191
|
() => createRainbowConfig({
|
|
28037
28192
|
projectId: config.current?.wallet?.walletConnectProjectId,
|
|
28038
28193
|
allowedWallets: config.current?.wallet?.allowedWallets,
|
|
@@ -28046,7 +28201,7 @@ function RainbowKitProvider({ children }) {
|
|
|
28046
28201
|
config.current?.wallet?.walletConnectProjectId
|
|
28047
28202
|
]
|
|
28048
28203
|
);
|
|
28049
|
-
const customTheme = (0,
|
|
28204
|
+
const customTheme = (0, import_react94.useMemo)(() => {
|
|
28050
28205
|
if (!config.current?.wallet?.enabled) return {};
|
|
28051
28206
|
return colorMode === "dark" ? {
|
|
28052
28207
|
...(0, import_rainbowkit4.darkTheme)(),
|
|
@@ -28063,11 +28218,11 @@ function RainbowKitProvider({ children }) {
|
|
|
28063
28218
|
if (!config.current?.wallet?.enabled) return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(import_jsx_runtime122.Fragment, { children });
|
|
28064
28219
|
return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(import_wagmi11.WagmiProvider, { config: rainbowConfig, children: /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(import_rainbowkit4.RainbowKitProvider, { theme: customTheme, modalSize: "compact", showRecentTransactions: true, children }) });
|
|
28065
28220
|
}
|
|
28066
|
-
var import_rainbowkit4,
|
|
28221
|
+
var import_rainbowkit4, import_react94, import_wagmi11, import_styles, import_jsx_runtime122;
|
|
28067
28222
|
var init_RainbowKitContext = __esm({
|
|
28068
28223
|
"src/context/RainbowKitContext.tsx"() {
|
|
28069
28224
|
import_rainbowkit4 = require("@rainbow-me/rainbowkit");
|
|
28070
|
-
|
|
28225
|
+
import_react94 = require("react");
|
|
28071
28226
|
import_wagmi11 = require("wagmi");
|
|
28072
28227
|
init_rainbowkit();
|
|
28073
28228
|
init_useLayoutStore();
|
|
@@ -28123,10 +28278,10 @@ function clearLegacyWagmiStorage() {
|
|
|
28123
28278
|
}
|
|
28124
28279
|
function Provider(props) {
|
|
28125
28280
|
const { children, projectId, initialConfig = {}, callbacks } = props;
|
|
28126
|
-
const callbacksRef = (0,
|
|
28127
|
-
(0,
|
|
28128
|
-
const config = (0,
|
|
28129
|
-
const updateConfig = (0,
|
|
28281
|
+
const callbacksRef = (0, import_react95.useRef)(callbacks);
|
|
28282
|
+
(0, import_react95.useEffect)(() => notifyNoProjetctId(projectId), [projectId]);
|
|
28283
|
+
const config = (0, import_react95.useRef)((0, import_lodash_es14.merge)({}, DEFAULT_PROVIDER_CONFIG, { projectId }, initialConfig));
|
|
28284
|
+
const updateConfig = (0, import_react95.useCallback)((updates) => {
|
|
28130
28285
|
const prev = config.current;
|
|
28131
28286
|
const next = { ...prev };
|
|
28132
28287
|
if (updates.projectId !== void 0) next.projectId = updates.projectId;
|
|
@@ -28160,14 +28315,14 @@ function Provider(props) {
|
|
|
28160
28315
|
if (updates.translations) next.translations = { ...next.translations, ...updates.translations };
|
|
28161
28316
|
config.current = next;
|
|
28162
28317
|
}, []);
|
|
28163
|
-
const updateCallbacks = (0,
|
|
28318
|
+
const updateCallbacks = (0, import_react95.useCallback)((updates) => {
|
|
28164
28319
|
const prev = callbacksRef.current;
|
|
28165
28320
|
const next = updates ? { ...prev, ...updates } : void 0;
|
|
28166
28321
|
callbacksRef.current = next;
|
|
28167
28322
|
}, []);
|
|
28168
|
-
(0,
|
|
28323
|
+
(0, import_react95.useEffect)(() => {
|
|
28169
28324
|
if (typeof window === "undefined" || !projectId) return;
|
|
28170
|
-
const mergedConfig = (0,
|
|
28325
|
+
const mergedConfig = (0, import_lodash_es14.merge)(DEFAULT_PROVIDER_CONFIG, initialConfig);
|
|
28171
28326
|
updateConfig(mergedConfig);
|
|
28172
28327
|
if (mergedConfig.wallet?.enabled) {
|
|
28173
28328
|
clearLegacyWagmiStorage();
|
|
@@ -28185,7 +28340,7 @@ function Provider(props) {
|
|
|
28185
28340
|
useSession.getState().setActiveChainId(mergedConfig.network.chainId);
|
|
28186
28341
|
}
|
|
28187
28342
|
}, [projectId, initialConfig]);
|
|
28188
|
-
(0,
|
|
28343
|
+
(0, import_react95.useEffect)(() => {
|
|
28189
28344
|
if (typeof window === "undefined" || !projectId) return;
|
|
28190
28345
|
try {
|
|
28191
28346
|
(0, import_error_tracking4.initSdkErrorTracking)();
|
|
@@ -28214,7 +28369,7 @@ function Provider(props) {
|
|
|
28214
28369
|
console.error("[PROVIDER] Error setting up iframe manager:", error);
|
|
28215
28370
|
}
|
|
28216
28371
|
}, [projectId]);
|
|
28217
|
-
const contextValue = (0,
|
|
28372
|
+
const contextValue = (0, import_react95.useMemo)(
|
|
28218
28373
|
() => ({
|
|
28219
28374
|
config,
|
|
28220
28375
|
updateConfig,
|
|
@@ -28235,12 +28390,12 @@ function Provider(props) {
|
|
|
28235
28390
|
/* @__PURE__ */ (0, import_jsx_runtime124.jsx)(WagmiProvider2, { children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(UIContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(SessionProvider, { children }) }) })
|
|
28236
28391
|
);
|
|
28237
28392
|
}
|
|
28238
|
-
var import_error_tracking4,
|
|
28393
|
+
var import_error_tracking4, import_lodash_es14, import_react95, import_jsx_runtime124, UIContext, useProviderConfig;
|
|
28239
28394
|
var init_ProviderContext = __esm({
|
|
28240
28395
|
"src/context/ProviderContext.tsx"() {
|
|
28241
28396
|
import_error_tracking4 = require("@embarkai/core/internal/error-tracking");
|
|
28242
|
-
|
|
28243
|
-
|
|
28397
|
+
import_lodash_es14 = require("lodash-es");
|
|
28398
|
+
import_react95 = require("react");
|
|
28244
28399
|
init_initial();
|
|
28245
28400
|
init_iframe_manager();
|
|
28246
28401
|
init_RainbowKitContext();
|
|
@@ -28248,9 +28403,9 @@ var init_ProviderContext = __esm({
|
|
|
28248
28403
|
init_utils11();
|
|
28249
28404
|
init_WagmiContext();
|
|
28250
28405
|
import_jsx_runtime124 = require("react/jsx-runtime");
|
|
28251
|
-
UIContext = (0,
|
|
28406
|
+
UIContext = (0, import_react95.createContext)(void 0);
|
|
28252
28407
|
useProviderConfig = () => {
|
|
28253
|
-
const ctx = (0,
|
|
28408
|
+
const ctx = (0, import_react95.useContext)(UIContext);
|
|
28254
28409
|
if (!ctx) throw new Error("useProviderConfig must be used within a Provider");
|
|
28255
28410
|
return ctx;
|
|
28256
28411
|
};
|
|
@@ -28290,6 +28445,7 @@ __export(index_exports, {
|
|
|
28290
28445
|
getAvailableLanguages: () => getAvailableLanguages,
|
|
28291
28446
|
getExplorerUrl: () => getExplorerUrl,
|
|
28292
28447
|
getIframeManager: () => getIframeManager,
|
|
28448
|
+
getInProgressOnrampTransactionsList: () => getInProgressOnrampTransactionsList,
|
|
28293
28449
|
getLanguageIcon: () => getLanguageIcon,
|
|
28294
28450
|
getShareRecoveryStats: () => getShareRecoveryStats,
|
|
28295
28451
|
getSmartAccountForChain: () => getSmartAccountForChain,
|
|
@@ -28359,9 +28515,9 @@ init_ProviderContext();
|
|
|
28359
28515
|
// src/components/ConnectWalletButton.tsx
|
|
28360
28516
|
init_lumia2();
|
|
28361
28517
|
init_embarkAI2();
|
|
28362
|
-
var
|
|
28518
|
+
var import_react_query58 = require("@tanstack/react-query");
|
|
28363
28519
|
var import_lucide_react79 = require("lucide-react");
|
|
28364
|
-
var
|
|
28520
|
+
var import_react96 = require("react");
|
|
28365
28521
|
init_SessionContext();
|
|
28366
28522
|
init_auth();
|
|
28367
28523
|
init_profile();
|
|
@@ -28394,15 +28550,15 @@ function ConnectWalletButton(props) {
|
|
|
28394
28550
|
const colorMode = useLayoutStore((st) => st.colorMode);
|
|
28395
28551
|
const { session, address, hasServerVault, isLoading, isIframeReady, status, setUsePaymaster } = useSession();
|
|
28396
28552
|
const connectButtonLabel = getFormattedStatus(label || "Connect", status, isIframeReady);
|
|
28397
|
-
(0,
|
|
28398
|
-
const { data: profile, isLoading: isProfileLoading } = (0,
|
|
28553
|
+
(0, import_react96.useEffect)(() => setUsePaymaster(usePaymaster), [setUsePaymaster, usePaymaster]);
|
|
28554
|
+
const { data: profile, isLoading: isProfileLoading } = (0, import_react_query58.useQuery)({
|
|
28399
28555
|
retry: false,
|
|
28400
28556
|
enabled: !!address,
|
|
28401
28557
|
queryKey: [QUERY_KEYS.userProfile, address],
|
|
28402
28558
|
queryFn: getUserProfile
|
|
28403
28559
|
});
|
|
28404
28560
|
const displayName = profile?.nicknameDisplay || profile?.displayName || import_auth23.jwtTokenManager.getDisplayName();
|
|
28405
|
-
const indicators = (0,
|
|
28561
|
+
const indicators = (0, import_react96.useMemo)(() => {
|
|
28406
28562
|
const userId = session?.mpcUserId;
|
|
28407
28563
|
if (!userId) return { server: false, local: false, backup: false };
|
|
28408
28564
|
const server = import_auth23.jwtTokenManager.getHasKeyshare() ?? false;
|
|
@@ -29041,14 +29197,14 @@ var Hash = ({
|
|
|
29041
29197
|
};
|
|
29042
29198
|
|
|
29043
29199
|
// src/internal/components/TransactionsMenu/TransactionsList.tsx
|
|
29044
|
-
var
|
|
29200
|
+
var import_react97 = require("react");
|
|
29045
29201
|
init_base2();
|
|
29046
29202
|
var import_jsx_runtime131 = require("react/jsx-runtime");
|
|
29047
29203
|
var TransactionsList = ({ address, itemsCount = 10 }) => {
|
|
29048
|
-
const [transactions, setTransactions] = (0,
|
|
29049
|
-
const [loading, setLoading] = (0,
|
|
29050
|
-
const [error, setError] = (0,
|
|
29051
|
-
(0,
|
|
29204
|
+
const [transactions, setTransactions] = (0, import_react97.useState)([]);
|
|
29205
|
+
const [loading, setLoading] = (0, import_react97.useState)(true);
|
|
29206
|
+
const [error, setError] = (0, import_react97.useState)(null);
|
|
29207
|
+
(0, import_react97.useEffect)(() => {
|
|
29052
29208
|
const fetchTransactions2 = async () => {
|
|
29053
29209
|
try {
|
|
29054
29210
|
setLoading(true);
|
|
@@ -29339,13 +29495,13 @@ function useUserOpStatus(options = {}) {
|
|
|
29339
29495
|
init_useErc3643Compliance();
|
|
29340
29496
|
|
|
29341
29497
|
// src/hooks/useWalletMode.ts
|
|
29342
|
-
var
|
|
29498
|
+
var import_react98 = require("react");
|
|
29343
29499
|
init_useExternalWalletStore();
|
|
29344
29500
|
function useWalletMode() {
|
|
29345
29501
|
const configMode = useExternalWalletStore((st) => st.configMode);
|
|
29346
29502
|
const activeMode = useExternalWalletStore((st) => st.activeMode);
|
|
29347
29503
|
const setActiveMode = useExternalWalletStore((st) => st.setActiveMode);
|
|
29348
|
-
const switchMode = (0,
|
|
29504
|
+
const switchMode = (0, import_react98.useCallback)(
|
|
29349
29505
|
(mode) => {
|
|
29350
29506
|
if (configMode !== "both") return;
|
|
29351
29507
|
setActiveMode(mode);
|
|
@@ -29361,7 +29517,7 @@ function useWalletMode() {
|
|
|
29361
29517
|
}
|
|
29362
29518
|
|
|
29363
29519
|
// src/hooks/useDirectWallet.ts
|
|
29364
|
-
var
|
|
29520
|
+
var import_react99 = require("react");
|
|
29365
29521
|
var import_rainbowkit6 = require("@rainbow-me/rainbowkit");
|
|
29366
29522
|
var import_wagmi13 = require("wagmi");
|
|
29367
29523
|
init_useExternalWalletStore();
|
|
@@ -29375,13 +29531,13 @@ function useDirectWallet() {
|
|
|
29375
29531
|
const { disconnect: wagmiDisconnect } = (0, import_wagmi13.useDisconnect)();
|
|
29376
29532
|
const { openConnectModal } = (0, import_rainbowkit6.useConnectModal)();
|
|
29377
29533
|
const setIsWalletLinking = useLayoutDataStore((st) => st.setIsWalletLinking);
|
|
29378
|
-
const connect = (0,
|
|
29534
|
+
const connect = (0, import_react99.useCallback)(() => {
|
|
29379
29535
|
setIsWalletLinking(true);
|
|
29380
29536
|
}, [setIsWalletLinking]);
|
|
29381
|
-
const reconnect = (0,
|
|
29537
|
+
const reconnect = (0, import_react99.useCallback)(() => {
|
|
29382
29538
|
if (openConnectModal) openConnectModal();
|
|
29383
29539
|
}, [openConnectModal]);
|
|
29384
|
-
const disconnect = (0,
|
|
29540
|
+
const disconnect = (0, import_react99.useCallback)(() => {
|
|
29385
29541
|
wagmiDisconnect();
|
|
29386
29542
|
clearExternalWallet();
|
|
29387
29543
|
}, [wagmiDisconnect, clearExternalWallet]);
|
|
@@ -29397,7 +29553,7 @@ function useDirectWallet() {
|
|
|
29397
29553
|
}
|
|
29398
29554
|
|
|
29399
29555
|
// src/hooks/useSendDirectTransaction.ts
|
|
29400
|
-
var
|
|
29556
|
+
var import_react100 = require("react");
|
|
29401
29557
|
var import_viem21 = require("viem");
|
|
29402
29558
|
var import_wagmi14 = require("wagmi");
|
|
29403
29559
|
init_useExternalWalletStore();
|
|
@@ -29406,10 +29562,10 @@ function useSendDirectTransaction() {
|
|
|
29406
29562
|
const externalChainId = useExternalWalletStore((st) => st.externalChainId);
|
|
29407
29563
|
const { sendTransactionAsync } = (0, import_wagmi14.useSendTransaction)();
|
|
29408
29564
|
const { switchChainAsync } = (0, import_wagmi14.useSwitchChain)();
|
|
29409
|
-
const [isPending, setIsPending] = (0,
|
|
29410
|
-
const [error, setError] = (0,
|
|
29411
|
-
const [txHash, setTxHash] = (0,
|
|
29412
|
-
const sendTransaction = (0,
|
|
29565
|
+
const [isPending, setIsPending] = (0, import_react100.useState)(false);
|
|
29566
|
+
const [error, setError] = (0, import_react100.useState)(null);
|
|
29567
|
+
const [txHash, setTxHash] = (0, import_react100.useState)(null);
|
|
29568
|
+
const sendTransaction = (0, import_react100.useCallback)(
|
|
29413
29569
|
async (params) => {
|
|
29414
29570
|
if (!isConnected) {
|
|
29415
29571
|
setError("No external wallet connected");
|
|
@@ -29443,7 +29599,7 @@ function useSendDirectTransaction() {
|
|
|
29443
29599
|
},
|
|
29444
29600
|
[isConnected, externalChainId, sendTransactionAsync, switchChainAsync]
|
|
29445
29601
|
);
|
|
29446
|
-
const reset = (0,
|
|
29602
|
+
const reset = (0, import_react100.useCallback)(() => {
|
|
29447
29603
|
setError(null);
|
|
29448
29604
|
setTxHash(null);
|
|
29449
29605
|
setIsPending(false);
|
|
@@ -29452,7 +29608,7 @@ function useSendDirectTransaction() {
|
|
|
29452
29608
|
}
|
|
29453
29609
|
|
|
29454
29610
|
// src/hooks/useTransferToLinkedWallet.ts
|
|
29455
|
-
var
|
|
29611
|
+
var import_react101 = require("react");
|
|
29456
29612
|
var import_viem22 = require("viem");
|
|
29457
29613
|
init_SessionContext();
|
|
29458
29614
|
init_account2();
|
|
@@ -29471,14 +29627,14 @@ var ERC20_TRANSFER_ABI2 = [
|
|
|
29471
29627
|
function useTransferToLinkedWallet() {
|
|
29472
29628
|
const session = useSession((st) => st.session);
|
|
29473
29629
|
const { profiles } = useLinkedProfiles();
|
|
29474
|
-
const [isPending, setIsPending] = (0,
|
|
29475
|
-
const [error, setError] = (0,
|
|
29476
|
-
const [userOpHash, setUserOpHash] = (0,
|
|
29477
|
-
const linkedWallets = (0,
|
|
29630
|
+
const [isPending, setIsPending] = (0, import_react101.useState)(false);
|
|
29631
|
+
const [error, setError] = (0, import_react101.useState)(null);
|
|
29632
|
+
const [userOpHash, setUserOpHash] = (0, import_react101.useState)(null);
|
|
29633
|
+
const linkedWallets = (0, import_react101.useMemo)(
|
|
29478
29634
|
() => (profiles || []).filter((p) => p.provider === "wallet" && p.externalId).map((p) => p.externalId),
|
|
29479
29635
|
[profiles]
|
|
29480
29636
|
);
|
|
29481
|
-
const transfer = (0,
|
|
29637
|
+
const transfer = (0, import_react101.useCallback)(
|
|
29482
29638
|
async (params) => {
|
|
29483
29639
|
if (!session) {
|
|
29484
29640
|
setError("No active session");
|
|
@@ -29529,7 +29685,7 @@ function useTransferToLinkedWallet() {
|
|
|
29529
29685
|
},
|
|
29530
29686
|
[session, linkedWallets]
|
|
29531
29687
|
);
|
|
29532
|
-
const reset = (0,
|
|
29688
|
+
const reset = (0, import_react101.useCallback)(() => {
|
|
29533
29689
|
setError(null);
|
|
29534
29690
|
setUserOpHash(null);
|
|
29535
29691
|
setIsPending(false);
|
|
@@ -29553,7 +29709,7 @@ function useNativeWalletSignature() {
|
|
|
29553
29709
|
|
|
29554
29710
|
// src/hooks/useLogout.ts
|
|
29555
29711
|
var import_auth25 = require("@embarkai/core/auth");
|
|
29556
|
-
var
|
|
29712
|
+
var import_react102 = require("react");
|
|
29557
29713
|
var import_wagmi16 = require("wagmi");
|
|
29558
29714
|
init_ProviderContext();
|
|
29559
29715
|
init_SessionContext();
|
|
@@ -29573,7 +29729,7 @@ function useLogout() {
|
|
|
29573
29729
|
}
|
|
29574
29730
|
}
|
|
29575
29731
|
});
|
|
29576
|
-
const logout2 = (0,
|
|
29732
|
+
const logout2 = (0, import_react102.useCallback)(async () => {
|
|
29577
29733
|
const { setSession, setIsLoading, setAddress, setStatus, setError } = useSession.getState();
|
|
29578
29734
|
const prevAddress = address;
|
|
29579
29735
|
let userId = null;
|
|
@@ -29616,7 +29772,7 @@ init_bundler();
|
|
|
29616
29772
|
// src/index.ts
|
|
29617
29773
|
init_auth();
|
|
29618
29774
|
init_profile();
|
|
29619
|
-
|
|
29775
|
+
init_SecurityMenu2();
|
|
29620
29776
|
init_linkedProfiles();
|
|
29621
29777
|
init_nickname_fingerprint();
|
|
29622
29778
|
init_errors();
|
|
@@ -29691,7 +29847,7 @@ function useTransactions() {
|
|
|
29691
29847
|
|
|
29692
29848
|
// src/modules/assets.ts
|
|
29693
29849
|
init_SessionContext();
|
|
29694
|
-
var
|
|
29850
|
+
var import_react103 = __toESM(require("react"), 1);
|
|
29695
29851
|
var import_viem24 = require("viem");
|
|
29696
29852
|
var import_wagmi18 = require("wagmi");
|
|
29697
29853
|
var COMMON_TOKENS = [
|
|
@@ -29847,7 +30003,7 @@ function useTokenBalance2(tokenAddress, userAddress) {
|
|
|
29847
30003
|
}
|
|
29848
30004
|
});
|
|
29849
30005
|
const { tokenInfo } = useTokenInfo(tokenAddress);
|
|
29850
|
-
const formattedBalance =
|
|
30006
|
+
const formattedBalance = import_react103.default.useMemo(() => {
|
|
29851
30007
|
if (!balance || !tokenInfo) return "0";
|
|
29852
30008
|
return (0, import_viem24.formatUnits)(balance, tokenInfo.decimals);
|
|
29853
30009
|
}, [balance, tokenInfo]);
|
|
@@ -29910,6 +30066,7 @@ function useSmartAccountTransactions() {
|
|
|
29910
30066
|
|
|
29911
30067
|
// src/index.ts
|
|
29912
30068
|
init_iframe_manager();
|
|
30069
|
+
init_BuyMenu2();
|
|
29913
30070
|
|
|
29914
30071
|
// src/internal/assets/index.ts
|
|
29915
30072
|
init_networks2();
|
|
@@ -29971,6 +30128,7 @@ autorun();
|
|
|
29971
30128
|
getAvailableLanguages,
|
|
29972
30129
|
getExplorerUrl,
|
|
29973
30130
|
getIframeManager,
|
|
30131
|
+
getInProgressOnrampTransactionsList,
|
|
29974
30132
|
getLanguageIcon,
|
|
29975
30133
|
getShareRecoveryStats,
|
|
29976
30134
|
getSmartAccountForChain,
|