@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.js
CHANGED
|
@@ -841,31 +841,31 @@ var PageKey, useLayoutDataStore;
|
|
|
841
841
|
var init_useLayoutDataStore = __esm({
|
|
842
842
|
"src/internal/hooks/useLayoutDataStore.ts"() {
|
|
843
843
|
init_constants();
|
|
844
|
-
PageKey = /* @__PURE__ */ ((
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
return
|
|
844
|
+
PageKey = /* @__PURE__ */ ((PageKey4) => {
|
|
845
|
+
PageKey4["AUTH"] = "auth";
|
|
846
|
+
PageKey4["LANGUAGES"] = "languages";
|
|
847
|
+
PageKey4["TERMS_OF_SERVICE"] = "terms-of-service";
|
|
848
|
+
PageKey4["MAIN_MENU"] = "main-menu";
|
|
849
|
+
PageKey4["SETTINGS"] = "settings";
|
|
850
|
+
PageKey4["SEND"] = "send";
|
|
851
|
+
PageKey4["RECEIVE"] = "receive";
|
|
852
|
+
PageKey4["BUY"] = "buy";
|
|
853
|
+
PageKey4["KYC"] = "kyc";
|
|
854
|
+
PageKey4["TRANSACTIONS"] = "transactions";
|
|
855
|
+
PageKey4["ASSETS"] = "assets";
|
|
856
|
+
PageKey4["MANAGE_WALLET"] = "manage-wallet";
|
|
857
|
+
PageKey4["UNLINK_PROVIDER"] = "unlink-provider";
|
|
858
|
+
PageKey4["SECURITY"] = "security";
|
|
859
|
+
PageKey4["KEYSARE_BACKUP"] = "keysare-backup";
|
|
860
|
+
PageKey4["KEYSHARE_RESTORE"] = "keyshare-restore";
|
|
861
|
+
PageKey4["CHAIN"] = "chain";
|
|
862
|
+
PageKey4["CHAIN_SWITCH_REQUEST"] = "chain-switch-request";
|
|
863
|
+
PageKey4["NICKNAME_SETTINGS"] = "nickname-settings";
|
|
864
|
+
PageKey4["DEVICES"] = "devices";
|
|
865
|
+
PageKey4["DEVICE_LINK"] = "device-link";
|
|
866
|
+
PageKey4["DEVICE_MANAGE"] = "device-manage";
|
|
867
|
+
PageKey4["DEVICE_RESTORE"] = "device-restore";
|
|
868
|
+
return PageKey4;
|
|
869
869
|
})(PageKey || {});
|
|
870
870
|
useLayoutDataStore = create((set) => ({
|
|
871
871
|
page: null,
|
|
@@ -2451,7 +2451,7 @@ function usePageParams() {
|
|
|
2451
2451
|
currentParams.current = pageParams;
|
|
2452
2452
|
setPageParams(null);
|
|
2453
2453
|
}, []);
|
|
2454
|
-
return currentParams
|
|
2454
|
+
return currentParams;
|
|
2455
2455
|
}
|
|
2456
2456
|
var init_useOpenPage = __esm({
|
|
2457
2457
|
"src/hooks/useOpenPage.ts"() {
|
|
@@ -5497,7 +5497,7 @@ var init_en = __esm({
|
|
|
5497
5497
|
selectToken: "Select Asset",
|
|
5498
5498
|
estimations: "Estimations",
|
|
5499
5499
|
estimatedFee: "Estimated Fee",
|
|
5500
|
-
availableChainPairs: "
|
|
5500
|
+
availableChainPairs: "Select Chain Pairs",
|
|
5501
5501
|
toChain: "To Chain",
|
|
5502
5502
|
fromChain: "From Chain",
|
|
5503
5503
|
optionalRecipient: "Recipient (optional, if empty - destination chain address = sender address on origin chain)",
|
|
@@ -5572,7 +5572,12 @@ var init_en = __esm({
|
|
|
5572
5572
|
exchangeRate: "Exchange Rate",
|
|
5573
5573
|
networkFee: "Network Fee",
|
|
5574
5574
|
serviceFee: "Service Fee",
|
|
5575
|
-
paymentMethod: "Payment Method"
|
|
5575
|
+
paymentMethod: "Payment Method",
|
|
5576
|
+
toAddress: {
|
|
5577
|
+
receiver: "ATTENTION! Receiving Address",
|
|
5578
|
+
message: "You are about to purchase crypto to an external address, not your embarkAI address.",
|
|
5579
|
+
suggestion: "Please make sure this is your correct wallet address, otherwise you may lose your funds."
|
|
5580
|
+
}
|
|
5576
5581
|
},
|
|
5577
5582
|
transactionHistory: {
|
|
5578
5583
|
details: "Details"
|
|
@@ -5590,7 +5595,8 @@ var init_en = __esm({
|
|
|
5590
5595
|
},
|
|
5591
5596
|
portfolioMenu: {
|
|
5592
5597
|
title: "Your Assets",
|
|
5593
|
-
noAssets: "No assets found"
|
|
5598
|
+
noAssets: "No assets found",
|
|
5599
|
+
noBlockscout: "No Blockscout API found for chain: {{chain}}"
|
|
5594
5600
|
},
|
|
5595
5601
|
transactionsMenu: {
|
|
5596
5602
|
title: "Transactions History",
|
|
@@ -8776,11 +8782,35 @@ var init_priceFormatter = __esm({
|
|
|
8776
8782
|
});
|
|
8777
8783
|
|
|
8778
8784
|
// src/internal/components/BuyMenu/useBuyMenuStore.ts
|
|
8785
|
+
import { keys, noop } from "lodash-es";
|
|
8786
|
+
import { useEffect as useEffect12 } from "react";
|
|
8779
8787
|
import { create as create4 } from "zustand";
|
|
8780
8788
|
import { persist } from "zustand/middleware";
|
|
8789
|
+
function useBuyMenuParams() {
|
|
8790
|
+
useEffect12(() => {
|
|
8791
|
+
const { pageParams, setPageParams } = useLayoutDataStore.getState();
|
|
8792
|
+
if (!pageParams || !keys(pageParams).length) return;
|
|
8793
|
+
const { amount, crypto: crypto2, toWalletAddress, confirmationMessage, onRampWidgetRedirected } = pageParams || {};
|
|
8794
|
+
switch (true) {
|
|
8795
|
+
case !!amount:
|
|
8796
|
+
useBuyMenuStore.getState().setSrcInputAmount(amount);
|
|
8797
|
+
useBuyMenuStore.getState().setSrcQueryAmount(amount);
|
|
8798
|
+
case !!crypto2:
|
|
8799
|
+
useBuyMenuStore.getState().setSelectedCrypto(crypto2);
|
|
8800
|
+
case !!toWalletAddress:
|
|
8801
|
+
useBuyMenuStore.getState().setToWalletAddress(toWalletAddress);
|
|
8802
|
+
case !!onRampWidgetRedirected:
|
|
8803
|
+
useBuyMenuStore.getState().setOnRampWidgetRedirectedFn(onRampWidgetRedirected);
|
|
8804
|
+
case !!confirmationMessage:
|
|
8805
|
+
useBuyMenuStore.getState().setConfirmationMessage(confirmationMessage);
|
|
8806
|
+
}
|
|
8807
|
+
setPageParams(null);
|
|
8808
|
+
}, []);
|
|
8809
|
+
}
|
|
8781
8810
|
var DEFAULT_MENU_SWITCHES, DEFAULT_PROVIDER, useBuyMenuStore;
|
|
8782
8811
|
var init_useBuyMenuStore = __esm({
|
|
8783
8812
|
"src/internal/components/BuyMenu/useBuyMenuStore.ts"() {
|
|
8813
|
+
init_useLayoutDataStore();
|
|
8784
8814
|
DEFAULT_MENU_SWITCHES = {
|
|
8785
8815
|
isTransactionHistory: false,
|
|
8786
8816
|
isProviderSelector: false,
|
|
@@ -8795,6 +8825,8 @@ var init_useBuyMenuStore = __esm({
|
|
|
8795
8825
|
(set) => ({
|
|
8796
8826
|
renderKey: "default-initial-buy-menu-render-key",
|
|
8797
8827
|
setRenderKey: (key) => set({ renderKey: key }),
|
|
8828
|
+
toWalletAddress: null,
|
|
8829
|
+
setToWalletAddress: (toWalletAddress) => set({ toWalletAddress }),
|
|
8798
8830
|
/** boolean flags */
|
|
8799
8831
|
isTransactionHistory: false,
|
|
8800
8832
|
setIsTransactionHistory: (isTransactionHistory) => {
|
|
@@ -8844,6 +8876,10 @@ var init_useBuyMenuStore = __esm({
|
|
|
8844
8876
|
srcQueryAmount: 0,
|
|
8845
8877
|
setSrcQueryAmount: (amount) => set({ srcQueryAmount: amount }),
|
|
8846
8878
|
/** */
|
|
8879
|
+
onRampWidgetRedirected: noop,
|
|
8880
|
+
setOnRampWidgetRedirectedFn: (cb) => set({ onRampWidgetRedirected: cb }),
|
|
8881
|
+
confirmationMessage: null,
|
|
8882
|
+
setConfirmationMessage: (message) => set({ confirmationMessage: message }),
|
|
8847
8883
|
error: null,
|
|
8848
8884
|
setError: (error) => set({ error })
|
|
8849
8885
|
}),
|
|
@@ -9424,12 +9460,67 @@ var init_api = __esm({
|
|
|
9424
9460
|
}
|
|
9425
9461
|
});
|
|
9426
9462
|
|
|
9463
|
+
// src/internal/utils/cn.ts
|
|
9464
|
+
import { clsx as clsx2 } from "clsx";
|
|
9465
|
+
function cn2(...inputs) {
|
|
9466
|
+
return twMerge(clsx2(inputs));
|
|
9467
|
+
}
|
|
9468
|
+
var init_cn = __esm({
|
|
9469
|
+
"src/internal/utils/cn.ts"() {
|
|
9470
|
+
init_bundle_mjs();
|
|
9471
|
+
}
|
|
9472
|
+
});
|
|
9473
|
+
|
|
9474
|
+
// src/internal/components/ui/badge.tsx
|
|
9475
|
+
import { cva as cva2 } from "class-variance-authority";
|
|
9476
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
9477
|
+
function Badge(props) {
|
|
9478
|
+
const { className, variant = "secondary", size = "default", ...rest } = props;
|
|
9479
|
+
return /* @__PURE__ */ jsx36("span", { ...rest, className: cn2(badgeVariants({ variant, size }), className) });
|
|
9480
|
+
}
|
|
9481
|
+
var badgeVariants;
|
|
9482
|
+
var init_badge = __esm({
|
|
9483
|
+
"src/internal/components/ui/badge.tsx"() {
|
|
9484
|
+
init_cn();
|
|
9485
|
+
badgeVariants = cva2(
|
|
9486
|
+
cn2(
|
|
9487
|
+
//
|
|
9488
|
+
"inline-flex items-center",
|
|
9489
|
+
"border font-semibold",
|
|
9490
|
+
"select-none"
|
|
9491
|
+
),
|
|
9492
|
+
{
|
|
9493
|
+
variants: {
|
|
9494
|
+
variant: {
|
|
9495
|
+
outline: "border-[var(--ui-kit-bd)] bg-transparent text-[var(--ui-kit-fg)]",
|
|
9496
|
+
secondary: "border-[var(--ui-kit-secondary)] bg-[var(--ui-kit-secondary)] text-[var(--ui-kit-fg)]",
|
|
9497
|
+
destructive: "border-[var(--ui-kit-bg-error)] bg-[var(--ui-kit-bg-error)] text-[var(--ui-kit-error)]",
|
|
9498
|
+
success: "border-[var(--ui-kit-bg-success)] bg-[var(--ui-kit-bg-success)] text-[var(--ui-kit-success)]",
|
|
9499
|
+
warning: "border-[var(--ui-kit-bg-warning)] bg-[var(--ui-kit-bg-warning)] text-[var(--ui-kit-warning)]"
|
|
9500
|
+
},
|
|
9501
|
+
size: {
|
|
9502
|
+
default: "h-5 px-2 rounded-full text-[10px] gap-[var(--ui-kit-gap)]",
|
|
9503
|
+
medium: "h-8 px-[var(--ui-kit-pd)] rounded-[var(--ui-kit-el-bdrs)] text-sm gap-[var(--ui-kit-gap)]",
|
|
9504
|
+
large: cn2(
|
|
9505
|
+
"whitespace-nowrap text-sm font-semibold font-sans",
|
|
9506
|
+
"h-12 px-[var(--ui-kit-pd)] rounded-[var(--ui-kit-el-bdrs)]"
|
|
9507
|
+
)
|
|
9508
|
+
}
|
|
9509
|
+
},
|
|
9510
|
+
defaultVariants: {
|
|
9511
|
+
variant: "secondary"
|
|
9512
|
+
}
|
|
9513
|
+
}
|
|
9514
|
+
);
|
|
9515
|
+
}
|
|
9516
|
+
});
|
|
9517
|
+
|
|
9427
9518
|
// src/internal/components/BuyMenu/binance/config.ts
|
|
9428
9519
|
import { BSC_MAINNET_CHAIN_ID, LUMIA_MAINNET_CHAIN_ID } from "@embarkai/core/read";
|
|
9429
|
-
var
|
|
9520
|
+
var CHAIN_ID_TO_BINANCE_NETWORK_TICKER;
|
|
9430
9521
|
var init_config = __esm({
|
|
9431
9522
|
"src/internal/components/BuyMenu/binance/config.ts"() {
|
|
9432
|
-
|
|
9523
|
+
CHAIN_ID_TO_BINANCE_NETWORK_TICKER = {
|
|
9433
9524
|
[LUMIA_MAINNET_CHAIN_ID]: "LUMIA",
|
|
9434
9525
|
[BSC_MAINNET_CHAIN_ID]: "BSC"
|
|
9435
9526
|
};
|
|
@@ -9439,26 +9530,35 @@ var init_config = __esm({
|
|
|
9439
9530
|
// src/internal/components/BuyMenu/binance/BinanceSummary.tsx
|
|
9440
9531
|
import { useMutation as useMutation5, useQueryClient as useQueryClient3 } from "@tanstack/react-query";
|
|
9441
9532
|
import { InfoIcon as InfoIcon3, LoaderIcon } from "lucide-react";
|
|
9442
|
-
import { jsx as
|
|
9533
|
+
import { jsx as jsx37, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
9443
9534
|
function BinanceSummary(props) {
|
|
9444
9535
|
const { payment } = props;
|
|
9445
9536
|
const qc = useQueryClient3();
|
|
9446
9537
|
const { t } = useT();
|
|
9447
|
-
const
|
|
9538
|
+
const embarkaiAddress = useSession((st) => st.address);
|
|
9448
9539
|
const chainConfig = useSession((st) => st.chainConfig);
|
|
9449
|
-
const {
|
|
9540
|
+
const {
|
|
9541
|
+
toWalletAddress,
|
|
9542
|
+
selectedFiat,
|
|
9543
|
+
selectedCrypto,
|
|
9544
|
+
srcQueryAmount,
|
|
9545
|
+
redirecting,
|
|
9546
|
+
confirmationMessage,
|
|
9547
|
+
setRedirecting
|
|
9548
|
+
} = useBuyMenuStore();
|
|
9450
9549
|
const quoteData = useBinanceStore((st) => st.quoteData);
|
|
9451
9550
|
const cryptoToRecieve = Number(quoteData?.totalAmount || "0");
|
|
9452
9551
|
const { mutate: checkoutFundWalletOrder, isPending: isFundWalletOrderCheckouting } = useMutation5({
|
|
9453
9552
|
mutationFn: async () => {
|
|
9454
9553
|
setRedirecting(true);
|
|
9455
9554
|
return await createPreorderMutation({
|
|
9555
|
+
address: toWalletAddress || embarkaiAddress,
|
|
9456
9556
|
amountType: 1,
|
|
9457
9557
|
requestedAmount: String(srcQueryAmount),
|
|
9458
|
-
address: walletAddress,
|
|
9459
9558
|
fiatCurrency: selectedFiat,
|
|
9460
9559
|
cryptoCurrency: selectedCrypto,
|
|
9461
|
-
network:
|
|
9560
|
+
network: CHAIN_ID_TO_BINANCE_NETWORK_TICKER[chainConfig.id],
|
|
9561
|
+
//
|
|
9462
9562
|
payMethodCode: payment?.payMethodCode || void 0,
|
|
9463
9563
|
payMethodSubCode: payment?.payMethodSubCode || void 0,
|
|
9464
9564
|
// TODO: pass quote response to backend to create order with exact quote details (amount, fees, etc.)
|
|
@@ -9477,8 +9577,10 @@ function BinanceSummary(props) {
|
|
|
9477
9577
|
setRedirecting(false);
|
|
9478
9578
|
qc.invalidateQueries({ queryKey: [QUERY_KEYS2.binanceTransactions] });
|
|
9479
9579
|
window.open(link, "_blank", "noopener,noreferrer");
|
|
9480
|
-
useBuyMenuStore.getState()
|
|
9481
|
-
|
|
9580
|
+
const { setError, setIsTransactionHistory, onRampWidgetRedirected } = useBuyMenuStore.getState();
|
|
9581
|
+
onRampWidgetRedirected(quoteData);
|
|
9582
|
+
setError(null);
|
|
9583
|
+
setIsTransactionHistory(true);
|
|
9482
9584
|
}, REDIRECT_TIMEOUT_MS);
|
|
9483
9585
|
}
|
|
9484
9586
|
},
|
|
@@ -9490,14 +9592,14 @@ function BinanceSummary(props) {
|
|
|
9490
9592
|
});
|
|
9491
9593
|
const isContinueDisabled = !!redirecting || !!isFundWalletOrderCheckouting || !quoteData;
|
|
9492
9594
|
if (!quoteData) {
|
|
9493
|
-
return /* @__PURE__ */
|
|
9494
|
-
/* @__PURE__ */
|
|
9495
|
-
/* @__PURE__ */
|
|
9595
|
+
return /* @__PURE__ */ jsx37("div", { className: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: /* @__PURE__ */ jsxs31(Highlight, { type: "warning", className: "flex gap-[var(--ui-kit-gap)]", children: [
|
|
9596
|
+
/* @__PURE__ */ jsx37(InfoIcon3, { className: "w-4 h-4" }),
|
|
9597
|
+
/* @__PURE__ */ jsx37("span", { children: t("passport:common.errors.oops") })
|
|
9496
9598
|
] }) });
|
|
9497
9599
|
}
|
|
9498
9600
|
return /* @__PURE__ */ jsxs31("div", { className: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: [
|
|
9499
9601
|
/* @__PURE__ */ jsxs31("div", { className: "flex justify-between text-xs leading-5", children: [
|
|
9500
|
-
/* @__PURE__ */
|
|
9602
|
+
/* @__PURE__ */ jsx37("span", { className: "", children: t("passport:common.amount") }),
|
|
9501
9603
|
/* @__PURE__ */ jsxs31("span", { className: "font-bold", children: [
|
|
9502
9604
|
formatPrice(srcQueryAmount),
|
|
9503
9605
|
" ",
|
|
@@ -9505,7 +9607,7 @@ function BinanceSummary(props) {
|
|
|
9505
9607
|
] })
|
|
9506
9608
|
] }),
|
|
9507
9609
|
/* @__PURE__ */ jsxs31("div", { className: "flex justify-between text-xs leading-5", children: [
|
|
9508
|
-
/* @__PURE__ */
|
|
9610
|
+
/* @__PURE__ */ jsx37("span", { className: "", children: t("passport:buyMenu.summary.youReceive") }),
|
|
9509
9611
|
/* @__PURE__ */ jsxs31("span", { className: "font-bold", children: [
|
|
9510
9612
|
formatPrice(cryptoToRecieve),
|
|
9511
9613
|
" ",
|
|
@@ -9514,7 +9616,7 @@ function BinanceSummary(props) {
|
|
|
9514
9616
|
] }),
|
|
9515
9617
|
/* @__PURE__ */ jsxs31(Highlight, { type: "info", className: "", children: [
|
|
9516
9618
|
/* @__PURE__ */ jsxs31("p", { className: "flex justify-between gap-[var(--ui-kit-gap)] leading-5", children: [
|
|
9517
|
-
/* @__PURE__ */
|
|
9619
|
+
/* @__PURE__ */ jsx37("span", { children: t("passport:buyMenu.summary.networkFee") }),
|
|
9518
9620
|
/* @__PURE__ */ jsxs31("strong", { children: [
|
|
9519
9621
|
formatPrice(Number(quoteData?.networkFee || "0")),
|
|
9520
9622
|
" ",
|
|
@@ -9522,7 +9624,7 @@ function BinanceSummary(props) {
|
|
|
9522
9624
|
] })
|
|
9523
9625
|
] }),
|
|
9524
9626
|
/* @__PURE__ */ jsxs31("p", { className: "flex justify-between gap-[var(--ui-kit-gap)] leading-5", children: [
|
|
9525
|
-
/* @__PURE__ */
|
|
9627
|
+
/* @__PURE__ */ jsx37("span", { children: t("passport:buyMenu.summary.serviceFee") }),
|
|
9526
9628
|
/* @__PURE__ */ jsxs31("strong", { children: [
|
|
9527
9629
|
formatPrice(Number(quoteData?.feeAmount || "0")),
|
|
9528
9630
|
" ",
|
|
@@ -9530,8 +9632,16 @@ function BinanceSummary(props) {
|
|
|
9530
9632
|
] })
|
|
9531
9633
|
] }),
|
|
9532
9634
|
/* @__PURE__ */ jsxs31("p", { className: "flex justify-between gap-[var(--ui-kit-gap)] leading-5", children: [
|
|
9533
|
-
/* @__PURE__ */
|
|
9534
|
-
/* @__PURE__ */
|
|
9635
|
+
/* @__PURE__ */ jsx37("span", { children: t("passport:buyMenu.selectPaymentMode") }),
|
|
9636
|
+
/* @__PURE__ */ jsx37("strong", { children: payment?.paymentMethod?.toUpperCase() })
|
|
9637
|
+
] })
|
|
9638
|
+
] }),
|
|
9639
|
+
toWalletAddress && /* @__PURE__ */ jsxs31(Highlight, { type: "warning", children: [
|
|
9640
|
+
/* @__PURE__ */ jsx37("p", { className: "font-bold leading-6", children: t("passport:buyMenu.summary.toAddress.receiver") }),
|
|
9641
|
+
/* @__PURE__ */ jsx37(Badge, { variant: "secondary", size: "medium", className: "w-full text-center justify-center text-[10px]", children: /* @__PURE__ */ jsx37("span", { className: "truncate leading-4", children: toWalletAddress }) }),
|
|
9642
|
+
!!confirmationMessage ? /* @__PURE__ */ jsx37("p", { className: "leading-5", children: confirmationMessage }) : /* @__PURE__ */ jsxs31("p", { className: "leading-4", children: [
|
|
9643
|
+
/* @__PURE__ */ jsx37("span", { children: t("passport:buyMenu.summary.toAddress.message") }),
|
|
9644
|
+
/* @__PURE__ */ jsx37("span", { children: t("passport:buyMenu.summary.toAddress.suggestion") })
|
|
9535
9645
|
] })
|
|
9536
9646
|
] }),
|
|
9537
9647
|
/* @__PURE__ */ jsxs31(
|
|
@@ -9543,8 +9653,8 @@ function BinanceSummary(props) {
|
|
|
9543
9653
|
variant: "default",
|
|
9544
9654
|
onClick: () => checkoutFundWalletOrder(),
|
|
9545
9655
|
children: [
|
|
9546
|
-
redirecting && /* @__PURE__ */
|
|
9547
|
-
/* @__PURE__ */
|
|
9656
|
+
redirecting && /* @__PURE__ */ jsx37(LoaderIcon, { size: 16, className: "animate-spin" }),
|
|
9657
|
+
/* @__PURE__ */ jsx37("span", { children: redirecting ? "REDIRECTING..." : String(t("passport:buyMenu.actions.confirmPurchase")).toUpperCase() }),
|
|
9548
9658
|
!!quoteData?.totalAmount && /* @__PURE__ */ jsxs31("strong", { children: [
|
|
9549
9659
|
formatPrice(Number(quoteData.totalAmount)),
|
|
9550
9660
|
" ",
|
|
@@ -9561,6 +9671,7 @@ var init_BinanceSummary = __esm({
|
|
|
9561
9671
|
init_SessionContext();
|
|
9562
9672
|
init_i18n();
|
|
9563
9673
|
init_priceFormatter();
|
|
9674
|
+
init_badge();
|
|
9564
9675
|
init_button();
|
|
9565
9676
|
init_highlight();
|
|
9566
9677
|
init_contants();
|
|
@@ -9572,61 +9683,6 @@ var init_BinanceSummary = __esm({
|
|
|
9572
9683
|
}
|
|
9573
9684
|
});
|
|
9574
9685
|
|
|
9575
|
-
// src/internal/utils/cn.ts
|
|
9576
|
-
import { clsx as clsx2 } from "clsx";
|
|
9577
|
-
function cn2(...inputs) {
|
|
9578
|
-
return twMerge(clsx2(inputs));
|
|
9579
|
-
}
|
|
9580
|
-
var init_cn = __esm({
|
|
9581
|
-
"src/internal/utils/cn.ts"() {
|
|
9582
|
-
init_bundle_mjs();
|
|
9583
|
-
}
|
|
9584
|
-
});
|
|
9585
|
-
|
|
9586
|
-
// src/internal/components/ui/badge.tsx
|
|
9587
|
-
import { cva as cva2 } from "class-variance-authority";
|
|
9588
|
-
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
9589
|
-
function Badge(props) {
|
|
9590
|
-
const { className, variant = "secondary", size = "default", ...rest } = props;
|
|
9591
|
-
return /* @__PURE__ */ jsx37("span", { ...rest, className: cn2(badgeVariants({ variant, size }), className) });
|
|
9592
|
-
}
|
|
9593
|
-
var badgeVariants;
|
|
9594
|
-
var init_badge = __esm({
|
|
9595
|
-
"src/internal/components/ui/badge.tsx"() {
|
|
9596
|
-
init_cn();
|
|
9597
|
-
badgeVariants = cva2(
|
|
9598
|
-
cn2(
|
|
9599
|
-
//
|
|
9600
|
-
"inline-flex items-center",
|
|
9601
|
-
"border font-semibold",
|
|
9602
|
-
"select-none"
|
|
9603
|
-
),
|
|
9604
|
-
{
|
|
9605
|
-
variants: {
|
|
9606
|
-
variant: {
|
|
9607
|
-
outline: "border-[var(--ui-kit-bd)] bg-transparent text-[var(--ui-kit-fg)]",
|
|
9608
|
-
secondary: "border-[var(--ui-kit-secondary)] bg-[var(--ui-kit-secondary)] text-[var(--ui-kit-fg)]",
|
|
9609
|
-
destructive: "border-[var(--ui-kit-bg-error)] bg-[var(--ui-kit-bg-error)] text-[var(--ui-kit-error)]",
|
|
9610
|
-
success: "border-[var(--ui-kit-bg-success)] bg-[var(--ui-kit-bg-success)] text-[var(--ui-kit-success)]",
|
|
9611
|
-
warning: "border-[var(--ui-kit-bg-warning)] bg-[var(--ui-kit-bg-warning)] text-[var(--ui-kit-warning)]"
|
|
9612
|
-
},
|
|
9613
|
-
size: {
|
|
9614
|
-
default: "h-5 px-2 rounded-full text-[10px] gap-[var(--ui-kit-gap)]",
|
|
9615
|
-
medium: "h-8 px-[var(--ui-kit-pd)] rounded-[var(--ui-kit-el-bdrs)] text-sm gap-[var(--ui-kit-gap)]",
|
|
9616
|
-
large: cn2(
|
|
9617
|
-
"whitespace-nowrap text-sm font-semibold font-sans",
|
|
9618
|
-
"h-12 px-[var(--ui-kit-pd)] rounded-[var(--ui-kit-el-bdrs)]"
|
|
9619
|
-
)
|
|
9620
|
-
}
|
|
9621
|
-
},
|
|
9622
|
-
defaultVariants: {
|
|
9623
|
-
variant: "secondary"
|
|
9624
|
-
}
|
|
9625
|
-
}
|
|
9626
|
-
);
|
|
9627
|
-
}
|
|
9628
|
-
});
|
|
9629
|
-
|
|
9630
9686
|
// src/internal/components/BuyMenu/binance/statuses.ts
|
|
9631
9687
|
import { values } from "lodash-es";
|
|
9632
9688
|
var STATUS_CODE_TO_MESSAGE, STATUSES_FILTERS;
|
|
@@ -9747,7 +9803,7 @@ import { useInfiniteQuery } from "@tanstack/react-query";
|
|
|
9747
9803
|
import dayjs from "dayjs";
|
|
9748
9804
|
import { debounce as debounce4 } from "lodash-es";
|
|
9749
9805
|
import { DownloadIcon, ExternalLinkIcon, LoaderIcon as LoaderIcon2 } from "lucide-react";
|
|
9750
|
-
import { useCallback as useCallback12, useEffect as
|
|
9806
|
+
import { useCallback as useCallback12, useEffect as useEffect13, useMemo as useMemo4 } from "react";
|
|
9751
9807
|
import { jsx as jsx38, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
9752
9808
|
function getStatusVariant(status) {
|
|
9753
9809
|
switch (status) {
|
|
@@ -9888,7 +9944,7 @@ function BinanceTxHistory() {
|
|
|
9888
9944
|
}, 200),
|
|
9889
9945
|
[]
|
|
9890
9946
|
);
|
|
9891
|
-
|
|
9947
|
+
useEffect13(() => {
|
|
9892
9948
|
if (isTxDataLoading || !txList?.length || txList.length > 10) return;
|
|
9893
9949
|
updateExpandable();
|
|
9894
9950
|
}, [isTxDataLoading, txList]);
|
|
@@ -9935,11 +9991,11 @@ var init_BinanceTxHistory = __esm({
|
|
|
9935
9991
|
|
|
9936
9992
|
// src/internal/components/BuyMenu/binance/useBinanceSseTracing.ts
|
|
9937
9993
|
import { useQueryClient as useQueryClient4 } from "@tanstack/react-query";
|
|
9938
|
-
import { useEffect as
|
|
9994
|
+
import { useEffect as useEffect14, useRef as useRef10 } from "react";
|
|
9939
9995
|
function useBinanceSseTxTracing(walletAddress) {
|
|
9940
9996
|
const qc = useQueryClient4();
|
|
9941
|
-
const debounceRef =
|
|
9942
|
-
|
|
9997
|
+
const debounceRef = useRef10(null);
|
|
9998
|
+
useEffect14(() => {
|
|
9943
9999
|
if (!walletAddress) return;
|
|
9944
10000
|
const iframeManager = getIframeManager();
|
|
9945
10001
|
if (!iframeManager) return;
|
|
@@ -9981,14 +10037,14 @@ var init_utils6 = __esm({
|
|
|
9981
10037
|
// src/internal/components/BuyMenu/binance/Binance.tsx
|
|
9982
10038
|
import { useMutation as useMutation6, useQuery as useQuery2, useQueryClient as useQueryClient5 } from "@tanstack/react-query";
|
|
9983
10039
|
import { LoaderIcon as LoaderIcon3 } from "lucide-react";
|
|
9984
|
-
import { useEffect as
|
|
10040
|
+
import { useEffect as useEffect15 } from "react";
|
|
9985
10041
|
import { Fragment as Fragment11, jsx as jsx39, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
9986
10042
|
function Binance() {
|
|
9987
10043
|
const qc = useQueryClient5();
|
|
9988
10044
|
const { t } = useT();
|
|
9989
10045
|
const chainConfig = useSession((st) => st.chainConfig);
|
|
9990
10046
|
const walletAddress = useSession((st) => st.address);
|
|
9991
|
-
const chainTicker =
|
|
10047
|
+
const chainTicker = CHAIN_ID_TO_BINANCE_NETWORK_TICKER[chainConfig.id] || null;
|
|
9992
10048
|
const {
|
|
9993
10049
|
error,
|
|
9994
10050
|
srcQueryAmount,
|
|
@@ -10003,7 +10059,7 @@ function Binance() {
|
|
|
10003
10059
|
} = useBuyMenuStore();
|
|
10004
10060
|
const paymentMode = useBinanceStore((st) => st.paymentMode);
|
|
10005
10061
|
const isCurrurenciesSelected = !!selectedCrypto && !!selectedFiat;
|
|
10006
|
-
|
|
10062
|
+
useEffect15(() => {
|
|
10007
10063
|
if (!isCurrurenciesSelected) return;
|
|
10008
10064
|
useBuyMenuStore.getState().setRenderKey(`${selectedCrypto}-${selectedFiat}-${Date.now()}`);
|
|
10009
10065
|
}, [isCurrurenciesSelected]);
|
|
@@ -10021,7 +10077,7 @@ function Binance() {
|
|
|
10021
10077
|
queryFn: async () => await getSupportedNetworksQuery()
|
|
10022
10078
|
});
|
|
10023
10079
|
const networkAvailableCryptoList = networksData?.data?.filter(
|
|
10024
|
-
(ntw) => ntw.networks.map((n) => n.network).includes(
|
|
10080
|
+
(ntw) => ntw.networks.map((n) => n.network).includes(CHAIN_ID_TO_BINANCE_NETWORK_TICKER[chainConfig.id] || "UNSUPPORTED")
|
|
10025
10081
|
) || [];
|
|
10026
10082
|
const { data: paymentModesData = null, isFetching: isPaymentModesLoading } = useQuery2({
|
|
10027
10083
|
retry: false,
|
|
@@ -10038,7 +10094,7 @@ function Binance() {
|
|
|
10038
10094
|
});
|
|
10039
10095
|
const paymentModes = paymentModesData?.data?.paymentMethods || [];
|
|
10040
10096
|
const selectedPaymentMode = paymentModes?.find((el) => getPayMethodID(el) === paymentMode) || null;
|
|
10041
|
-
|
|
10097
|
+
useEffect15(() => {
|
|
10042
10098
|
useBuyMenuStore.getState().setMinAmount(Number(selectedPaymentMode?.fiatMinLimit || "0"));
|
|
10043
10099
|
}, [selectedPaymentMode]);
|
|
10044
10100
|
const { mutate: estimateQuote, isPending: isQuoteEstimating } = useMutation6({
|
|
@@ -10066,21 +10122,22 @@ function Binance() {
|
|
|
10066
10122
|
}
|
|
10067
10123
|
});
|
|
10068
10124
|
const availableFiats = (tradingPairsData?.data?.fiatCurrencies || []).map((ticker) => ({ ticker }));
|
|
10069
|
-
|
|
10125
|
+
useEffect15(() => {
|
|
10070
10126
|
if (!!selectedFiat || !availableFiats?.length) return;
|
|
10071
|
-
const targetFiat = availableFiats.find((item) =>
|
|
10127
|
+
const targetFiat = availableFiats.find((item) => PREFERRED_FIATS.includes(item.ticker)) || availableFiats[0];
|
|
10072
10128
|
useBuyMenuStore.getState().setSelectedFiat(targetFiat.ticker);
|
|
10073
10129
|
}, [availableFiats, selectedFiat]);
|
|
10074
|
-
|
|
10130
|
+
useEffect15(() => {
|
|
10075
10131
|
if (!!selectedCrypto || !networkAvailableCryptoList?.length) return;
|
|
10076
|
-
|
|
10132
|
+
const targetCrypto = networkAvailableCryptoList.find((item) => PREFERRED_CRYPTOS.includes(item.cryptoCurrency)) || networkAvailableCryptoList[0];
|
|
10133
|
+
useBuyMenuStore.getState().setSelectedCrypto(targetCrypto.cryptoCurrency);
|
|
10077
10134
|
}, [networkAvailableCryptoList, selectedCrypto]);
|
|
10078
|
-
|
|
10135
|
+
useEffect15(() => {
|
|
10079
10136
|
if (!!paymentMode || !paymentModes.length) return;
|
|
10080
10137
|
const targetPaymentMode = paymentModes.find((item) => item.payMethodCode === PREFERRED_PAYMENT_METHOD) || paymentModes[0];
|
|
10081
10138
|
useBinanceStore.getState().setPaymentMode(getPayMethodID(targetPaymentMode));
|
|
10082
10139
|
}, [paymentModes]);
|
|
10083
|
-
|
|
10140
|
+
useEffect15(() => {
|
|
10084
10141
|
return () => {
|
|
10085
10142
|
useBinanceStore.getState().setPaymentMode(null);
|
|
10086
10143
|
qc.resetQueries({ queryKey: [QUERY_KEYS2.binanceTradingPairs] });
|
|
@@ -10202,7 +10259,7 @@ function Binance() {
|
|
|
10202
10259
|
)
|
|
10203
10260
|
] });
|
|
10204
10261
|
}
|
|
10205
|
-
var PREFERRED_PAYMENT_METHOD;
|
|
10262
|
+
var PREFERRED_PAYMENT_METHOD, PREFERRED_FIATS, PREFERRED_CRYPTOS;
|
|
10206
10263
|
var init_Binance = __esm({
|
|
10207
10264
|
"src/internal/components/BuyMenu/binance/Binance.tsx"() {
|
|
10208
10265
|
init_utils2();
|
|
@@ -10223,6 +10280,8 @@ var init_Binance = __esm({
|
|
|
10223
10280
|
init_useBinanceStore();
|
|
10224
10281
|
init_utils6();
|
|
10225
10282
|
PREFERRED_PAYMENT_METHOD = "BUY_CARD";
|
|
10283
|
+
PREFERRED_FIATS = ["USD", "EUR"];
|
|
10284
|
+
PREFERRED_CRYPTOS = ["USDT", "LUMIA"];
|
|
10226
10285
|
}
|
|
10227
10286
|
});
|
|
10228
10287
|
|
|
@@ -10576,30 +10635,24 @@ var init_FinchPayTxHistory = __esm({
|
|
|
10576
10635
|
});
|
|
10577
10636
|
|
|
10578
10637
|
// src/internal/components/BuyMenu/finchpay/networks.ts
|
|
10579
|
-
import {
|
|
10580
|
-
|
|
10581
|
-
LUMIA_MAINNET_CHAIN_ID as LUMIA_MAINNET_CHAIN_ID2,
|
|
10582
|
-
LUMIA_TESTNET_CHAIN_ID
|
|
10583
|
-
} from "@embarkai/core/read";
|
|
10584
|
-
var CHAIN_ID_TO_FINCHPAY_NAME;
|
|
10638
|
+
import { BSC_MAINNET_CHAIN_ID as BSC_MAINNET_CHAIN_ID2, LUMIA_MAINNET_CHAIN_ID as LUMIA_MAINNET_CHAIN_ID2 } from "@embarkai/core/read";
|
|
10639
|
+
var CHAIN_ID_TO_FINCHPAY_NETWORK_TICKER;
|
|
10585
10640
|
var init_networks = __esm({
|
|
10586
10641
|
"src/internal/components/BuyMenu/finchpay/networks.ts"() {
|
|
10587
|
-
|
|
10642
|
+
CHAIN_ID_TO_FINCHPAY_NETWORK_TICKER = {
|
|
10588
10643
|
[LUMIA_MAINNET_CHAIN_ID2]: "LUM20",
|
|
10589
|
-
[
|
|
10590
|
-
[BSC_TESTNET_CHAIN_ID]: "BSC"
|
|
10591
|
-
// TODO: change to BSC mainnet when supported by EmbarkAI
|
|
10644
|
+
[BSC_MAINNET_CHAIN_ID2]: "BSC"
|
|
10592
10645
|
};
|
|
10593
10646
|
}
|
|
10594
10647
|
});
|
|
10595
10648
|
|
|
10596
10649
|
// src/internal/components/BuyMenu/finchpay/useFinchpaySseTxTracing.ts
|
|
10597
10650
|
import { useQueryClient as useQueryClient6 } from "@tanstack/react-query";
|
|
10598
|
-
import { useEffect as
|
|
10651
|
+
import { useEffect as useEffect16, useRef as useRef11 } from "react";
|
|
10599
10652
|
function useFinchpaySseTxTracing(walletAddress) {
|
|
10600
10653
|
const qc = useQueryClient6();
|
|
10601
|
-
const debounceRef =
|
|
10602
|
-
|
|
10654
|
+
const debounceRef = useRef11(null);
|
|
10655
|
+
useEffect16(() => {
|
|
10603
10656
|
if (!walletAddress) return;
|
|
10604
10657
|
const iframeManager = getIframeManager();
|
|
10605
10658
|
if (!iframeManager) return;
|
|
@@ -10648,7 +10701,7 @@ var init_utils7 = __esm({
|
|
|
10648
10701
|
// src/internal/components/BuyMenu/finchpay/FinchPay.tsx
|
|
10649
10702
|
import { useQuery as useQuery3, useQueryClient as useQueryClient7 } from "@tanstack/react-query";
|
|
10650
10703
|
import { DollarSign, LoaderIcon as LoaderIcon5 } from "lucide-react";
|
|
10651
|
-
import { useEffect as
|
|
10704
|
+
import { useEffect as useEffect17 } from "react";
|
|
10652
10705
|
import { Fragment as Fragment12, jsx as jsx42, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
10653
10706
|
function FinchPay() {
|
|
10654
10707
|
const qc = useQueryClient7();
|
|
@@ -10687,7 +10740,7 @@ function FinchPay() {
|
|
|
10687
10740
|
const currentNetworkCoins = [];
|
|
10688
10741
|
data.forEach((currency) => {
|
|
10689
10742
|
networks.push(currency.network);
|
|
10690
|
-
const isCurrentNetworkCoin = currency.network?.toUpperCase() ===
|
|
10743
|
+
const isCurrentNetworkCoin = currency.network?.toUpperCase() === CHAIN_ID_TO_FINCHPAY_NETWORK_TICKER[chainConfig.id]?.toUpperCase();
|
|
10691
10744
|
if (currency.is_fiat) {
|
|
10692
10745
|
fiats.push(currency);
|
|
10693
10746
|
} else {
|
|
@@ -10724,11 +10777,11 @@ function FinchPay() {
|
|
|
10724
10777
|
})
|
|
10725
10778
|
});
|
|
10726
10779
|
const minimum = Number(limitsData?.min_amount || "0");
|
|
10727
|
-
|
|
10780
|
+
useEffect17(() => {
|
|
10728
10781
|
if (minimum <= 0) return;
|
|
10729
10782
|
useBuyMenuStore.getState().setMinAmount(minimum);
|
|
10730
10783
|
}, [minimum]);
|
|
10731
|
-
|
|
10784
|
+
useEffect17(() => {
|
|
10732
10785
|
if (srcInputAmount >= minimum) return;
|
|
10733
10786
|
useBuyMenuStore.getState().setRenderKey(`finchpay-input-minimum-warning-${Date.now()}`);
|
|
10734
10787
|
}, [minimum, srcInputAmount]);
|
|
@@ -10756,23 +10809,23 @@ function FinchPay() {
|
|
|
10756
10809
|
// defaults to CARD estimation, widgetUrl
|
|
10757
10810
|
})
|
|
10758
10811
|
});
|
|
10759
|
-
|
|
10812
|
+
useEffect17(() => {
|
|
10760
10813
|
const { error: errorTitle, message: errorMessage } = handleErrors([currenciesError, limitsError, estimateError]);
|
|
10761
10814
|
if (!errorTitle && !errorMessage) return;
|
|
10762
10815
|
console.error(`[BuyModal][Binance] ${errorTitle}: ${errorMessage}`);
|
|
10763
10816
|
useBuyMenuStore.getState().setError(errorMessage);
|
|
10764
10817
|
}, [currenciesError, limitsError, estimateError]);
|
|
10765
|
-
|
|
10818
|
+
useEffect17(() => {
|
|
10766
10819
|
if (!!selectedFiat || currenciesData.fiats.length === 0) return;
|
|
10767
10820
|
const fallbackFiat = currenciesData.fiats[0];
|
|
10768
10821
|
const targetFiat = currenciesData.fiats.find((f) => f.ticker.toUpperCase() === "USD") || fallbackFiat;
|
|
10769
10822
|
useBuyMenuStore.getState().setSelectedFiat(targetFiat.ticker);
|
|
10770
10823
|
}, [currenciesData, selectedFiat]);
|
|
10771
|
-
|
|
10824
|
+
useEffect17(() => {
|
|
10772
10825
|
if (!!selectedCrypto || currenciesData.currentNetworkCoins.length === 0) return;
|
|
10773
10826
|
useBuyMenuStore.getState().setSelectedCrypto(currenciesData.currentNetworkCoins[0].ticker);
|
|
10774
10827
|
}, [currenciesData, selectedCrypto]);
|
|
10775
|
-
|
|
10828
|
+
useEffect17(() => {
|
|
10776
10829
|
return () => {
|
|
10777
10830
|
qc.resetQueries({ queryKey: [QUERY_KEYS2.finchPayCurrencies] });
|
|
10778
10831
|
qc.resetQueries({ queryKey: [QUERY_KEYS2.finchPayLimits] });
|
|
@@ -11025,76 +11078,58 @@ var init_ProviderSelector = __esm({
|
|
|
11025
11078
|
}
|
|
11026
11079
|
});
|
|
11027
11080
|
|
|
11028
|
-
// src/internal/utils/debounce.ts
|
|
11029
|
-
function debounce5(func, waitFor) {
|
|
11030
|
-
let timeout;
|
|
11031
|
-
return (...args) => {
|
|
11032
|
-
if (timeout) clearTimeout(timeout);
|
|
11033
|
-
timeout = setTimeout(() => func(...args), waitFor);
|
|
11034
|
-
};
|
|
11035
|
-
}
|
|
11036
|
-
var init_debounce = __esm({
|
|
11037
|
-
"src/internal/utils/debounce.ts"() {
|
|
11038
|
-
}
|
|
11039
|
-
});
|
|
11040
|
-
|
|
11041
11081
|
// src/internal/components/BuyMenu/useHandleInputAmount.ts
|
|
11042
|
-
import {
|
|
11082
|
+
import { useEffect as useEffect18, useRef as useRef12 } from "react";
|
|
11043
11083
|
var ON_INPUT_QUERY_DELAY, useHandleInputAmount;
|
|
11044
11084
|
var init_useHandleInputAmount = __esm({
|
|
11045
11085
|
"src/internal/components/BuyMenu/useHandleInputAmount.ts"() {
|
|
11046
|
-
init_debounce();
|
|
11047
11086
|
init_contants();
|
|
11048
11087
|
init_useBuyMenuStore();
|
|
11049
11088
|
ON_INPUT_QUERY_DELAY = 1500;
|
|
11050
11089
|
useHandleInputAmount = () => {
|
|
11051
|
-
const lastRampProviderRef =
|
|
11090
|
+
const lastRampProviderRef = useRef12(DEFAULT_PROVIDER2);
|
|
11052
11091
|
const rampProvider = useBuyMenuStore((st) => st.rampProvider);
|
|
11053
11092
|
const srcInputAmount = useBuyMenuStore((st) => st.srcInputAmount);
|
|
11054
11093
|
const minAmount = useBuyMenuStore((st) => st.minAmount);
|
|
11055
|
-
const
|
|
11056
|
-
|
|
11057
|
-
|
|
11094
|
+
const queryAmountTimer = useRef12(null);
|
|
11095
|
+
useEffect18(() => {
|
|
11096
|
+
if (queryAmountTimer.current) clearTimeout(queryAmountTimer.current);
|
|
11097
|
+
queryAmountTimer.current = setTimeout(() => {
|
|
11098
|
+
const checkedValue = Math.ceil(Math.max(Number(srcInputAmount), Number(minAmount)));
|
|
11058
11099
|
useBuyMenuStore.getState().setSrcInputAmount(checkedValue);
|
|
11059
11100
|
useBuyMenuStore.getState().setSrcQueryAmount(checkedValue);
|
|
11060
|
-
}, ON_INPUT_QUERY_DELAY)
|
|
11061
|
-
|
|
11062
|
-
)
|
|
11063
|
-
useEffect17(() => setQueryAmountDebounced(srcInputAmount), [srcInputAmount, setQueryAmountDebounced]);
|
|
11064
|
-
useEffect17(() => {
|
|
11101
|
+
}, ON_INPUT_QUERY_DELAY);
|
|
11102
|
+
}, [minAmount, srcInputAmount]);
|
|
11103
|
+
useEffect18(() => {
|
|
11065
11104
|
if (lastRampProviderRef.current === rampProvider) return;
|
|
11066
11105
|
const {
|
|
11067
11106
|
setIsProviderSummary,
|
|
11068
11107
|
setIsCryptoSelector,
|
|
11069
11108
|
setIsFiatSelector,
|
|
11070
|
-
setIsPaymentModeSelector
|
|
11071
|
-
setSelectedCrypto,
|
|
11072
|
-
setSelectedFiat
|
|
11073
|
-
setSrcInputAmount,
|
|
11074
|
-
setSrcQueryAmount
|
|
11109
|
+
setIsPaymentModeSelector
|
|
11110
|
+
// setSelectedCrypto,
|
|
11111
|
+
// setSelectedFiat
|
|
11112
|
+
// setSrcInputAmount,
|
|
11113
|
+
// setSrcQueryAmount
|
|
11075
11114
|
} = useBuyMenuStore.getState();
|
|
11076
11115
|
setIsProviderSummary(false);
|
|
11077
11116
|
setIsCryptoSelector(false);
|
|
11078
11117
|
setIsFiatSelector(false);
|
|
11079
11118
|
setIsPaymentModeSelector(false);
|
|
11080
|
-
setSelectedCrypto(null);
|
|
11081
|
-
setSelectedFiat(null);
|
|
11082
|
-
setSrcInputAmount(0);
|
|
11083
|
-
setSrcQueryAmount(0);
|
|
11084
11119
|
lastRampProviderRef.current = rampProvider;
|
|
11085
11120
|
}, [rampProvider]);
|
|
11086
11121
|
};
|
|
11087
11122
|
}
|
|
11088
11123
|
});
|
|
11089
11124
|
|
|
11090
|
-
// src/internal/components/BuyMenu/
|
|
11125
|
+
// src/internal/components/BuyMenu/BuyMenu.tsx
|
|
11091
11126
|
import { ArrowLeft as ArrowLeft3 } from "lucide-react";
|
|
11092
11127
|
import { Fragment as Fragment14, jsx as jsx44, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
11093
11128
|
function BuyMenu() {
|
|
11094
11129
|
const { t } = useT();
|
|
11095
11130
|
const walletAddress = useSession((st) => st.address);
|
|
11096
|
-
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
11097
11131
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
11132
|
+
useBuyMenuParams();
|
|
11098
11133
|
useHandleInputAmount();
|
|
11099
11134
|
const renderKey = useBuyMenuStore((st) => st.renderKey);
|
|
11100
11135
|
const rampProvider = useBuyMenuStore((st) => st.rampProvider);
|
|
@@ -11160,7 +11195,7 @@ function BuyMenu() {
|
|
|
11160
11195
|
setIsPaymentModeSelector(false);
|
|
11161
11196
|
return;
|
|
11162
11197
|
}
|
|
11163
|
-
setPage("main-menu" /* MAIN_MENU */);
|
|
11198
|
+
useLayoutDataStore.getState().setPage("main-menu" /* MAIN_MENU */);
|
|
11164
11199
|
},
|
|
11165
11200
|
children: /* @__PURE__ */ jsx44(ArrowLeft3, { className: "h-4 w-4" })
|
|
11166
11201
|
}
|
|
@@ -11206,8 +11241,8 @@ function BuyMenu() {
|
|
|
11206
11241
|
}
|
|
11207
11242
|
);
|
|
11208
11243
|
}
|
|
11209
|
-
var
|
|
11210
|
-
"src/internal/components/BuyMenu/
|
|
11244
|
+
var init_BuyMenu = __esm({
|
|
11245
|
+
"src/internal/components/BuyMenu/BuyMenu.tsx"() {
|
|
11211
11246
|
init_utils2();
|
|
11212
11247
|
init_SessionContext();
|
|
11213
11248
|
init_i18n();
|
|
@@ -11224,10 +11259,40 @@ var init_ByuMenu = __esm({
|
|
|
11224
11259
|
}
|
|
11225
11260
|
});
|
|
11226
11261
|
|
|
11262
|
+
// src/internal/components/BuyMenu/external.usage.ts
|
|
11263
|
+
async function getInProgressOnrampTransactionsList(params) {
|
|
11264
|
+
const { walletAddress, chainId } = params;
|
|
11265
|
+
const [binanceResponse, finchpayResponse] = await Promise.all([
|
|
11266
|
+
getTransactionList({ walletAddress, txStatuses: ["1"], page: 1, pageSize: 5 }),
|
|
11267
|
+
// status 1 = ON_RAMP_PROCESSING
|
|
11268
|
+
getTransactionList2({ walletAddress, txStatuses: ["PROCESSING"], page: 1, pageSize: 5 })
|
|
11269
|
+
]);
|
|
11270
|
+
const binanceProgressTXs = binanceResponse.data.filter(
|
|
11271
|
+
(tx) => tx.embarkChainId === CHAIN_ID_TO_BINANCE_NETWORK_TICKER[chainId]
|
|
11272
|
+
);
|
|
11273
|
+
const finchpayProgressTXs = finchpayResponse.data.filter(
|
|
11274
|
+
(tx) => tx.embarkChainId === CHAIN_ID_TO_FINCHPAY_NETWORK_TICKER[chainId]
|
|
11275
|
+
);
|
|
11276
|
+
return {
|
|
11277
|
+
hasInProgressTXs: !!binanceProgressTXs.length || !!finchpayProgressTXs.length,
|
|
11278
|
+
// HINT: update on provider added
|
|
11279
|
+
inProgressTXs: [...binanceProgressTXs, ...finchpayProgressTXs]
|
|
11280
|
+
};
|
|
11281
|
+
}
|
|
11282
|
+
var init_external_usage = __esm({
|
|
11283
|
+
"src/internal/components/BuyMenu/external.usage.ts"() {
|
|
11284
|
+
init_api();
|
|
11285
|
+
init_config();
|
|
11286
|
+
init_api2();
|
|
11287
|
+
init_networks();
|
|
11288
|
+
}
|
|
11289
|
+
});
|
|
11290
|
+
|
|
11227
11291
|
// src/internal/components/BuyMenu/index.ts
|
|
11228
|
-
var
|
|
11292
|
+
var init_BuyMenu2 = __esm({
|
|
11229
11293
|
"src/internal/components/BuyMenu/index.ts"() {
|
|
11230
|
-
|
|
11294
|
+
init_BuyMenu();
|
|
11295
|
+
init_external_usage();
|
|
11231
11296
|
}
|
|
11232
11297
|
});
|
|
11233
11298
|
|
|
@@ -11347,11 +11412,11 @@ var init_sepolia = __esm({
|
|
|
11347
11412
|
import {
|
|
11348
11413
|
ARBITRUM_SEPOLIA_CHAIN_ID,
|
|
11349
11414
|
BASE_SEPOLIA_CHAIN_ID,
|
|
11350
|
-
BSC_MAINNET_CHAIN_ID as
|
|
11351
|
-
BSC_TESTNET_CHAIN_ID
|
|
11415
|
+
BSC_MAINNET_CHAIN_ID as BSC_MAINNET_CHAIN_ID3,
|
|
11416
|
+
BSC_TESTNET_CHAIN_ID,
|
|
11352
11417
|
LUMIA_MAINNET_CHAIN_ID as LUMIA_MAINNET_CHAIN_ID3,
|
|
11353
11418
|
LUMIA_PULSAR_TESTNET_CHAIN_ID,
|
|
11354
|
-
LUMIA_TESTNET_CHAIN_ID
|
|
11419
|
+
LUMIA_TESTNET_CHAIN_ID,
|
|
11355
11420
|
SEPOLIA_CHAIN_ID
|
|
11356
11421
|
} from "@embarkai/core/read";
|
|
11357
11422
|
var NETWORKS_ICONS;
|
|
@@ -11366,10 +11431,10 @@ var init_networks2 = __esm({
|
|
|
11366
11431
|
NETWORKS_ICONS = {
|
|
11367
11432
|
1: ethereum_default,
|
|
11368
11433
|
[LUMIA_MAINNET_CHAIN_ID3]: lumia_default2,
|
|
11369
|
-
[
|
|
11434
|
+
[LUMIA_TESTNET_CHAIN_ID]: lumia_default2,
|
|
11370
11435
|
[LUMIA_PULSAR_TESTNET_CHAIN_ID]: lumia_default2,
|
|
11371
|
-
[
|
|
11372
|
-
[
|
|
11436
|
+
[BSC_MAINNET_CHAIN_ID3]: bsc_default,
|
|
11437
|
+
[BSC_TESTNET_CHAIN_ID]: bsc_default,
|
|
11373
11438
|
[BASE_SEPOLIA_CHAIN_ID]: base_default,
|
|
11374
11439
|
[SEPOLIA_CHAIN_ID]: sepolia_default,
|
|
11375
11440
|
[ARBITRUM_SEPOLIA_CHAIN_ID]: arbitrum_default
|
|
@@ -11408,7 +11473,7 @@ var init_truncateMiddle = __esm({
|
|
|
11408
11473
|
// src/internal/components/ChainsMenu/ChainItem.tsx
|
|
11409
11474
|
import { getChainConfig as getChainConfig7 } from "@embarkai/core/read";
|
|
11410
11475
|
import { Copy, ExternalLink, Loader as Loader6 } from "lucide-react";
|
|
11411
|
-
import { useRef as
|
|
11476
|
+
import { useRef as useRef13, useState as useState9 } from "react";
|
|
11412
11477
|
import { jsx as jsx51, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
11413
11478
|
function getPaymasterExplorerUrl(chainId, paymasterAddress) {
|
|
11414
11479
|
const chainConfig = getChainConfig7(chainId);
|
|
@@ -11431,7 +11496,7 @@ function ChainItem(props) {
|
|
|
11431
11496
|
const isSessionLoading = useSession((st) => st.isLoading);
|
|
11432
11497
|
const activeChainId = useSession((st) => st.activeChainId);
|
|
11433
11498
|
const [copiedChainId, setCopiedChainId] = useState9(null);
|
|
11434
|
-
const copiedResetTimerRef =
|
|
11499
|
+
const copiedResetTimerRef = useRef13(null);
|
|
11435
11500
|
const isActiveChain = activeChainId === chainId;
|
|
11436
11501
|
const paymasterAddress = isActiveChain ? activePaymasterData?.address : null;
|
|
11437
11502
|
const paymasterExplorerUrl = paymasterAddress ? getPaymasterExplorerUrl(chainId, paymasterAddress) : null;
|
|
@@ -12403,7 +12468,7 @@ var init_guardian_backup = __esm({
|
|
|
12403
12468
|
});
|
|
12404
12469
|
|
|
12405
12470
|
// src/internal/components/DevicesMenu/DeviceManageScreen.tsx
|
|
12406
|
-
import { useCallback as
|
|
12471
|
+
import { useCallback as useCallback14, useEffect as useEffect19, useRef as useRef14, useState as useState12 } from "react";
|
|
12407
12472
|
import { ArrowLeft as ArrowLeft7, Cpu, Download, HardDrive, Loader2 as Loader23, Trash2, Upload } from "lucide-react";
|
|
12408
12473
|
import { Fragment as Fragment15, jsx as jsx55, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
12409
12474
|
function formatSize(bytes) {
|
|
@@ -12418,19 +12483,19 @@ function DeviceManageScreen() {
|
|
|
12418
12483
|
const userId = session?.mpcUserId || "";
|
|
12419
12484
|
const deviceId = pageParams?.deviceId;
|
|
12420
12485
|
const deviceName = pageParams?.deviceName;
|
|
12421
|
-
const guardianRef =
|
|
12486
|
+
const guardianRef = useRef14(null);
|
|
12422
12487
|
const [screen, setScreen] = useState12({ step: "connecting" });
|
|
12423
12488
|
const [actionState, setActionState] = useState12(null);
|
|
12424
12489
|
const [password, setPassword] = useState12("");
|
|
12425
12490
|
const [statusMessage, setStatusMessage] = useState12(null);
|
|
12426
12491
|
const [errorMessage, setErrorMessage] = useState12(null);
|
|
12427
12492
|
const [waitingConfirm, setWaitingConfirm] = useState12(false);
|
|
12428
|
-
|
|
12493
|
+
useEffect19(() => {
|
|
12429
12494
|
if (!statusMessage) return;
|
|
12430
12495
|
const t = setTimeout(() => setStatusMessage(null), 3e3);
|
|
12431
12496
|
return () => clearTimeout(t);
|
|
12432
12497
|
}, [statusMessage]);
|
|
12433
|
-
|
|
12498
|
+
useEffect19(() => {
|
|
12434
12499
|
if (!deviceId || !isWebSerialAvailable()) {
|
|
12435
12500
|
setScreen({ step: "error", message: "WebSerial not available" });
|
|
12436
12501
|
return;
|
|
@@ -12462,7 +12527,7 @@ function DeviceManageScreen() {
|
|
|
12462
12527
|
guardianRef.current?.close();
|
|
12463
12528
|
};
|
|
12464
12529
|
}, [deviceId]);
|
|
12465
|
-
const refreshList =
|
|
12530
|
+
const refreshList = useCallback14(async () => {
|
|
12466
12531
|
const guardian = guardianRef.current;
|
|
12467
12532
|
if (!guardian || screen.step !== "connected") return;
|
|
12468
12533
|
try {
|
|
@@ -12471,7 +12536,7 @@ function DeviceManageScreen() {
|
|
|
12471
12536
|
} catch {
|
|
12472
12537
|
}
|
|
12473
12538
|
}, [screen]);
|
|
12474
|
-
const handleBackup =
|
|
12539
|
+
const handleBackup = useCallback14(async () => {
|
|
12475
12540
|
const guardian = guardianRef.current;
|
|
12476
12541
|
const iframe4 = getIframeManager();
|
|
12477
12542
|
if (!guardian || !iframe4 || !userId) return;
|
|
@@ -12495,7 +12560,7 @@ function DeviceManageScreen() {
|
|
|
12495
12560
|
setActionState(null);
|
|
12496
12561
|
}
|
|
12497
12562
|
}, [password, userId, refreshList]);
|
|
12498
|
-
const handleOverwrite =
|
|
12563
|
+
const handleOverwrite = useCallback14(async () => {
|
|
12499
12564
|
const guardian = guardianRef.current;
|
|
12500
12565
|
const iframe4 = getIframeManager();
|
|
12501
12566
|
if (!guardian || !iframe4 || !userId) return;
|
|
@@ -12515,7 +12580,7 @@ function DeviceManageScreen() {
|
|
|
12515
12580
|
setActionState(null);
|
|
12516
12581
|
}
|
|
12517
12582
|
}, [password, userId, refreshList]);
|
|
12518
|
-
const handleDelete =
|
|
12583
|
+
const handleDelete = useCallback14(async (keyshareId) => {
|
|
12519
12584
|
const guardian = guardianRef.current;
|
|
12520
12585
|
if (!guardian) return;
|
|
12521
12586
|
setActionState({ action: "delete", keyshareId, substep: "confirm-device" });
|
|
@@ -12695,7 +12760,7 @@ var init_DeviceManageScreen = __esm({
|
|
|
12695
12760
|
});
|
|
12696
12761
|
|
|
12697
12762
|
// src/internal/components/DevicesMenu/DeviceRestoreScreen.tsx
|
|
12698
|
-
import { useCallback as
|
|
12763
|
+
import { useCallback as useCallback15, useState as useState13 } from "react";
|
|
12699
12764
|
import { AlertTriangle as AlertTriangle3, ArrowLeft as ArrowLeft8, Download as Download2, Loader2 as Loader24 } from "lucide-react";
|
|
12700
12765
|
import { Fragment as Fragment16, jsx as jsx56, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
12701
12766
|
function DeviceRestoreScreen() {
|
|
@@ -12711,7 +12776,7 @@ function DeviceRestoreScreen() {
|
|
|
12711
12776
|
const [isWorking, setIsWorking] = useState13(false);
|
|
12712
12777
|
const [statusMessage, setStatusMessage] = useState13(null);
|
|
12713
12778
|
const [errorMessage, setErrorMessage] = useState13(null);
|
|
12714
|
-
const handleRestore =
|
|
12779
|
+
const handleRestore = useCallback15(async () => {
|
|
12715
12780
|
if (!password || !keyshareId || !userId) return;
|
|
12716
12781
|
const iframe4 = getIframeManager();
|
|
12717
12782
|
if (!iframe4) {
|
|
@@ -13015,7 +13080,7 @@ var init_useRestoreStore = __esm({
|
|
|
13015
13080
|
});
|
|
13016
13081
|
|
|
13017
13082
|
// src/internal/components/KeyshareRestoreMenu/hooks/useOnRestoreSuccess.ts
|
|
13018
|
-
import { useCallback as
|
|
13083
|
+
import { useCallback as useCallback16 } from "react";
|
|
13019
13084
|
function useOnRestoreSuccess() {
|
|
13020
13085
|
const { config, callbacksRef } = useProviderConfig();
|
|
13021
13086
|
const setIsDialogForced = useLayoutStore((st) => st.setIsDialogForced);
|
|
@@ -13031,7 +13096,7 @@ function useOnRestoreSuccess() {
|
|
|
13031
13096
|
setStatus
|
|
13032
13097
|
} = useSession();
|
|
13033
13098
|
const { setError, setSuccess } = useRestoreStore();
|
|
13034
|
-
const createSessionWithKeyshare =
|
|
13099
|
+
const createSessionWithKeyshare = useCallback16(
|
|
13035
13100
|
async (userId, hasServerKeyshare, isNewUser) => {
|
|
13036
13101
|
try {
|
|
13037
13102
|
try {
|
|
@@ -13072,7 +13137,7 @@ function useOnRestoreSuccess() {
|
|
|
13072
13137
|
},
|
|
13073
13138
|
[setStatus, usePaymaster, activeChainId, publicClient]
|
|
13074
13139
|
);
|
|
13075
|
-
const onRestoreSuccess =
|
|
13140
|
+
const onRestoreSuccess = useCallback16(async () => {
|
|
13076
13141
|
const { verifyToken: verifyToken2, jwtTokenManager: jwtTokenManager4 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
13077
13142
|
const verify = await verifyToken2();
|
|
13078
13143
|
const hasServerKeyshare = verify?.hasKeyshare ?? jwtTokenManager4.getHasKeyshare() ?? false;
|
|
@@ -13558,7 +13623,7 @@ var init_cloudStorage = __esm({
|
|
|
13558
13623
|
|
|
13559
13624
|
// src/internal/components/KeyshareRestoreMenu/hooks/useCreateBackup.ts
|
|
13560
13625
|
import { useMutation as useMutation9, useQueryClient as useQueryClient9 } from "@tanstack/react-query";
|
|
13561
|
-
import { useCallback as
|
|
13626
|
+
import { useCallback as useCallback17, useEffect as useEffect20 } from "react";
|
|
13562
13627
|
function useCreateBackup() {
|
|
13563
13628
|
const qc = useQueryClient9();
|
|
13564
13629
|
const session = useSession((st) => st.session);
|
|
@@ -13567,7 +13632,7 @@ function useCreateBackup() {
|
|
|
13567
13632
|
const usePasskey = useRestoreStore((st) => st.usePasskey);
|
|
13568
13633
|
const restorePassword = useRestoreStore((st) => st.restorePassword);
|
|
13569
13634
|
const selectedCloudProvider = useRestoreStore((st) => st.selectedCloudProvider);
|
|
13570
|
-
|
|
13635
|
+
useEffect20(() => {
|
|
13571
13636
|
if (!hasServerVault) {
|
|
13572
13637
|
useRestoreStore.getState().setMethod("server");
|
|
13573
13638
|
useLayoutStore.getState().setIsDialogForced(true);
|
|
@@ -13575,7 +13640,7 @@ function useCreateBackup() {
|
|
|
13575
13640
|
}, [hasServerVault]);
|
|
13576
13641
|
const recoveryUserId = useSession((st) => st.recoveryUserId);
|
|
13577
13642
|
const passportUserId = session?.mpcUserId || recoveryUserId || "";
|
|
13578
|
-
const onBackupSuccess =
|
|
13643
|
+
const onBackupSuccess = useCallback17(() => {
|
|
13579
13644
|
console.log("[EMBARKAI BACKUP] Backup created successfully");
|
|
13580
13645
|
}, [hasServerVault]);
|
|
13581
13646
|
const { mutate: createPasswordBackup, isPending: isPasswordBackupCreating } = useMutation9({
|
|
@@ -13862,7 +13927,7 @@ var init_useRestoreAccount = __esm({
|
|
|
13862
13927
|
});
|
|
13863
13928
|
|
|
13864
13929
|
// src/internal/components/KeyshareRestoreMenu/hooks/useValidateFileBackup.ts
|
|
13865
|
-
import { useEffect as
|
|
13930
|
+
import { useEffect as useEffect21 } from "react";
|
|
13866
13931
|
function validateRestoreFileFormat(parsedData) {
|
|
13867
13932
|
if (typeof parsedData !== "object" || parsedData === null) return false;
|
|
13868
13933
|
const data = parsedData;
|
|
@@ -13872,7 +13937,7 @@ function useValidateFileBackup() {
|
|
|
13872
13937
|
const restoreFile = useRestoreStore((st) => st.restoreFile);
|
|
13873
13938
|
const setError = useRestoreStore((st) => st.setError);
|
|
13874
13939
|
const setUsePasskey = useRestoreStore((st) => st.setUsePasskey);
|
|
13875
|
-
|
|
13940
|
+
useEffect21(() => {
|
|
13876
13941
|
if (!restoreFile) {
|
|
13877
13942
|
return;
|
|
13878
13943
|
}
|
|
@@ -13998,7 +14063,7 @@ var init_MethodSelector = __esm({
|
|
|
13998
14063
|
|
|
13999
14064
|
// src/internal/components/KeyshareRestoreMenu/components/PasswordPasskey.tsx
|
|
14000
14065
|
import { ChevronRight as ChevronRight2, Eye, EyeOff, Info as Info3, Key as Key4, Loader as Loader8, Plus } from "lucide-react";
|
|
14001
|
-
import { useEffect as
|
|
14066
|
+
import { useEffect as useEffect22, useRef as useRef15 } from "react";
|
|
14002
14067
|
import { Fragment as Fragment18, jsx as jsx59, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
14003
14068
|
function PasswordPasskey(props) {
|
|
14004
14069
|
const { t } = useT();
|
|
@@ -14013,7 +14078,7 @@ function PasswordPasskey(props) {
|
|
|
14013
14078
|
onCreatePasskey
|
|
14014
14079
|
} = props;
|
|
14015
14080
|
const hasServerVault = useSession((st) => st.hasServerVault);
|
|
14016
|
-
const actionRef =
|
|
14081
|
+
const actionRef = useRef15(null);
|
|
14017
14082
|
const {
|
|
14018
14083
|
showPassword,
|
|
14019
14084
|
restorePassword,
|
|
@@ -14027,7 +14092,7 @@ function PasswordPasskey(props) {
|
|
|
14027
14092
|
} = useRestoreStore();
|
|
14028
14093
|
const { config } = useProviderConfig();
|
|
14029
14094
|
const isPasskeyEnabled = config.current.passkey.enabled;
|
|
14030
|
-
|
|
14095
|
+
useEffect22(() => {
|
|
14031
14096
|
if (!isPasskeyEnabled && usePasskey) setUsePasskey(false);
|
|
14032
14097
|
}, [isPasskeyEnabled, usePasskey]);
|
|
14033
14098
|
return /* @__PURE__ */ jsxs53(Fragment18, { children: [
|
|
@@ -14355,7 +14420,7 @@ var init_File = __esm({
|
|
|
14355
14420
|
import { useQueryClient as useQueryClient10 } from "@tanstack/react-query";
|
|
14356
14421
|
import dayjs3 from "dayjs";
|
|
14357
14422
|
import { Download as Download3, Key as Key5, Upload as Upload3 } from "lucide-react";
|
|
14358
|
-
import { useEffect as
|
|
14423
|
+
import { useEffect as useEffect23 } from "react";
|
|
14359
14424
|
import { Fragment as Fragment21, jsx as jsx62, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
14360
14425
|
function Server(props) {
|
|
14361
14426
|
const { isLoading, mode = "restore", serverHandler, createPasskeyHandler } = props;
|
|
@@ -14365,7 +14430,7 @@ function Server(props) {
|
|
|
14365
14430
|
const usePasskey = useRestoreStore((st) => st.usePasskey);
|
|
14366
14431
|
const setUsePasskey = useRestoreStore((st) => st.setUsePasskey);
|
|
14367
14432
|
const serverRecoveryStatus = qc.getQueryData([CHECK_BACKUP_QUERY_KEY, address]);
|
|
14368
|
-
|
|
14433
|
+
useEffect23(() => {
|
|
14369
14434
|
if (mode === "backup" || !serverRecoveryStatus?.created?.encryptionMethod) return;
|
|
14370
14435
|
setUsePasskey(serverRecoveryStatus.created.encryptionMethod === "passkey");
|
|
14371
14436
|
}, [mode, serverRecoveryStatus, setUsePasskey]);
|
|
@@ -14548,7 +14613,7 @@ var init_select = __esm({
|
|
|
14548
14613
|
// src/internal/components/KeyshareRestoreMenu/methods/Cloud.tsx
|
|
14549
14614
|
import { useQuery as useQuery6 } from "@tanstack/react-query";
|
|
14550
14615
|
import { ArrowLeft as ArrowLeft10, CloudDownload, CloudUpload, Loader as Loader9 } from "lucide-react";
|
|
14551
|
-
import { useEffect as
|
|
14616
|
+
import { useEffect as useEffect24 } from "react";
|
|
14552
14617
|
import { Fragment as Fragment22, jsx as jsx64, jsxs as jsxs58 } from "react/jsx-runtime";
|
|
14553
14618
|
function Cloud2(props) {
|
|
14554
14619
|
const { isLoading, mode = "restore", cloudHandler } = props;
|
|
@@ -14569,7 +14634,7 @@ function Cloud2(props) {
|
|
|
14569
14634
|
return availableProviders.map((p) => ({ id: p.id, name: p.name, available: p.isAvailable() }));
|
|
14570
14635
|
}
|
|
14571
14636
|
});
|
|
14572
|
-
|
|
14637
|
+
useEffect24(() => {
|
|
14573
14638
|
if (isCloudProvidersLoading) return;
|
|
14574
14639
|
if (!!cloudProvidersError) {
|
|
14575
14640
|
console.error("[KeyshareBackup] Failed to load cloud providers:", cloudProvidersError);
|
|
@@ -14809,7 +14874,7 @@ var init_methods = __esm({
|
|
|
14809
14874
|
// src/internal/components/KeyshareRestoreMenu/KeyshareRestoreMenu.tsx
|
|
14810
14875
|
import { useMutation as useMutation11, useQuery as useQuery7, useQueryClient as useQueryClient11 } from "@tanstack/react-query";
|
|
14811
14876
|
import { AlertCircle as AlertCircle2, CheckCircle2, CloudDownload as CloudDownload2, Loader as Loader10, UserCircle as UserCircle2 } from "lucide-react";
|
|
14812
|
-
import { useEffect as
|
|
14877
|
+
import { useEffect as useEffect25 } from "react";
|
|
14813
14878
|
import { useDisconnect } from "wagmi";
|
|
14814
14879
|
import { Fragment as Fragment24, jsx as jsx66, jsxs as jsxs60 } from "react/jsx-runtime";
|
|
14815
14880
|
var RESTORE_COMPONENTS, KeyshareRestoreMenu;
|
|
@@ -14846,7 +14911,7 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
14846
14911
|
const error = useRestoreStore((st) => st.error);
|
|
14847
14912
|
const success = useRestoreStore((st) => st.success);
|
|
14848
14913
|
const currentRestoreMethod = useRestoreStore((st) => st.method);
|
|
14849
|
-
|
|
14914
|
+
useEffect25(() => {
|
|
14850
14915
|
const { setIsDialogForced } = useLayoutStore.getState();
|
|
14851
14916
|
const { setRestorePassword, setRestoreFile, setShowPassword, setUsePasskey, setMethod } = useRestoreStore.getState();
|
|
14852
14917
|
setIsDialogForced(true);
|
|
@@ -14886,7 +14951,7 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
14886
14951
|
queryFn: async () => await getShareRecoveryStats()
|
|
14887
14952
|
});
|
|
14888
14953
|
const hasServerBackup = serverRecoveryStatus?.created || serverRecoveryStatus?.devices?.length > 0;
|
|
14889
|
-
|
|
14954
|
+
useEffect25(() => {
|
|
14890
14955
|
if (!!hasServerBackup) useRestoreStore.getState().setMethod("server");
|
|
14891
14956
|
}, [hasServerBackup]);
|
|
14892
14957
|
const { mutate: disconnect, isPending: isDisconnecting } = useMutation11({
|
|
@@ -15033,7 +15098,7 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
15033
15098
|
// src/internal/components/KeyshareRestoreMenu/KeyshareBackupMenu.tsx
|
|
15034
15099
|
import { useQuery as useQuery8 } from "@tanstack/react-query";
|
|
15035
15100
|
import { AlertCircle as AlertCircle3, ArrowLeft as ArrowLeft11, CheckCircle2 as CheckCircle22, Loader as Loader11, LockIcon } from "lucide-react";
|
|
15036
|
-
import { useEffect as
|
|
15101
|
+
import { useEffect as useEffect26 } from "react";
|
|
15037
15102
|
import { Fragment as Fragment25, jsx as jsx67, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
15038
15103
|
function KeyshareBackupMenu() {
|
|
15039
15104
|
const address = useSession((st) => st.address);
|
|
@@ -15044,7 +15109,7 @@ function KeyshareBackupMenu() {
|
|
|
15044
15109
|
const currentBackupMethod = useRestoreStore((st) => st.method);
|
|
15045
15110
|
const error = useRestoreStore((st) => st.error);
|
|
15046
15111
|
const success = useRestoreStore((st) => st.success);
|
|
15047
|
-
|
|
15112
|
+
useEffect26(() => {
|
|
15048
15113
|
const { setSuccess, setError, setRestorePassword, setRestoreFile, setShowPassword, setUsePasskey, setMethod } = useRestoreStore.getState();
|
|
15049
15114
|
return () => {
|
|
15050
15115
|
setSuccess(null);
|
|
@@ -15063,7 +15128,7 @@ function KeyshareBackupMenu() {
|
|
|
15063
15128
|
queryFn: async () => await getShareRecoveryStats()
|
|
15064
15129
|
});
|
|
15065
15130
|
const hasRecoveryData = serverRecoveryStatus?.created || serverRecoveryStatus?.devices?.length > 0;
|
|
15066
|
-
|
|
15131
|
+
useEffect26(() => {
|
|
15067
15132
|
if (!!hasRecoveryData) useRestoreStore.getState().setMethod("server");
|
|
15068
15133
|
}, [hasRecoveryData]);
|
|
15069
15134
|
const {
|
|
@@ -15216,7 +15281,7 @@ var init_KeyshareRestoreMenu2 = __esm({
|
|
|
15216
15281
|
});
|
|
15217
15282
|
|
|
15218
15283
|
// src/hooks/useColorMode.ts
|
|
15219
|
-
import { useCallback as
|
|
15284
|
+
import { useCallback as useCallback18, useEffect as useEffect27 } from "react";
|
|
15220
15285
|
function useColorMode() {
|
|
15221
15286
|
const {
|
|
15222
15287
|
config: { current: config }
|
|
@@ -15224,14 +15289,14 @@ function useColorMode() {
|
|
|
15224
15289
|
const preferedColorMode = config?.preferedColorMode;
|
|
15225
15290
|
const colorMode = useLayoutStore((st) => st.colorMode);
|
|
15226
15291
|
const handleStoreColorMode = useLayoutStore((st) => st.setColorMode);
|
|
15227
|
-
const setColorMode =
|
|
15292
|
+
const setColorMode = useCallback18(
|
|
15228
15293
|
(mode) => {
|
|
15229
15294
|
localStorage.setItem(LOCAL_COLOR_MODE_KEY, mode);
|
|
15230
15295
|
handleStoreColorMode(mode);
|
|
15231
15296
|
},
|
|
15232
15297
|
[handleStoreColorMode]
|
|
15233
15298
|
);
|
|
15234
|
-
|
|
15299
|
+
useEffect27(() => {
|
|
15235
15300
|
let targetColorMode = localStorage.getItem(LOCAL_COLOR_MODE_KEY);
|
|
15236
15301
|
if (!targetColorMode && !preferedColorMode) {
|
|
15237
15302
|
const systemMode = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
@@ -15346,17 +15411,17 @@ var init_SumsubIframeManager = __esm({
|
|
|
15346
15411
|
});
|
|
15347
15412
|
|
|
15348
15413
|
// src/internal/components/KYC/useSumsubIframe.ts
|
|
15349
|
-
import { useEffect as
|
|
15414
|
+
import { useEffect as useEffect28, useRef as useRef16, useState as useState17 } from "react";
|
|
15350
15415
|
function useSumsubIframe({ iframeUrl }) {
|
|
15351
15416
|
const config = useProviderConfig().config;
|
|
15352
15417
|
const { colorMode } = useColorMode();
|
|
15353
|
-
const iframeRef =
|
|
15418
|
+
const iframeRef = useRef16(null);
|
|
15354
15419
|
const [isLoading, setIsLoading] = useState17(true);
|
|
15355
15420
|
const [error, setError] = useState17(null);
|
|
15356
15421
|
const [height, setHeight] = useState17(0);
|
|
15357
15422
|
const [status, setStatus] = useState17("");
|
|
15358
15423
|
const levelName = config.current?.kyc?.options?.levelName;
|
|
15359
|
-
|
|
15424
|
+
useEffect28(() => {
|
|
15360
15425
|
setError(null);
|
|
15361
15426
|
setIsLoading(true);
|
|
15362
15427
|
setStatus("Preparing verification...");
|
|
@@ -15668,14 +15733,14 @@ var init_useProvidersList = __esm({
|
|
|
15668
15733
|
|
|
15669
15734
|
// src/internal/components/MainMenu/MainMenu.tsx
|
|
15670
15735
|
import { ChevronLeft, ChevronRight as ChevronRight3, DollarSign as DollarSign2, Wallet2 as Wallet23 } from "lucide-react";
|
|
15671
|
-
import { useEffect as
|
|
15736
|
+
import { useEffect as useEffect29 } from "react";
|
|
15672
15737
|
import { jsx as jsx72, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
15673
15738
|
function MainMenu() {
|
|
15674
15739
|
const address = useSession((st) => st.address);
|
|
15675
15740
|
const { t } = useT();
|
|
15676
15741
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
15677
15742
|
const setTransitionPageHeight = useLayoutDataStore((st) => st.setTransitionPageHeight);
|
|
15678
|
-
|
|
15743
|
+
useEffect29(() => setTransitionPageHeight(DEFAULT_MAIN_MENU_HEIGHT), []);
|
|
15679
15744
|
useProvidersList();
|
|
15680
15745
|
return /* @__PURE__ */ jsx72("div", { className: "w-full p-[var(--ui-kit-pd)] flex flex-col gap-[var(--ui-kit-gap)]", children: /* @__PURE__ */ jsx72("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__ */ jsxs66(
|
|
15681
15746
|
Button,
|
|
@@ -15720,7 +15785,7 @@ var init_MainMenu2 = __esm({
|
|
|
15720
15785
|
|
|
15721
15786
|
// src/modules/linkedProfiles.ts
|
|
15722
15787
|
import { useQuery as useQuery11, useQueryClient as useQueryClient12 } from "@tanstack/react-query";
|
|
15723
|
-
import { useCallback as
|
|
15788
|
+
import { useCallback as useCallback19 } from "react";
|
|
15724
15789
|
function useLinkedProfiles() {
|
|
15725
15790
|
const qc = useQueryClient12();
|
|
15726
15791
|
const address = useSession((st) => st.address);
|
|
@@ -15744,7 +15809,7 @@ function useLinkedProfiles() {
|
|
|
15744
15809
|
}
|
|
15745
15810
|
});
|
|
15746
15811
|
const { profiles = [], avatar = null } = data || {};
|
|
15747
|
-
const refresh =
|
|
15812
|
+
const refresh = useCallback19(async () => {
|
|
15748
15813
|
await qc.invalidateQueries({ queryKey: [LINKED_PROFILES_QUERY_KEY, address] });
|
|
15749
15814
|
}, [qc, address]);
|
|
15750
15815
|
return { profiles, avatar, isLoading, isFetching, error, refresh };
|
|
@@ -16222,7 +16287,7 @@ var init_EmailNotConnectedWarning = __esm({
|
|
|
16222
16287
|
|
|
16223
16288
|
// src/internal/components/ManageWalletMenu/hooks/useLinkSocial.ts
|
|
16224
16289
|
import { useQueryClient as useQueryClient15 } from "@tanstack/react-query";
|
|
16225
|
-
import React21, { useEffect as
|
|
16290
|
+
import React21, { useEffect as useEffect30 } from "react";
|
|
16226
16291
|
function normalizeSocialLinkError(message) {
|
|
16227
16292
|
if (message === "X_ALREADY_LINKED") {
|
|
16228
16293
|
return "This X account is already linked to another account";
|
|
@@ -16298,7 +16363,7 @@ function useLinkSocial() {
|
|
|
16298
16363
|
[config.social?.providers]
|
|
16299
16364
|
);
|
|
16300
16365
|
const [socialLinkStarted, setSocialLinkStarted] = React21.useState(false);
|
|
16301
|
-
|
|
16366
|
+
useEffect30(() => {
|
|
16302
16367
|
const key = providerType?.toLowerCase();
|
|
16303
16368
|
console.log("[useLinkSocial] Effect triggered:", { key, linkIsLoading, socialLinkStarted, isWalletLinking });
|
|
16304
16369
|
if (isWalletLinking) {
|
|
@@ -16381,7 +16446,7 @@ var init_telegram2 = __esm({
|
|
|
16381
16446
|
|
|
16382
16447
|
// src/internal/components/ManageWalletMenu/hooks/useLinkTelegram.ts
|
|
16383
16448
|
import { useQueryClient as useQueryClient16 } from "@tanstack/react-query";
|
|
16384
|
-
import { useCallback as
|
|
16449
|
+
import { useCallback as useCallback20, useEffect as useEffect31, useState as useState18 } from "react";
|
|
16385
16450
|
function useLinkTelegram() {
|
|
16386
16451
|
const {
|
|
16387
16452
|
config: { current: config },
|
|
@@ -16392,7 +16457,7 @@ function useLinkTelegram() {
|
|
|
16392
16457
|
const isWalletLinking = useLayoutDataStore((st) => st.isWalletLinking);
|
|
16393
16458
|
const { providerType, linkIsLoading, setLinkIsLoading, setProviderType, setAlert } = useManageWalletStore();
|
|
16394
16459
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
16395
|
-
const handleLinkTelegram =
|
|
16460
|
+
const handleLinkTelegram = useCallback20(async () => {
|
|
16396
16461
|
try {
|
|
16397
16462
|
if (shouldBlockSocialAuthInTelegram("telegram")) {
|
|
16398
16463
|
setAlert(buildTelegramBrowserRestriction("Telegram", "linking"));
|
|
@@ -16440,7 +16505,7 @@ function useLinkTelegram() {
|
|
|
16440
16505
|
}
|
|
16441
16506
|
}, [config.social?.providers]);
|
|
16442
16507
|
const [telegramLinkStarted, setTelegramLinkStarted] = useState18(false);
|
|
16443
|
-
|
|
16508
|
+
useEffect31(() => {
|
|
16444
16509
|
console.log("[useLinkTelegram] Effect triggered:", {
|
|
16445
16510
|
providerType,
|
|
16446
16511
|
linkIsLoading,
|
|
@@ -16457,7 +16522,7 @@ function useLinkTelegram() {
|
|
|
16457
16522
|
handleLinkTelegram();
|
|
16458
16523
|
}
|
|
16459
16524
|
}, [providerType, handleLinkTelegram, linkIsLoading, telegramLinkStarted, isWalletLinking]);
|
|
16460
|
-
|
|
16525
|
+
useEffect31(() => {
|
|
16461
16526
|
if (providerType !== "telegram") {
|
|
16462
16527
|
setTelegramLinkStarted(false);
|
|
16463
16528
|
}
|
|
@@ -16977,12 +17042,12 @@ var init_useNicknameStore = __esm({
|
|
|
16977
17042
|
|
|
16978
17043
|
// src/internal/components/NicknameMenu/useNicknameAvailability.ts
|
|
16979
17044
|
import { useMutation as useMutation16 } from "@tanstack/react-query";
|
|
16980
|
-
import { debounce as
|
|
16981
|
-
import { useCallback as
|
|
17045
|
+
import { debounce as debounce5 } from "lodash-es";
|
|
17046
|
+
import { useCallback as useCallback21, useEffect as useEffect32 } from "react";
|
|
16982
17047
|
function useNicknameAvailability(currentNickname) {
|
|
16983
17048
|
const { t } = useT();
|
|
16984
17049
|
const nicknameValue = useNicknameStore((st) => st.nicknameValue);
|
|
16985
|
-
|
|
17050
|
+
useEffect32(() => {
|
|
16986
17051
|
if (!currentNickname) return;
|
|
16987
17052
|
useNicknameStore.getState().setNicknameValue(currentNickname);
|
|
16988
17053
|
}, [currentNickname]);
|
|
@@ -17003,8 +17068,8 @@ function useNicknameAvailability(currentNickname) {
|
|
|
17003
17068
|
useNicknameStore.getState().setError(error?.message || "Failed to check nickname availability");
|
|
17004
17069
|
}
|
|
17005
17070
|
});
|
|
17006
|
-
const debouncedCheckAvailability =
|
|
17007
|
-
|
|
17071
|
+
const debouncedCheckAvailability = useCallback21(debounce5(checkAvailability, DEBOUNCE_MS), [checkAvailability]);
|
|
17072
|
+
useEffect32(() => {
|
|
17008
17073
|
if (!currentNickname) return;
|
|
17009
17074
|
const normalizedInputValue = normalizeNickname(nicknameValue);
|
|
17010
17075
|
const { valid: isNicknameValid } = validateNickname(nicknameValue);
|
|
@@ -17033,7 +17098,7 @@ var init_useNicknameAvailability = __esm({
|
|
|
17033
17098
|
// src/internal/components/NicknameMenu/NicknameEditForm.tsx
|
|
17034
17099
|
import { useMutation as useMutation17, useQueryClient as useQueryClient18 } from "@tanstack/react-query";
|
|
17035
17100
|
import { AtSignIcon, CheckIcon as CheckIcon2, CopyIcon, LoaderIcon as LoaderIcon7, SaveIcon } from "lucide-react";
|
|
17036
|
-
import { useCallback as
|
|
17101
|
+
import { useCallback as useCallback22, useState as useState20 } from "react";
|
|
17037
17102
|
import { Fragment as Fragment29, jsx as jsx79, jsxs as jsxs73 } from "react/jsx-runtime";
|
|
17038
17103
|
function NicknameEditForm(props) {
|
|
17039
17104
|
const { isInitialUser, nicknameInfo } = props;
|
|
@@ -17075,7 +17140,7 @@ function NicknameEditForm(props) {
|
|
|
17075
17140
|
);
|
|
17076
17141
|
}
|
|
17077
17142
|
});
|
|
17078
|
-
const handleNicknameInputChange =
|
|
17143
|
+
const handleNicknameInputChange = useCallback22(
|
|
17079
17144
|
(e) => {
|
|
17080
17145
|
const { error, setError, setNicknameValue } = useNicknameStore.getState();
|
|
17081
17146
|
const value = e.target.value;
|
|
@@ -17090,7 +17155,7 @@ function NicknameEditForm(props) {
|
|
|
17090
17155
|
},
|
|
17091
17156
|
[isNicknameChangeError, isNicknameChangeSuccess, reset, t]
|
|
17092
17157
|
);
|
|
17093
|
-
const handleSubmit =
|
|
17158
|
+
const handleSubmit = useCallback22(
|
|
17094
17159
|
(e) => {
|
|
17095
17160
|
const { nicknameValue: nicknameValue2, setError } = useNicknameStore.getState();
|
|
17096
17161
|
if (!canChange) {
|
|
@@ -17199,7 +17264,7 @@ import dayjs4 from "dayjs";
|
|
|
17199
17264
|
import { ArrowLeft as ArrowLeft15, Info as Info4, Loader as Loader16 } from "lucide-react";
|
|
17200
17265
|
import { jsx as jsx80, jsxs as jsxs74 } from "react/jsx-runtime";
|
|
17201
17266
|
function NicknameMenu() {
|
|
17202
|
-
const { isInitialUser } = usePageParams();
|
|
17267
|
+
const { isInitialUser } = usePageParams().current;
|
|
17203
17268
|
const { t } = useT();
|
|
17204
17269
|
const address = useSession((st) => st.address);
|
|
17205
17270
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
@@ -17376,6 +17441,7 @@ function useWatchTokens(options) {
|
|
|
17376
17441
|
const {
|
|
17377
17442
|
data: assets,
|
|
17378
17443
|
isLoading,
|
|
17444
|
+
isFetching,
|
|
17379
17445
|
error,
|
|
17380
17446
|
refetch
|
|
17381
17447
|
} = useQuery13({
|
|
@@ -17446,6 +17512,7 @@ function useWatchTokens(options) {
|
|
|
17446
17512
|
return {
|
|
17447
17513
|
assets: assets || [],
|
|
17448
17514
|
isLoading,
|
|
17515
|
+
isFetching,
|
|
17449
17516
|
error: error || null,
|
|
17450
17517
|
refetch
|
|
17451
17518
|
};
|
|
@@ -17462,7 +17529,7 @@ var init_useWatchTokens = __esm({
|
|
|
17462
17529
|
// src/internal/hooks/useBlockscoutAssets.ts
|
|
17463
17530
|
import { createBlockscoutClient } from "@embarkai/core/clients";
|
|
17464
17531
|
import { useQuery as useQuery14, useQueryClient as useQueryClient19 } from "@tanstack/react-query";
|
|
17465
|
-
import { useCallback as
|
|
17532
|
+
import { useCallback as useCallback23, useMemo as useMemo10, useRef as useRef17 } from "react";
|
|
17466
17533
|
import { formatEther, formatUnits as formatUnits3 } from "viem";
|
|
17467
17534
|
function resolveIpfsUri(uri) {
|
|
17468
17535
|
if (!uri) return "";
|
|
@@ -17599,15 +17666,17 @@ function useBlockscoutAssets(options) {
|
|
|
17599
17666
|
() => blockscoutApiUrl ? createBlockscoutClient({ baseUrl: blockscoutApiUrl }) : null,
|
|
17600
17667
|
[blockscoutApiUrl]
|
|
17601
17668
|
);
|
|
17602
|
-
const lastRefreshRef =
|
|
17669
|
+
const lastRefreshRef = useRef17(0);
|
|
17603
17670
|
const {
|
|
17604
17671
|
assets: watchTokenAssets,
|
|
17605
|
-
isLoading: watchTokensLoading
|
|
17672
|
+
isLoading: watchTokensLoading,
|
|
17673
|
+
isFetching: watchTokensFetching
|
|
17606
17674
|
// refetch: refetchWatchTokens
|
|
17607
17675
|
} = useWatchTokens({ address, chainId: resolvedChainId, enabled });
|
|
17608
17676
|
const {
|
|
17609
17677
|
data: nativeBalanceData,
|
|
17610
|
-
isLoading: nativeLoading
|
|
17678
|
+
isLoading: nativeLoading,
|
|
17679
|
+
isFetching: nativeFetching
|
|
17611
17680
|
// refetch: refetchNative
|
|
17612
17681
|
} = useQuery14({
|
|
17613
17682
|
queryKey: [NATIVE_BALANCE_QUERY_KEY, resolvedChainId, address],
|
|
@@ -17631,6 +17700,7 @@ function useBlockscoutAssets(options) {
|
|
|
17631
17700
|
const {
|
|
17632
17701
|
data: tokenBalances,
|
|
17633
17702
|
isLoading: tokensLoading,
|
|
17703
|
+
isFetching: tokensFetching,
|
|
17634
17704
|
error: tokensError,
|
|
17635
17705
|
// refetch: refetchTokens,
|
|
17636
17706
|
dataUpdatedAt
|
|
@@ -17656,7 +17726,8 @@ function useBlockscoutAssets(options) {
|
|
|
17656
17726
|
});
|
|
17657
17727
|
const {
|
|
17658
17728
|
data: nftItems,
|
|
17659
|
-
isLoading: nftsLoading
|
|
17729
|
+
isLoading: nftsLoading,
|
|
17730
|
+
isFetching: nftsFetching
|
|
17660
17731
|
// refetch: refetchNfts
|
|
17661
17732
|
} = useQuery14({
|
|
17662
17733
|
queryKey: [BLOCKSCOUT_QUERY_KEY, "nfts", resolvedChainId, address, blockscoutApiUrl],
|
|
@@ -17770,7 +17841,7 @@ function useBlockscoutAssets(options) {
|
|
|
17770
17841
|
if (!tokensError) return null;
|
|
17771
17842
|
return createError(tokensError);
|
|
17772
17843
|
}, [tokensError]);
|
|
17773
|
-
const refreshBalances =
|
|
17844
|
+
const refreshBalances = useCallback23(async () => {
|
|
17774
17845
|
const now = Date.now();
|
|
17775
17846
|
if (now - lastRefreshRef.current < BLOCKSCOUT_REFRESH_DEBOUNCE) {
|
|
17776
17847
|
return;
|
|
@@ -17787,7 +17858,7 @@ function useBlockscoutAssets(options) {
|
|
|
17787
17858
|
qc.invalidateQueries({ queryKey: [WATCH_TOKENS_QUERY_KEY] })
|
|
17788
17859
|
]);
|
|
17789
17860
|
}, [qc]);
|
|
17790
|
-
const getTokenBalance =
|
|
17861
|
+
const getTokenBalance = useCallback23(
|
|
17791
17862
|
(tokenAddress) => {
|
|
17792
17863
|
return assets.find((a) => a.address?.toLowerCase() === tokenAddress.toLowerCase()) || null;
|
|
17793
17864
|
},
|
|
@@ -17797,6 +17868,7 @@ function useBlockscoutAssets(options) {
|
|
|
17797
17868
|
nativeBalance,
|
|
17798
17869
|
assets,
|
|
17799
17870
|
isLoading: nativeLoading || tokensLoading || nftsLoading || watchTokensLoading,
|
|
17871
|
+
isFetching: nativeFetching || tokensFetching || nftsFetching || watchTokensFetching,
|
|
17800
17872
|
isInitialLoading: nativeLoading && !nativeBalanceData,
|
|
17801
17873
|
error,
|
|
17802
17874
|
isBlockscoutAvailable: !!blockscoutClient && !tokensError,
|
|
@@ -18094,31 +18166,32 @@ var init_PortfolioItem = __esm({
|
|
|
18094
18166
|
|
|
18095
18167
|
// src/internal/components/PortfolioMenu/PortfolioMenu.tsx
|
|
18096
18168
|
import { useQueryClient as useQueryClient20 } from "@tanstack/react-query";
|
|
18097
|
-
import {
|
|
18098
|
-
import { useCallback as
|
|
18169
|
+
import { ArrowLeft as ArrowLeft16, Gem, Loader as Loader17, RefreshCw as RefreshCw2 } from "lucide-react";
|
|
18170
|
+
import { useCallback as useCallback24 } from "react";
|
|
18099
18171
|
import { jsx as jsx83, jsxs as jsxs77 } from "react/jsx-runtime";
|
|
18100
18172
|
function PortfolioMenu() {
|
|
18101
18173
|
const { assets: projectAssets = [] } = useProviderConfig().config.current?.projectAssets || {};
|
|
18102
18174
|
const { t } = useT();
|
|
18103
18175
|
const qc = useQueryClient20();
|
|
18104
18176
|
const address = useSession((st) => st.address);
|
|
18105
|
-
const
|
|
18177
|
+
const chainConfig = useSession((st) => st.chainConfig);
|
|
18106
18178
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
18107
18179
|
const {
|
|
18108
18180
|
assets: blockscoutAssets,
|
|
18109
18181
|
refreshBalances: refreshBlockscoutBalances,
|
|
18110
18182
|
isLoading: isBlockscoutLoading,
|
|
18183
|
+
isFetching: isBlockscoutFetching,
|
|
18111
18184
|
error: blockscoutError,
|
|
18112
18185
|
isBlockscoutAvailable
|
|
18113
18186
|
} = useBlockscoutAssets({
|
|
18114
18187
|
address,
|
|
18115
18188
|
enabled: !!address
|
|
18116
18189
|
});
|
|
18117
|
-
const
|
|
18118
|
-
const refreshAllAssetsBalances =
|
|
18119
|
-
Promise.all(
|
|
18190
|
+
const shownProjectAssets = projectAssets.filter((asset) => !asset.hideInPortfolio);
|
|
18191
|
+
const refreshAllAssetsBalances = useCallback24(() => {
|
|
18192
|
+
Promise.all(shownProjectAssets.map((asset) => qc.invalidateQueries({ queryKey: asset.balanceQueryKey })));
|
|
18120
18193
|
refreshBlockscoutBalances();
|
|
18121
|
-
}, [qc,
|
|
18194
|
+
}, [qc, shownProjectAssets, refreshBlockscoutBalances]);
|
|
18122
18195
|
return /* @__PURE__ */ jsx83(
|
|
18123
18196
|
"div",
|
|
18124
18197
|
{
|
|
@@ -18129,7 +18202,16 @@ function PortfolioMenu() {
|
|
|
18129
18202
|
className: "list-scrollbar-y w-full p-[var(--ui-kit-pd)]",
|
|
18130
18203
|
children: /* @__PURE__ */ jsxs77(Expandable, { isExpanded: true, contentClassName: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: [
|
|
18131
18204
|
/* @__PURE__ */ jsxs77("div", { className: "flex items-center gap-[var(--ui-kit-gap)]", children: [
|
|
18132
|
-
/* @__PURE__ */ jsx83(
|
|
18205
|
+
/* @__PURE__ */ jsx83(
|
|
18206
|
+
Button,
|
|
18207
|
+
{
|
|
18208
|
+
variant: "ghost",
|
|
18209
|
+
size: "icon",
|
|
18210
|
+
title: "Back",
|
|
18211
|
+
onClick: () => useLayoutDataStore.getState().setPage("main-menu" /* MAIN_MENU */),
|
|
18212
|
+
children: /* @__PURE__ */ jsx83(ArrowLeft16, { className: "h-4 w-4" })
|
|
18213
|
+
}
|
|
18214
|
+
),
|
|
18133
18215
|
/* @__PURE__ */ jsx83("span", { className: "text-xl font-semibold", children: t("passport:portfolioMenu.title") }),
|
|
18134
18216
|
/* @__PURE__ */ jsx83(
|
|
18135
18217
|
Button,
|
|
@@ -18138,8 +18220,8 @@ function PortfolioMenu() {
|
|
|
18138
18220
|
variant: "ghost",
|
|
18139
18221
|
size: "icon",
|
|
18140
18222
|
onClick: refreshAllAssetsBalances,
|
|
18141
|
-
disabled: isBlockscoutLoading,
|
|
18142
|
-
children: isBlockscoutLoading ? /* @__PURE__ */ jsx83(Loader17, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsx83(RefreshCw2, { className: "h-4 w-4" })
|
|
18223
|
+
disabled: isBlockscoutLoading || isBlockscoutFetching,
|
|
18224
|
+
children: isBlockscoutLoading || isBlockscoutFetching ? /* @__PURE__ */ jsx83(Loader17, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsx83(RefreshCw2, { className: "h-4 w-4" })
|
|
18143
18225
|
}
|
|
18144
18226
|
)
|
|
18145
18227
|
] }),
|
|
@@ -18148,7 +18230,7 @@ function PortfolioMenu() {
|
|
|
18148
18230
|
/* @__PURE__ */ jsx83(Gem, { className: "w-8 h-8" }),
|
|
18149
18231
|
/* @__PURE__ */ jsx83("span", { className: "block", children: t("passport:portfolioMenu.noAssets") })
|
|
18150
18232
|
] }),
|
|
18151
|
-
!isBlockscoutLoading &&
|
|
18233
|
+
!isBlockscoutLoading && shownProjectAssets?.map((asset, index) => /* @__PURE__ */ jsx83(PortfolioItem, { isProjectAsset: true, address, asset }, `project-${asset.symbol}-${index}`)),
|
|
18152
18234
|
!isBlockscoutLoading && blockscoutAssets?.length > 0 && blockscoutAssets.map((asset, index) => /* @__PURE__ */ jsx83(
|
|
18153
18235
|
PortfolioItem,
|
|
18154
18236
|
{
|
|
@@ -18157,10 +18239,12 @@ function PortfolioMenu() {
|
|
|
18157
18239
|
},
|
|
18158
18240
|
`${asset.type}-${asset.address || "native"}-${asset.tokenId || index}`
|
|
18159
18241
|
)),
|
|
18160
|
-
|
|
18161
|
-
|
|
18162
|
-
|
|
18163
|
-
|
|
18242
|
+
!isBlockscoutAvailable && /* @__PURE__ */ jsx83(Highlight, {
|
|
18243
|
+
type: "warning",
|
|
18244
|
+
//@ts-expect-error i18n typings
|
|
18245
|
+
children: t("passport:portfolioMenu.noBlockscout", { chain: chainConfig?.name?.toUpperCase() || "UNKNOWN" })
|
|
18246
|
+
}),
|
|
18247
|
+
blockscoutError && /* @__PURE__ */ jsx83(Highlight, { type: "error", children: blockscoutError?.message })
|
|
18164
18248
|
] })
|
|
18165
18249
|
}
|
|
18166
18250
|
);
|
|
@@ -18270,7 +18354,7 @@ var init_nickname_fingerprint = __esm({
|
|
|
18270
18354
|
// src/internal/components/ReceiveMenu/ReceiveMenu.tsx
|
|
18271
18355
|
import { ArrowLeft as ArrowLeft17, CheckCircle2 as CheckCircle23, Copy as Copy2, Info as Info5, Loader as Loader18, Shield } from "lucide-react";
|
|
18272
18356
|
import QRCode from "qrcode";
|
|
18273
|
-
import { useCallback as
|
|
18357
|
+
import { useCallback as useCallback25, useEffect as useEffect33, useMemo as useMemo11, useState as useState21 } from "react";
|
|
18274
18358
|
import { Fragment as Fragment31, jsx as jsx84, jsxs as jsxs78 } from "react/jsx-runtime";
|
|
18275
18359
|
function ReceiveMenu() {
|
|
18276
18360
|
const session = useSession((st) => st.session);
|
|
@@ -18292,7 +18376,7 @@ function ReceiveMenu() {
|
|
|
18292
18376
|
return null;
|
|
18293
18377
|
}
|
|
18294
18378
|
}, [session?.ownerAddress]);
|
|
18295
|
-
|
|
18379
|
+
useEffect33(() => {
|
|
18296
18380
|
if (open && address) {
|
|
18297
18381
|
QRCode.toDataURL(address, {
|
|
18298
18382
|
width: 200,
|
|
@@ -18305,7 +18389,7 @@ function ReceiveMenu() {
|
|
|
18305
18389
|
});
|
|
18306
18390
|
}
|
|
18307
18391
|
}, [open, address]);
|
|
18308
|
-
const handleCopy =
|
|
18392
|
+
const handleCopy = useCallback25(async () => {
|
|
18309
18393
|
if (!address) return;
|
|
18310
18394
|
try {
|
|
18311
18395
|
await navigator.clipboard.writeText(address);
|
|
@@ -18315,7 +18399,7 @@ function ReceiveMenu() {
|
|
|
18315
18399
|
console.error("Failed to copy address:", error);
|
|
18316
18400
|
}
|
|
18317
18401
|
}, [address]);
|
|
18318
|
-
const handleCopyFingerprint =
|
|
18402
|
+
const handleCopyFingerprint = useCallback25(async () => {
|
|
18319
18403
|
if (!fingerprint) return;
|
|
18320
18404
|
try {
|
|
18321
18405
|
await navigator.clipboard.writeText(fingerprint);
|
|
@@ -18395,6 +18479,24 @@ var init_ReceiveMenu2 = __esm({
|
|
|
18395
18479
|
}
|
|
18396
18480
|
});
|
|
18397
18481
|
|
|
18482
|
+
// src/internal/components/SecurityMenu/useSecurityStore.ts
|
|
18483
|
+
import { debounce as debounce6 } from "lodash-es";
|
|
18484
|
+
import { create as create10 } from "zustand";
|
|
18485
|
+
var useSecurityStore;
|
|
18486
|
+
var init_useSecurityStore = __esm({
|
|
18487
|
+
"src/internal/components/SecurityMenu/useSecurityStore.ts"() {
|
|
18488
|
+
useSecurityStore = create10((set) => ({
|
|
18489
|
+
renderKey: "security-store",
|
|
18490
|
+
setRenderKey: debounce6((renderKey) => {
|
|
18491
|
+
console.log("[SecurityMenu] Setting render key:", renderKey);
|
|
18492
|
+
set({ renderKey });
|
|
18493
|
+
}, 200),
|
|
18494
|
+
appToUntrust: null,
|
|
18495
|
+
untrustApp: (app) => set({ appToUntrust: app })
|
|
18496
|
+
}));
|
|
18497
|
+
}
|
|
18498
|
+
});
|
|
18499
|
+
|
|
18398
18500
|
// src/internal/components/SecurityMenu/constants.ts
|
|
18399
18501
|
var KEYSHARE_RECOVERY_STATS_QUERY, CONNECTED_TRUSTED_APPS_QUERY;
|
|
18400
18502
|
var init_constants5 = __esm({
|
|
@@ -18404,7 +18506,7 @@ var init_constants5 = __esm({
|
|
|
18404
18506
|
}
|
|
18405
18507
|
});
|
|
18406
18508
|
|
|
18407
|
-
// src/internal/components/SecurityMenu/
|
|
18509
|
+
// src/internal/components/SecurityMenu/ConnectedApps/useConnectedApps.ts
|
|
18408
18510
|
import { useQuery as useQuery16 } from "@tanstack/react-query";
|
|
18409
18511
|
function useConnectedApps() {
|
|
18410
18512
|
const session = useSession((st) => st.session);
|
|
@@ -18422,45 +18524,31 @@ function useConnectedApps() {
|
|
|
18422
18524
|
}
|
|
18423
18525
|
});
|
|
18424
18526
|
}
|
|
18425
|
-
|
|
18426
|
-
|
|
18427
|
-
const userId = session?.mpcUserId || null;
|
|
18428
|
-
return useQuery16({
|
|
18429
|
-
enabled: !!userId,
|
|
18430
|
-
queryKey: [KEYSHARE_RECOVERY_STATS_QUERY, userId],
|
|
18431
|
-
queryFn: async () => {
|
|
18432
|
-
const iframeManager = getIframeManager();
|
|
18433
|
-
if (!iframeManager) {
|
|
18434
|
-
throw new Error("Iframe manager not available");
|
|
18435
|
-
}
|
|
18436
|
-
const keyshareInfo = await getKeyshareInfo(userId);
|
|
18437
|
-
const shareRecoveryStats = await getShareRecoveryStats();
|
|
18438
|
-
return {
|
|
18439
|
-
keyshareInfo,
|
|
18440
|
-
shareRecoveryStats
|
|
18441
|
-
};
|
|
18442
|
-
}
|
|
18443
|
-
});
|
|
18444
|
-
}
|
|
18445
|
-
var init_hooks2 = __esm({
|
|
18446
|
-
"src/internal/components/SecurityMenu/hooks.ts"() {
|
|
18527
|
+
var init_useConnectedApps = __esm({
|
|
18528
|
+
"src/internal/components/SecurityMenu/ConnectedApps/useConnectedApps.ts"() {
|
|
18447
18529
|
init_SessionContext();
|
|
18448
|
-
init_keyshare();
|
|
18449
18530
|
init_httpClient();
|
|
18450
|
-
init_iframe_manager();
|
|
18451
|
-
init_vaultClient();
|
|
18452
18531
|
init_constants5();
|
|
18453
18532
|
}
|
|
18454
18533
|
});
|
|
18455
18534
|
|
|
18456
|
-
// src/internal/components/SecurityMenu/ConnectedApps.tsx
|
|
18535
|
+
// src/internal/components/SecurityMenu/ConnectedApps/ConnectedApps.tsx
|
|
18457
18536
|
import dayjs5 from "dayjs";
|
|
18458
|
-
import { AppWindowMac, ExternalLinkIcon as ExternalLinkIcon2,
|
|
18537
|
+
import { AppWindowMac, ExternalLinkIcon as ExternalLinkIcon2, InfoIcon as InfoIcon4, LoaderIcon as LoaderIcon9, ShieldBanIcon, ShieldCheckIcon } from "lucide-react";
|
|
18538
|
+
import { useEffect as useEffect34 } from "react";
|
|
18459
18539
|
import { Fragment as Fragment32, jsx as jsx85, jsxs as jsxs79 } from "react/jsx-runtime";
|
|
18460
18540
|
function Application(props) {
|
|
18461
|
-
const {
|
|
18541
|
+
const {
|
|
18542
|
+
projectId,
|
|
18543
|
+
appUrl = null,
|
|
18544
|
+
//
|
|
18545
|
+
logo,
|
|
18546
|
+
name,
|
|
18547
|
+
trustedAuthorizedApp,
|
|
18548
|
+
firstConnectedAt
|
|
18549
|
+
// untrustApp
|
|
18550
|
+
} = props;
|
|
18462
18551
|
const { t } = useT();
|
|
18463
|
-
const projectUrl = appUrl || null;
|
|
18464
18552
|
return /* @__PURE__ */ jsxs79(
|
|
18465
18553
|
"div",
|
|
18466
18554
|
{
|
|
@@ -18469,14 +18557,14 @@ function Application(props) {
|
|
|
18469
18557
|
"select-none text-[10px] leading-tight",
|
|
18470
18558
|
"p-2 rounded-[var(--ui-kit-el-bdrs)] bg-[var(--ui-kit-secondary)]",
|
|
18471
18559
|
{
|
|
18472
|
-
"cursor-default": !
|
|
18473
|
-
"cursor-pointer transition-colors duration-200": !!
|
|
18474
|
-
"hover:bg-[var(--ui-kit-secondary-h)] active:bg-[var(--ui-kit-secondary-a)]": !!
|
|
18560
|
+
"cursor-default": !appUrl,
|
|
18561
|
+
"cursor-pointer transition-colors duration-200": !!appUrl,
|
|
18562
|
+
"hover:bg-[var(--ui-kit-secondary-h)] active:bg-[var(--ui-kit-secondary-a)]": !!appUrl
|
|
18475
18563
|
}
|
|
18476
18564
|
),
|
|
18477
18565
|
onClick: () => {
|
|
18478
|
-
if (!
|
|
18479
|
-
window.open(
|
|
18566
|
+
if (!appUrl) return;
|
|
18567
|
+
window.open(appUrl, "_blank", "noopener,noreferrer");
|
|
18480
18568
|
},
|
|
18481
18569
|
children: [
|
|
18482
18570
|
/* @__PURE__ */ jsxs79(
|
|
@@ -18506,9 +18594,9 @@ function Application(props) {
|
|
|
18506
18594
|
/* @__PURE__ */ jsxs79("div", { className: "flex-1 min-w-0", children: [
|
|
18507
18595
|
/* @__PURE__ */ jsxs79("span", { className: "flex flex-col", children: [
|
|
18508
18596
|
/* @__PURE__ */ jsx85("span", { className: "text-sm font-semibold truncate", children: name }),
|
|
18509
|
-
|
|
18597
|
+
appUrl && /* @__PURE__ */ jsxs79("span", { className: "flex items-center gap-[var(--ui-kit-gap)]", children: [
|
|
18510
18598
|
/* @__PURE__ */ jsx85(ExternalLinkIcon2, { className: "w-3 h-3 flex-none", strokeWidth: 1 }),
|
|
18511
|
-
/* @__PURE__ */ jsx85("span", { className: "flex-1 truncate", children: new URL(
|
|
18599
|
+
/* @__PURE__ */ jsx85("span", { className: "flex-1 truncate", children: new URL(appUrl).hostname })
|
|
18512
18600
|
] })
|
|
18513
18601
|
] }),
|
|
18514
18602
|
/* @__PURE__ */ jsx85("div", { className: "text-[var(--ui-kit-fg-muted)] truncate", children: t(
|
|
@@ -18529,10 +18617,10 @@ function Application(props) {
|
|
|
18529
18617
|
),
|
|
18530
18618
|
onClick: (e) => {
|
|
18531
18619
|
e.stopPropagation();
|
|
18532
|
-
untrustApp({
|
|
18620
|
+
useSecurityStore.getState().untrustApp({
|
|
18533
18621
|
projectId,
|
|
18534
|
-
origin:
|
|
18535
|
-
hostname:
|
|
18622
|
+
origin: appUrl || void 0,
|
|
18623
|
+
hostname: appUrl ? new URL(appUrl).hostname : void 0,
|
|
18536
18624
|
appName: name,
|
|
18537
18625
|
appLogo: logo
|
|
18538
18626
|
});
|
|
@@ -18544,48 +18632,152 @@ function Application(props) {
|
|
|
18544
18632
|
}
|
|
18545
18633
|
);
|
|
18546
18634
|
}
|
|
18547
|
-
function ConnectedApps(
|
|
18548
|
-
const { isLoading: isParentLoading, untrustApp } = props;
|
|
18635
|
+
function ConnectedApps() {
|
|
18549
18636
|
const { t } = useT();
|
|
18550
18637
|
const { data: connectedApps = [], isLoading: isConnectedAppsLoading } = useConnectedApps();
|
|
18551
|
-
|
|
18552
|
-
|
|
18553
|
-
|
|
18638
|
+
useEffect34(() => {
|
|
18639
|
+
if (!connectedApps.length || isConnectedAppsLoading) return;
|
|
18640
|
+
useSecurityStore.getState().setRenderKey(`connected-apps-loaded-${Date.now()}`);
|
|
18641
|
+
}, [connectedApps, isConnectedAppsLoading]);
|
|
18642
|
+
if (!isConnectedAppsLoading && connectedApps.length === 0)
|
|
18554
18643
|
return /* @__PURE__ */ jsxs79(Highlight, { type: "info", className: "flex gap-[var(--ui-kit-gap)] ", children: [
|
|
18555
|
-
/* @__PURE__ */ jsx85(
|
|
18644
|
+
/* @__PURE__ */ jsx85(InfoIcon4, { className: "w-4 h-4" }),
|
|
18556
18645
|
/* @__PURE__ */ jsx85("span", { children: t("passport:securityMenu.connectedApps.noConnectedApps") })
|
|
18557
18646
|
] });
|
|
18558
18647
|
return /* @__PURE__ */ jsxs79(Fragment32, { children: [
|
|
18559
|
-
/* @__PURE__ */
|
|
18560
|
-
|
|
18561
|
-
|
|
18562
|
-
|
|
18563
|
-
|
|
18564
|
-
untrustApp
|
|
18565
|
-
},
|
|
18566
|
-
index
|
|
18567
|
-
)) })
|
|
18648
|
+
/* @__PURE__ */ jsxs79("div", { className: "flex items-center justify-between gap-[var(--ui-kit-gap)]", children: [
|
|
18649
|
+
/* @__PURE__ */ jsx85("span", { className: "leading-4 text-xs", children: t("passport:securityMenu.connectedApps.connectedApps") }),
|
|
18650
|
+
isConnectedAppsLoading && /* @__PURE__ */ jsx85(LoaderIcon9, { className: "h-4 w-4 animate-spin" })
|
|
18651
|
+
] }),
|
|
18652
|
+
/* @__PURE__ */ jsx85("div", { className: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: connectedApps.map((app, index) => /* @__PURE__ */ jsx85(Application, { ...app }, index)) })
|
|
18568
18653
|
] });
|
|
18569
18654
|
}
|
|
18570
18655
|
var init_ConnectedApps = __esm({
|
|
18571
|
-
"src/internal/components/SecurityMenu/ConnectedApps.tsx"() {
|
|
18656
|
+
"src/internal/components/SecurityMenu/ConnectedApps/ConnectedApps.tsx"() {
|
|
18572
18657
|
init_utils2();
|
|
18573
18658
|
init_i18n();
|
|
18574
18659
|
init_button();
|
|
18575
18660
|
init_highlight();
|
|
18576
|
-
|
|
18661
|
+
init_useSecurityStore();
|
|
18662
|
+
init_useConnectedApps();
|
|
18577
18663
|
}
|
|
18578
18664
|
});
|
|
18579
18665
|
|
|
18580
|
-
// src/internal/components/SecurityMenu/
|
|
18581
|
-
import {
|
|
18666
|
+
// src/internal/components/SecurityMenu/ConnectedApps/UntrustApplication.tsx
|
|
18667
|
+
import { useMutation as useMutation18, useQueryClient as useQueryClient21 } from "@tanstack/react-query";
|
|
18668
|
+
import { AppWindowMac as AppWindowMac2, Loader as Loader19 } from "lucide-react";
|
|
18582
18669
|
import { jsx as jsx86, jsxs as jsxs80 } from "react/jsx-runtime";
|
|
18670
|
+
function UntrustApplication() {
|
|
18671
|
+
const { t } = useT();
|
|
18672
|
+
const qc = useQueryClient21();
|
|
18673
|
+
const userId = useSession((st) => st?.session?.mpcUserId);
|
|
18674
|
+
const appToUntrust = useSecurityStore((st) => st.appToUntrust);
|
|
18675
|
+
const { mutate: handleUntrustApp, isPending: isUntrustingApp } = useMutation18({
|
|
18676
|
+
mutationFn: async () => {
|
|
18677
|
+
if (!userId || !appToUntrust) return;
|
|
18678
|
+
const iframeManager = getIframeManager();
|
|
18679
|
+
if (!iframeManager) {
|
|
18680
|
+
throw new Error("Iframe manager not available");
|
|
18681
|
+
}
|
|
18682
|
+
return await iframeManager.removeTrustedApp(userId, appToUntrust.projectId, appToUntrust.origin);
|
|
18683
|
+
},
|
|
18684
|
+
onSuccess: (success) => {
|
|
18685
|
+
if (!success) {
|
|
18686
|
+
console.error("[SecurityMenu] Failed to remove trusted app from iframe");
|
|
18687
|
+
return;
|
|
18688
|
+
}
|
|
18689
|
+
qc.invalidateQueries({ queryKey: [CONNECTED_TRUSTED_APPS_QUERY, userId] });
|
|
18690
|
+
useSecurityStore.getState().untrustApp(null);
|
|
18691
|
+
},
|
|
18692
|
+
onError: (error) => {
|
|
18693
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
18694
|
+
console.error("[SecurityMenu] Error removing trusted app:", errorMessage);
|
|
18695
|
+
}
|
|
18696
|
+
});
|
|
18697
|
+
return /* @__PURE__ */ jsxs80("div", { className: "flex flex-col gap-[var(--ui-kit-gap)]", children: [
|
|
18698
|
+
/* @__PURE__ */ jsxs80(Highlight, { className: "flex flex-col gap-[var(--ui-kit-gap)]", type: "warning", children: [
|
|
18699
|
+
/* @__PURE__ */ jsxs80("span", { className: "text-sm leading-5 font-bold", children: [
|
|
18700
|
+
t("passport:securityMenu.connectedApps.untrustApp"),
|
|
18701
|
+
"?"
|
|
18702
|
+
] }),
|
|
18703
|
+
/* @__PURE__ */ jsxs80("div", { className: "w-full flex items-center justify-center gap-[var(--ui-kit-gap)]", children: [
|
|
18704
|
+
appToUntrust.appLogo ? /* @__PURE__ */ jsx86("div", { className: "w-12 h-12 rounded-[var(--ui-kit-el-bdrs)] bg-[var(--ui-kit-bg)] flex-shrink-0 p-1", children: /* @__PURE__ */ jsx86("img", { src: appToUntrust.appLogo, alt: appToUntrust.appName, className: "w-full h-full object-contain" }) }) : /* @__PURE__ */ jsx86("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__ */ jsx86(AppWindowMac2, { className: "w-6 h-6" }) }),
|
|
18705
|
+
/* @__PURE__ */ jsxs80("div", { className: "flex-1 text-left", children: [
|
|
18706
|
+
/* @__PURE__ */ jsx86("div", { className: "font-medium", children: appToUntrust.appName }),
|
|
18707
|
+
appToUntrust.hostname && /* @__PURE__ */ jsxs80("div", { className: "text-[10px]", children: [
|
|
18708
|
+
"(",
|
|
18709
|
+
appToUntrust.hostname,
|
|
18710
|
+
")"
|
|
18711
|
+
] })
|
|
18712
|
+
] })
|
|
18713
|
+
] })
|
|
18714
|
+
] }),
|
|
18715
|
+
/* @__PURE__ */ jsxs80("div", { className: "text-[10px] text-[var(--ui-kit-fg-muted)] text-left space-y-1", children: [
|
|
18716
|
+
/* @__PURE__ */ jsxs80("p", { children: [
|
|
18717
|
+
t("passport:securityMenu.connectedApps.removalNoteTitle"),
|
|
18718
|
+
":"
|
|
18719
|
+
] }),
|
|
18720
|
+
/* @__PURE__ */ jsxs80("ul", { className: "list-disc list-inside ml-2 space-y-0.5", children: [
|
|
18721
|
+
/* @__PURE__ */ jsx86("li", { children: t("passport:securityMenu.connectedApps.removalNoteMsg1") }),
|
|
18722
|
+
/* @__PURE__ */ jsx86("li", { children: t("passport:securityMenu.connectedApps.removalNoteMsg2") })
|
|
18723
|
+
] })
|
|
18724
|
+
] }),
|
|
18725
|
+
/* @__PURE__ */ jsxs80("div", { className: "w-full flex gap-[var(--ui-kit-gap)]", children: [
|
|
18726
|
+
/* @__PURE__ */ jsx86(
|
|
18727
|
+
Button,
|
|
18728
|
+
{
|
|
18729
|
+
variant: "outline",
|
|
18730
|
+
size: "large",
|
|
18731
|
+
className: "flex-1",
|
|
18732
|
+
onClick: () => useSecurityStore.getState().untrustApp(null),
|
|
18733
|
+
disabled: isUntrustingApp,
|
|
18734
|
+
children: t("passport:common.cancel")
|
|
18735
|
+
}
|
|
18736
|
+
),
|
|
18737
|
+
/* @__PURE__ */ jsx86(
|
|
18738
|
+
Button,
|
|
18739
|
+
{
|
|
18740
|
+
variant: "default",
|
|
18741
|
+
size: "large",
|
|
18742
|
+
className: "flex-1",
|
|
18743
|
+
onClick: () => handleUntrustApp(),
|
|
18744
|
+
disabled: isUntrustingApp,
|
|
18745
|
+
children: isUntrustingApp ? /* @__PURE__ */ jsx86(Loader19, { className: "h-4 w-4 animate-spin" }) : t("passport:common.delete")
|
|
18746
|
+
}
|
|
18747
|
+
)
|
|
18748
|
+
] })
|
|
18749
|
+
] });
|
|
18750
|
+
}
|
|
18751
|
+
var init_UntrustApplication = __esm({
|
|
18752
|
+
"src/internal/components/SecurityMenu/ConnectedApps/UntrustApplication.tsx"() {
|
|
18753
|
+
init_SessionContext();
|
|
18754
|
+
init_i18n();
|
|
18755
|
+
init_iframe_manager();
|
|
18756
|
+
init_button();
|
|
18757
|
+
init_highlight();
|
|
18758
|
+
init_constants5();
|
|
18759
|
+
init_useSecurityStore();
|
|
18760
|
+
}
|
|
18761
|
+
});
|
|
18762
|
+
|
|
18763
|
+
// src/internal/components/SecurityMenu/ConnectedApps/index.ts
|
|
18764
|
+
var init_ConnectedApps2 = __esm({
|
|
18765
|
+
"src/internal/components/SecurityMenu/ConnectedApps/index.ts"() {
|
|
18766
|
+
init_ConnectedApps();
|
|
18767
|
+
init_UntrustApplication();
|
|
18768
|
+
init_useConnectedApps();
|
|
18769
|
+
}
|
|
18770
|
+
});
|
|
18771
|
+
|
|
18772
|
+
// src/internal/components/SecurityMenu/Keyshare/KeyshareStatus.tsx
|
|
18773
|
+
import { Loader as Loader20 } from "lucide-react";
|
|
18774
|
+
import { jsx as jsx87, jsxs as jsxs81 } from "react/jsx-runtime";
|
|
18583
18775
|
function KeyshareStatus(props) {
|
|
18584
18776
|
const { isLoading, content, icon: Icon2, children } = props;
|
|
18585
|
-
if (isLoading) return /* @__PURE__ */
|
|
18586
|
-
return /* @__PURE__ */
|
|
18777
|
+
if (isLoading) return /* @__PURE__ */ jsx87(Loader20, { className: "w-4 h-4 animate-spin" });
|
|
18778
|
+
return /* @__PURE__ */ jsxs81("div", { className: "group relative w-full h-full", children: [
|
|
18587
18779
|
children,
|
|
18588
|
-
/* @__PURE__ */
|
|
18780
|
+
/* @__PURE__ */ jsx87(
|
|
18589
18781
|
"div",
|
|
18590
18782
|
{
|
|
18591
18783
|
className: cn(
|
|
@@ -18593,10 +18785,10 @@ function KeyshareStatus(props) {
|
|
|
18593
18785
|
"rounded-full bg-[var(--ui-kit-bg)]"
|
|
18594
18786
|
// 'border border-[var(--ui-kit-bd)]'
|
|
18595
18787
|
),
|
|
18596
|
-
children: /* @__PURE__ */
|
|
18788
|
+
children: /* @__PURE__ */ jsx87(Icon2, { className: "w-4 h-4" })
|
|
18597
18789
|
}
|
|
18598
18790
|
),
|
|
18599
|
-
/* @__PURE__ */
|
|
18791
|
+
/* @__PURE__ */ jsx87(
|
|
18600
18792
|
"div",
|
|
18601
18793
|
{
|
|
18602
18794
|
style: { transform: "translateY(calc(var(--ui-kit-gap) * -4))" },
|
|
@@ -18621,7 +18813,7 @@ var init_KeyshareStatus = __esm({
|
|
|
18621
18813
|
// src/internal/components/SecurityMenu/Keyshare/LastBackup.tsx
|
|
18622
18814
|
import dayjs6 from "dayjs";
|
|
18623
18815
|
import { DatabaseBackup } from "lucide-react";
|
|
18624
|
-
import { Fragment as Fragment33, jsx as
|
|
18816
|
+
import { Fragment as Fragment33, jsx as jsx88, jsxs as jsxs82 } from "react/jsx-runtime";
|
|
18625
18817
|
function parseOS(ua) {
|
|
18626
18818
|
if (!ua) return null;
|
|
18627
18819
|
if (ua.includes("Mac OS X")) return "Mac OS";
|
|
@@ -18647,18 +18839,18 @@ function LastBackup(props) {
|
|
|
18647
18839
|
} = createdRecoveryStats || {};
|
|
18648
18840
|
const hasBackupData = backup?.server?.enabled && backup.server.lastBackup || !backup.server.lastBackup && recoveryCreatedAt || backup.cloud.enabled && backup.cloud?.lastBackup || backup.local.enabled && backup.local.lastBackup;
|
|
18649
18841
|
if (!hasBackupData || !createdRecoveryStats) return null;
|
|
18650
|
-
return /* @__PURE__ */
|
|
18651
|
-
/* @__PURE__ */
|
|
18652
|
-
/* @__PURE__ */
|
|
18653
|
-
/* @__PURE__ */
|
|
18842
|
+
return /* @__PURE__ */ jsxs82(Highlight, { type: "info", className: "text-[10px] leading-4", children: [
|
|
18843
|
+
/* @__PURE__ */ jsxs82("span", { className: "flex items-center gap-[var(--ui-kit-gap)]", children: [
|
|
18844
|
+
/* @__PURE__ */ jsx88(DatabaseBackup, { className: "w-4 h-4 flex-none" }),
|
|
18845
|
+
/* @__PURE__ */ jsx88("span", { className: "font-medium text-xs", children: t("passport:securityMenu.lastBackup") })
|
|
18654
18846
|
] }),
|
|
18655
|
-
recoveryCreatedAt && /* @__PURE__ */
|
|
18656
|
-
/* @__PURE__ */
|
|
18847
|
+
recoveryCreatedAt && /* @__PURE__ */ jsxs82(Fragment33, { children: [
|
|
18848
|
+
/* @__PURE__ */ jsx88("span", { className: "block font-mono! ", children: t("passport:securityMenu.lastBackupMeta", {
|
|
18657
18849
|
browser: cleanStringArtifacts(recoveryBrowser || "unknown"),
|
|
18658
18850
|
os: parseOS(recoveryUa) || "unknown os",
|
|
18659
18851
|
deviceName: cleanStringArtifacts(recoveryDeviceName || recoveryDeviceId || "")
|
|
18660
18852
|
}) }),
|
|
18661
|
-
/* @__PURE__ */
|
|
18853
|
+
/* @__PURE__ */ jsx88("span", { className: "block font-mono! text-[var(--ui-kit-fg-muted)]", children: dayjs6(recoveryCreatedAt).format("MMMM DD, YYYY HH:mm") })
|
|
18662
18854
|
] })
|
|
18663
18855
|
] });
|
|
18664
18856
|
}
|
|
@@ -18673,85 +18865,133 @@ var init_LastBackup = __esm({
|
|
|
18673
18865
|
}
|
|
18674
18866
|
});
|
|
18675
18867
|
|
|
18868
|
+
// src/internal/components/SecurityMenu/Keyshare/useKeyshareRecoveryStats.ts
|
|
18869
|
+
import { useQuery as useQuery17 } from "@tanstack/react-query";
|
|
18870
|
+
function useKeyshareRecoveryStats() {
|
|
18871
|
+
const session = useSession((st) => st.session);
|
|
18872
|
+
const userId = session?.mpcUserId || null;
|
|
18873
|
+
return useQuery17({
|
|
18874
|
+
enabled: !!userId,
|
|
18875
|
+
queryKey: [KEYSHARE_RECOVERY_STATS_QUERY, userId],
|
|
18876
|
+
queryFn: async () => {
|
|
18877
|
+
const iframeManager = getIframeManager();
|
|
18878
|
+
if (!iframeManager) {
|
|
18879
|
+
throw new Error("Iframe manager not available");
|
|
18880
|
+
}
|
|
18881
|
+
const keyshareInfo = await getKeyshareInfo(userId);
|
|
18882
|
+
const shareRecoveryStats = await getShareRecoveryStats();
|
|
18883
|
+
return {
|
|
18884
|
+
keyshareInfo,
|
|
18885
|
+
shareRecoveryStats
|
|
18886
|
+
};
|
|
18887
|
+
}
|
|
18888
|
+
});
|
|
18889
|
+
}
|
|
18890
|
+
var init_useKeyshareRecoveryStats = __esm({
|
|
18891
|
+
"src/internal/components/SecurityMenu/Keyshare/useKeyshareRecoveryStats.ts"() {
|
|
18892
|
+
init_SessionContext();
|
|
18893
|
+
init_keyshare();
|
|
18894
|
+
init_iframe_manager();
|
|
18895
|
+
init_vaultClient();
|
|
18896
|
+
init_constants5();
|
|
18897
|
+
}
|
|
18898
|
+
});
|
|
18899
|
+
|
|
18676
18900
|
// src/internal/components/SecurityMenu/Keyshare/Keyshare.tsx
|
|
18677
|
-
import { Cloud as Cloud3, Laptop, LoaderIcon as
|
|
18678
|
-
import {
|
|
18679
|
-
|
|
18680
|
-
|
|
18901
|
+
import { Cloud as Cloud3, Laptop, LoaderIcon as LoaderIcon10, Server as Server2 } from "lucide-react";
|
|
18902
|
+
import { useEffect as useEffect35 } from "react";
|
|
18903
|
+
import { Fragment as Fragment34, jsx as jsx89, jsxs as jsxs83 } from "react/jsx-runtime";
|
|
18904
|
+
function Keyshare() {
|
|
18905
|
+
const userId = useSession((st) => st?.session?.mpcUserId);
|
|
18681
18906
|
const { t } = useT();
|
|
18907
|
+
const serverHasKeyshare = jwtTokenManager2.getHasKeyshare() ?? false;
|
|
18908
|
+
const { data: recoveryData, isLoading: isRecoveryLoading } = useKeyshareRecoveryStats();
|
|
18909
|
+
useEffect35(() => {
|
|
18910
|
+
if (!recoveryData?.keyshareInfo || isRecoveryLoading) return;
|
|
18911
|
+
useSecurityStore.getState().setRenderKey(`keyshare-loaded-${Date.now()}`);
|
|
18912
|
+
}, [recoveryData, isRecoveryLoading]);
|
|
18913
|
+
const localInfo = recoveryData?.keyshareInfo || {};
|
|
18914
|
+
const hasServerBackup = !!recoveryData?.shareRecoveryStats?.created || recoveryData?.shareRecoveryStats?.devices?.length > 0;
|
|
18682
18915
|
const backup = userId ? getBackupStatus(userId) : { server: { enabled: false }, cloud: { enabled: false }, local: { enabled: false } };
|
|
18683
|
-
|
|
18684
|
-
|
|
18685
|
-
|
|
18686
|
-
|
|
18687
|
-
|
|
18688
|
-
/* @__PURE__ */ jsxs82("div", { className: "grid grid-cols-3 gap-[var(--ui-kit-gap)] px-[var(--ui-kit-gap)]", children: [
|
|
18689
|
-
/* @__PURE__ */ jsx88(
|
|
18690
|
-
KeyshareStatus,
|
|
18691
|
-
{
|
|
18692
|
-
content: serverHasKeyshare ? t("passport:securityMenu.keyshareStatus.serverReady") : t("passport:securityMenu.keyshareStatus.serverMissing"),
|
|
18693
|
-
icon: serverHasKeyshare ? PositiveIcon : NegativeIcon,
|
|
18694
|
-
children: /* @__PURE__ */ jsxs82(
|
|
18695
|
-
Highlight,
|
|
18696
|
-
{
|
|
18697
|
-
type: serverHasKeyshare ? "success" : "warning",
|
|
18698
|
-
className: "w-full h-full flex flex-col items-center gap-0",
|
|
18699
|
-
children: [
|
|
18700
|
-
/* @__PURE__ */ jsx88(Cloud3, { className: "h-6 w-6" }),
|
|
18701
|
-
/* @__PURE__ */ jsx88("span", { className: "text-[10px] font-medium leading-4", children: "Server Share" })
|
|
18702
|
-
]
|
|
18703
|
-
}
|
|
18704
|
-
)
|
|
18705
|
-
}
|
|
18706
|
-
),
|
|
18707
|
-
/* @__PURE__ */ jsx88(
|
|
18708
|
-
KeyshareStatus,
|
|
18709
|
-
{
|
|
18710
|
-
content: localInfo?.hasKeyshare ? t("passport:securityMenu.keyshareStatus.localReady") : t("passport:securityMenu.keyshareStatus.localMissing"),
|
|
18711
|
-
icon: localInfo?.hasKeyshare ? PositiveIcon : NegativeIcon,
|
|
18712
|
-
children: /* @__PURE__ */ jsxs82(
|
|
18713
|
-
Highlight,
|
|
18714
|
-
{
|
|
18715
|
-
type: localInfo?.hasKeyshare ? "success" : "warning",
|
|
18716
|
-
className: "w-full h-full flex flex-col items-center gap-0",
|
|
18717
|
-
children: [
|
|
18718
|
-
/* @__PURE__ */ jsx88(Laptop, { className: "h-6 w-6" }),
|
|
18719
|
-
/* @__PURE__ */ jsx88("span", { className: "text-[10px] font-medium leading-4", children: "Local Share" })
|
|
18720
|
-
]
|
|
18721
|
-
}
|
|
18722
|
-
)
|
|
18723
|
-
}
|
|
18724
|
-
),
|
|
18725
|
-
/* @__PURE__ */ jsx88(
|
|
18726
|
-
KeyshareStatus,
|
|
18727
|
-
{
|
|
18728
|
-
content: hasServerBackup ? t("passport:securityMenu.keyshareStatus.valutBackupCreated") : t("passport:securityMenu.keyshareStatus.valutBackupMissing"),
|
|
18729
|
-
icon: hasServerBackup ? PositiveIcon : NegativeIcon,
|
|
18730
|
-
children: /* @__PURE__ */ jsxs82(
|
|
18731
|
-
Highlight,
|
|
18732
|
-
{
|
|
18733
|
-
type: hasServerBackup ? "success" : "warning",
|
|
18734
|
-
className: "w-full h-full flex flex-col items-center gap-0",
|
|
18735
|
-
children: [
|
|
18736
|
-
/* @__PURE__ */ jsx88(Server2, { className: "h-6 w-6" }),
|
|
18737
|
-
/* @__PURE__ */ jsx88("span", { className: "text-[10px] font-medium leading-4", children: "Vault Backup" })
|
|
18738
|
-
]
|
|
18739
|
-
}
|
|
18740
|
-
)
|
|
18741
|
-
}
|
|
18742
|
-
)
|
|
18916
|
+
const createdRecoveryStats = recoveryData?.shareRecoveryStats?.created;
|
|
18917
|
+
return /* @__PURE__ */ jsxs83(Fragment34, { children: [
|
|
18918
|
+
/* @__PURE__ */ jsxs83("div", { className: "flex items-center justify-between gap-[var(--ui-kit-gap)]", children: [
|
|
18919
|
+
/* @__PURE__ */ jsx89("span", { className: "text-xs leading-4", children: t("passport:securityMenu.keyshareStatus.title") }),
|
|
18920
|
+
isRecoveryLoading && /* @__PURE__ */ jsx89(LoaderIcon10, { className: "h-4 w-4 animate-spin" })
|
|
18743
18921
|
] }),
|
|
18744
|
-
/* @__PURE__ */
|
|
18922
|
+
!isRecoveryLoading && /* @__PURE__ */ jsxs83(Fragment34, { children: [
|
|
18923
|
+
/* @__PURE__ */ jsxs83("div", { className: "grid grid-cols-3 gap-[var(--ui-kit-gap)] px-[var(--ui-kit-gap)]", children: [
|
|
18924
|
+
/* @__PURE__ */ jsx89(
|
|
18925
|
+
KeyshareStatus,
|
|
18926
|
+
{
|
|
18927
|
+
content: serverHasKeyshare ? t("passport:securityMenu.keyshareStatus.serverReady") : t("passport:securityMenu.keyshareStatus.serverMissing"),
|
|
18928
|
+
icon: serverHasKeyshare ? PositiveIcon : NegativeIcon,
|
|
18929
|
+
children: /* @__PURE__ */ jsxs83(
|
|
18930
|
+
Highlight,
|
|
18931
|
+
{
|
|
18932
|
+
type: serverHasKeyshare ? "success" : "warning",
|
|
18933
|
+
className: "w-full h-full flex flex-col items-center gap-0",
|
|
18934
|
+
children: [
|
|
18935
|
+
/* @__PURE__ */ jsx89(Cloud3, { className: "h-6 w-6" }),
|
|
18936
|
+
/* @__PURE__ */ jsx89("span", { className: "text-[10px] font-medium leading-4", children: "Server Share" })
|
|
18937
|
+
]
|
|
18938
|
+
}
|
|
18939
|
+
)
|
|
18940
|
+
}
|
|
18941
|
+
),
|
|
18942
|
+
/* @__PURE__ */ jsx89(
|
|
18943
|
+
KeyshareStatus,
|
|
18944
|
+
{
|
|
18945
|
+
content: localInfo?.hasKeyshare ? t("passport:securityMenu.keyshareStatus.localReady") : t("passport:securityMenu.keyshareStatus.localMissing"),
|
|
18946
|
+
icon: localInfo?.hasKeyshare ? PositiveIcon : NegativeIcon,
|
|
18947
|
+
children: /* @__PURE__ */ jsxs83(
|
|
18948
|
+
Highlight,
|
|
18949
|
+
{
|
|
18950
|
+
type: localInfo?.hasKeyshare ? "success" : "warning",
|
|
18951
|
+
className: "w-full h-full flex flex-col items-center gap-0",
|
|
18952
|
+
children: [
|
|
18953
|
+
/* @__PURE__ */ jsx89(Laptop, { className: "h-6 w-6" }),
|
|
18954
|
+
/* @__PURE__ */ jsx89("span", { className: "text-[10px] font-medium leading-4", children: "Local Share" })
|
|
18955
|
+
]
|
|
18956
|
+
}
|
|
18957
|
+
)
|
|
18958
|
+
}
|
|
18959
|
+
),
|
|
18960
|
+
/* @__PURE__ */ jsx89(
|
|
18961
|
+
KeyshareStatus,
|
|
18962
|
+
{
|
|
18963
|
+
content: hasServerBackup ? t("passport:securityMenu.keyshareStatus.valutBackupCreated") : t("passport:securityMenu.keyshareStatus.valutBackupMissing"),
|
|
18964
|
+
icon: hasServerBackup ? PositiveIcon : NegativeIcon,
|
|
18965
|
+
children: /* @__PURE__ */ jsxs83(
|
|
18966
|
+
Highlight,
|
|
18967
|
+
{
|
|
18968
|
+
type: hasServerBackup ? "success" : "warning",
|
|
18969
|
+
className: "w-full h-full flex flex-col items-center gap-0",
|
|
18970
|
+
children: [
|
|
18971
|
+
/* @__PURE__ */ jsx89(Server2, { className: "h-6 w-6" }),
|
|
18972
|
+
/* @__PURE__ */ jsx89("span", { className: "text-[10px] font-medium leading-4", children: "Vault Backup" })
|
|
18973
|
+
]
|
|
18974
|
+
}
|
|
18975
|
+
)
|
|
18976
|
+
}
|
|
18977
|
+
)
|
|
18978
|
+
] }),
|
|
18979
|
+
/* @__PURE__ */ jsx89(LastBackup, { backup, createdRecoveryStats })
|
|
18980
|
+
] })
|
|
18745
18981
|
] });
|
|
18746
18982
|
}
|
|
18747
18983
|
var init_Keyshare = __esm({
|
|
18748
18984
|
"src/internal/components/SecurityMenu/Keyshare/Keyshare.tsx"() {
|
|
18985
|
+
init_SessionContext();
|
|
18749
18986
|
init_useT();
|
|
18750
18987
|
init_icons();
|
|
18988
|
+
init_auth();
|
|
18751
18989
|
init_vaultClient();
|
|
18752
18990
|
init_highlight();
|
|
18991
|
+
init_useSecurityStore();
|
|
18753
18992
|
init_KeyshareStatus();
|
|
18754
18993
|
init_LastBackup();
|
|
18994
|
+
init_useKeyshareRecoveryStats();
|
|
18755
18995
|
{
|
|
18756
18996
|
}
|
|
18757
18997
|
{
|
|
@@ -18763,95 +19003,18 @@ var init_Keyshare = __esm({
|
|
|
18763
19003
|
var init_Keyshare2 = __esm({
|
|
18764
19004
|
"src/internal/components/SecurityMenu/Keyshare/index.ts"() {
|
|
18765
19005
|
init_Keyshare();
|
|
18766
|
-
|
|
18767
|
-
});
|
|
18768
|
-
|
|
18769
|
-
// src/internal/components/SecurityMenu/UntrustApplication.tsx
|
|
18770
|
-
import { AppWindowMac as AppWindowMac2, Loader as Loader20 } from "lucide-react";
|
|
18771
|
-
import { jsx as jsx89, jsxs as jsxs83 } from "react/jsx-runtime";
|
|
18772
|
-
function UntrustApplication(props) {
|
|
18773
|
-
const { appToUntrust, isPending, cancelUntrust, handleUntrustApp } = props;
|
|
18774
|
-
const { t } = useT();
|
|
18775
|
-
return /* @__PURE__ */ jsxs83("div", { className: "flex flex-col gap-[var(--ui-kit-gap)]", children: [
|
|
18776
|
-
/* @__PURE__ */ jsxs83(Highlight, { className: "flex flex-col gap-[var(--ui-kit-gap)]", type: "warning", children: [
|
|
18777
|
-
/* @__PURE__ */ jsxs83("span", { className: "text-sm leading-5 font-bold", children: [
|
|
18778
|
-
t("passport:securityMenu.connectedApps.untrustApp"),
|
|
18779
|
-
"?"
|
|
18780
|
-
] }),
|
|
18781
|
-
/* @__PURE__ */ jsxs83("div", { className: "w-full flex items-center justify-center gap-[var(--ui-kit-gap)]", children: [
|
|
18782
|
-
appToUntrust.appLogo ? /* @__PURE__ */ jsx89("div", { className: "w-12 h-12 rounded-[var(--ui-kit-el-bdrs)] bg-[var(--ui-kit-bg)] flex-shrink-0 p-1", children: /* @__PURE__ */ jsx89("img", { src: appToUntrust.appLogo, alt: appToUntrust.appName, className: "w-full h-full object-contain" }) }) : /* @__PURE__ */ jsx89("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__ */ jsx89(AppWindowMac2, { className: "w-6 h-6" }) }),
|
|
18783
|
-
/* @__PURE__ */ jsxs83("div", { className: "flex-1 text-left", children: [
|
|
18784
|
-
/* @__PURE__ */ jsx89("div", { className: "font-medium", children: appToUntrust.appName }),
|
|
18785
|
-
appToUntrust.hostname && /* @__PURE__ */ jsxs83("div", { className: "text-[10px]", children: [
|
|
18786
|
-
"(",
|
|
18787
|
-
appToUntrust.hostname,
|
|
18788
|
-
")"
|
|
18789
|
-
] })
|
|
18790
|
-
] })
|
|
18791
|
-
] })
|
|
18792
|
-
] }),
|
|
18793
|
-
/* @__PURE__ */ jsxs83("div", { className: "text-[10px] text-[var(--ui-kit-fg-muted)] text-left space-y-1", children: [
|
|
18794
|
-
/* @__PURE__ */ jsxs83("p", { children: [
|
|
18795
|
-
t("passport:securityMenu.connectedApps.removalNoteTitle"),
|
|
18796
|
-
":"
|
|
18797
|
-
] }),
|
|
18798
|
-
/* @__PURE__ */ jsxs83("ul", { className: "list-disc list-inside ml-2 space-y-0.5", children: [
|
|
18799
|
-
/* @__PURE__ */ jsx89("li", { children: t("passport:securityMenu.connectedApps.removalNoteMsg1") }),
|
|
18800
|
-
/* @__PURE__ */ jsx89("li", { children: t("passport:securityMenu.connectedApps.removalNoteMsg2") })
|
|
18801
|
-
] })
|
|
18802
|
-
] }),
|
|
18803
|
-
/* @__PURE__ */ jsxs83("div", { className: "w-full flex gap-[var(--ui-kit-gap)]", children: [
|
|
18804
|
-
/* @__PURE__ */ jsx89(Button, { variant: "outline", size: "large", className: "flex-1", onClick: () => cancelUntrust(), disabled: isPending, children: t("passport:common.cancel") }),
|
|
18805
|
-
/* @__PURE__ */ jsx89(Button, { variant: "default", size: "large", className: "flex-1", onClick: handleUntrustApp, disabled: isPending, children: isPending ? /* @__PURE__ */ jsx89(Loader20, { className: "h-4 w-4 animate-spin" }) : t("passport:common.delete") })
|
|
18806
|
-
] })
|
|
18807
|
-
] });
|
|
18808
|
-
}
|
|
18809
|
-
var init_UntrustApplication = __esm({
|
|
18810
|
-
"src/internal/components/SecurityMenu/UntrustApplication.tsx"() {
|
|
18811
|
-
init_i18n();
|
|
18812
|
-
init_button();
|
|
18813
|
-
init_highlight();
|
|
19006
|
+
init_useKeyshareRecoveryStats();
|
|
18814
19007
|
}
|
|
18815
19008
|
});
|
|
18816
19009
|
|
|
18817
19010
|
// src/internal/components/SecurityMenu/SecurityMenu.tsx
|
|
18818
|
-
import { useMutation as useMutation18, useQueryClient as useQueryClient21 } from "@tanstack/react-query";
|
|
18819
19011
|
import { ArrowLeft as ArrowLeft18 } from "lucide-react";
|
|
18820
|
-
import {
|
|
18821
|
-
import { jsx as jsx90, jsxs as jsxs84 } from "react/jsx-runtime";
|
|
19012
|
+
import { Fragment as Fragment35, jsx as jsx90, jsxs as jsxs84 } from "react/jsx-runtime";
|
|
18822
19013
|
function SecurityMenu() {
|
|
18823
|
-
const qc = useQueryClient21();
|
|
18824
19014
|
const { t } = useT();
|
|
18825
19015
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
18826
|
-
const
|
|
18827
|
-
const
|
|
18828
|
-
const serverHasKeyshare = jwtTokenManager2.getHasKeyshare() ?? false;
|
|
18829
|
-
const [appToUntrust, untrustApp] = useState22(null);
|
|
18830
|
-
const { data: recoveryData, isLoading: isRecoveryLoading } = useKeyshareRecoveryStats();
|
|
18831
|
-
const localInfo = recoveryData?.keyshareInfo || {};
|
|
18832
|
-
const hasServerBackup = !!recoveryData?.shareRecoveryStats?.created || recoveryData?.shareRecoveryStats?.devices?.length > 0;
|
|
18833
|
-
const { mutate: handleUntrustApp, isPending: isUntrustingApp } = useMutation18({
|
|
18834
|
-
mutationFn: async () => {
|
|
18835
|
-
if (!userId || !appToUntrust) return;
|
|
18836
|
-
const iframeManager = getIframeManager();
|
|
18837
|
-
if (!iframeManager) {
|
|
18838
|
-
throw new Error("Iframe manager not available");
|
|
18839
|
-
}
|
|
18840
|
-
return await iframeManager.removeTrustedApp(userId, appToUntrust.projectId, appToUntrust.origin);
|
|
18841
|
-
},
|
|
18842
|
-
onSuccess: (success) => {
|
|
18843
|
-
if (!success) {
|
|
18844
|
-
console.error("[SecurityMenu] Failed to remove trusted app from iframe");
|
|
18845
|
-
return;
|
|
18846
|
-
}
|
|
18847
|
-
qc.invalidateQueries({ queryKey: [CONNECTED_TRUSTED_APPS_QUERY, userId] });
|
|
18848
|
-
untrustApp(null);
|
|
18849
|
-
},
|
|
18850
|
-
onError: (error) => {
|
|
18851
|
-
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
18852
|
-
console.error("[SecurityMenu] Error removing trusted app:", errorMessage);
|
|
18853
|
-
}
|
|
18854
|
-
});
|
|
19016
|
+
const appToUntrust = useSecurityStore((st) => st.appToUntrust);
|
|
19017
|
+
const renderKey = useSecurityStore((st) => st.renderKey);
|
|
18855
19018
|
return /* @__PURE__ */ jsx90(
|
|
18856
19019
|
"div",
|
|
18857
19020
|
{
|
|
@@ -18869,35 +19032,24 @@ function SecurityMenu() {
|
|
|
18869
19032
|
size: "icon",
|
|
18870
19033
|
title: t("passport:common.back"),
|
|
18871
19034
|
onClick: () => {
|
|
18872
|
-
|
|
18873
|
-
|
|
19035
|
+
const { appToUntrust: appToUntrust2, untrustApp } = useSecurityStore.getState();
|
|
19036
|
+
if (!!appToUntrust2) {
|
|
19037
|
+
untrustApp(null);
|
|
19038
|
+
} else {
|
|
19039
|
+
useLayoutDataStore.getState().setPage("settings" /* SETTINGS */);
|
|
19040
|
+
}
|
|
18874
19041
|
},
|
|
18875
19042
|
children: /* @__PURE__ */ jsx90(ArrowLeft18, { className: "h-4 w-4" })
|
|
18876
19043
|
}
|
|
18877
19044
|
),
|
|
18878
19045
|
/* @__PURE__ */ jsx90("span", { className: "text-xl font-semibold", children: t("passport:securityMenu.title") })
|
|
18879
19046
|
] }),
|
|
18880
|
-
appToUntrust && /* @__PURE__ */ jsx90(
|
|
18881
|
-
|
|
18882
|
-
{
|
|
18883
|
-
|
|
18884
|
-
|
|
18885
|
-
|
|
18886
|
-
handleUntrustApp: async () => await handleUntrustApp()
|
|
18887
|
-
}
|
|
18888
|
-
),
|
|
18889
|
-
!appToUntrust && /* @__PURE__ */ jsx90(
|
|
18890
|
-
Keyshare,
|
|
18891
|
-
{
|
|
18892
|
-
userId,
|
|
18893
|
-
serverHasKeyshare,
|
|
18894
|
-
localInfo,
|
|
18895
|
-
hasServerBackup,
|
|
18896
|
-
isLoading: isRecoveryLoading,
|
|
18897
|
-
createdRecoveryStats: recoveryData?.shareRecoveryStats?.created
|
|
18898
|
-
}
|
|
18899
|
-
),
|
|
18900
|
-
!appToUntrust && /* @__PURE__ */ jsx90(ConnectedApps, { isLoading: isRecoveryLoading, untrustApp })
|
|
19047
|
+
appToUntrust && /* @__PURE__ */ jsx90(UntrustApplication, {}),
|
|
19048
|
+
!appToUntrust && /* @__PURE__ */ jsxs84(Fragment35, { children: [
|
|
19049
|
+
/* @__PURE__ */ jsx90(Keyshare, {}),
|
|
19050
|
+
/* @__PURE__ */ jsx90(ConnectedApps, {})
|
|
19051
|
+
] }),
|
|
19052
|
+
/* @__PURE__ */ jsx90("div", { className: "w-full" }, renderKey)
|
|
18901
19053
|
] })
|
|
18902
19054
|
}
|
|
18903
19055
|
);
|
|
@@ -18905,17 +19057,13 @@ function SecurityMenu() {
|
|
|
18905
19057
|
var init_SecurityMenu = __esm({
|
|
18906
19058
|
"src/internal/components/SecurityMenu/SecurityMenu.tsx"() {
|
|
18907
19059
|
init_i18n();
|
|
18908
|
-
init_auth();
|
|
18909
19060
|
init_useLayoutDataStore();
|
|
18910
19061
|
init_useLayoutStore();
|
|
18911
|
-
init_iframe_manager();
|
|
18912
19062
|
init_Expandable2();
|
|
18913
19063
|
init_button();
|
|
18914
|
-
|
|
18915
|
-
init_constants5();
|
|
18916
|
-
init_hooks2();
|
|
19064
|
+
init_ConnectedApps2();
|
|
18917
19065
|
init_Keyshare2();
|
|
18918
|
-
|
|
19066
|
+
init_useSecurityStore();
|
|
18919
19067
|
}
|
|
18920
19068
|
});
|
|
18921
19069
|
|
|
@@ -18923,6 +19071,8 @@ var init_SecurityMenu = __esm({
|
|
|
18923
19071
|
var init_SecurityMenu2 = __esm({
|
|
18924
19072
|
"src/internal/components/SecurityMenu/index.ts"() {
|
|
18925
19073
|
init_SecurityMenu();
|
|
19074
|
+
init_ConnectedApps2();
|
|
19075
|
+
init_Keyshare2();
|
|
18926
19076
|
}
|
|
18927
19077
|
});
|
|
18928
19078
|
|
|
@@ -19018,12 +19168,12 @@ var init_wallet = __esm({
|
|
|
19018
19168
|
});
|
|
19019
19169
|
|
|
19020
19170
|
// src/internal/components/SendMenu/useFlowSelector.ts
|
|
19021
|
-
import { create as
|
|
19171
|
+
import { create as create11 } from "zustand";
|
|
19022
19172
|
import { persist as persist2 } from "zustand/middleware";
|
|
19023
19173
|
var useFlowSelectorStore;
|
|
19024
19174
|
var init_useFlowSelector = __esm({
|
|
19025
19175
|
"src/internal/components/SendMenu/useFlowSelector.ts"() {
|
|
19026
|
-
useFlowSelectorStore =
|
|
19176
|
+
useFlowSelectorStore = create11()(
|
|
19027
19177
|
persist2(
|
|
19028
19178
|
(set) => ({
|
|
19029
19179
|
renderKey: Date.now().toString(),
|
|
@@ -19088,7 +19238,7 @@ var init_chains = __esm({
|
|
|
19088
19238
|
});
|
|
19089
19239
|
|
|
19090
19240
|
// src/internal/components/SendMenu/hyperbridge/useBridgeStore.ts
|
|
19091
|
-
import { create as
|
|
19241
|
+
import { create as create12 } from "zustand";
|
|
19092
19242
|
import { persist as persist3 } from "zustand/middleware";
|
|
19093
19243
|
var RESETABLE_STATES, useBridgeStore;
|
|
19094
19244
|
var init_useBridgeStore = __esm({
|
|
@@ -19104,7 +19254,7 @@ var init_useBridgeStore = __esm({
|
|
|
19104
19254
|
isQuoteEstimating: false,
|
|
19105
19255
|
bridgeHistoryItem: null
|
|
19106
19256
|
};
|
|
19107
|
-
useBridgeStore =
|
|
19257
|
+
useBridgeStore = create12()(
|
|
19108
19258
|
persist3(
|
|
19109
19259
|
(set, get) => ({
|
|
19110
19260
|
bridgeSenders: [],
|
|
@@ -19162,7 +19312,7 @@ var init_useBridgeStore = __esm({
|
|
|
19162
19312
|
// src/internal/components/SendMenu/hyperbridge/components/SenderSelector.tsx
|
|
19163
19313
|
import { useConnectModal } from "@rainbow-me/rainbowkit";
|
|
19164
19314
|
import { useMutation as useMutation19 } from "@tanstack/react-query";
|
|
19165
|
-
import { useEffect as
|
|
19315
|
+
import { useEffect as useEffect36, useRef as useRef18, useState as useState22 } from "react";
|
|
19166
19316
|
import { useSignMessage } from "wagmi";
|
|
19167
19317
|
import { jsx as jsx91, jsxs as jsxs85 } from "react/jsx-runtime";
|
|
19168
19318
|
function SenderSelector(props) {
|
|
@@ -19173,12 +19323,12 @@ function SenderSelector(props) {
|
|
|
19173
19323
|
const { openConnectModal } = useConnectModal();
|
|
19174
19324
|
const directWalletAddress = useExternalWalletStore((st) => st.externalAddress);
|
|
19175
19325
|
const directWalletIsConnected = useExternalWalletStore((st) => st.isExternalConnected);
|
|
19176
|
-
const pendingWalletRef =
|
|
19326
|
+
const pendingWalletRef = useRef18(null);
|
|
19177
19327
|
const originChain = useBridgeStore((st) => st.originChain);
|
|
19178
19328
|
const bridgeSender = useBridgeStore((st) => st.bridgeSender);
|
|
19179
19329
|
const bridgeSenders = useBridgeStore((st) => st.bridgeSenders);
|
|
19180
|
-
const [walletMessage, setWalletMessage] =
|
|
19181
|
-
|
|
19330
|
+
const [walletMessage, setWalletMessage] = useState22(null);
|
|
19331
|
+
useEffect36(() => {
|
|
19182
19332
|
useFlowSelectorStore.getState().setRenderKey(`sender-selected-${Date.now()}`);
|
|
19183
19333
|
}, [walletMessage]);
|
|
19184
19334
|
const { mutate: loginDirectWallet, isPending: isDirectWalletLoggingIn } = useMutation19({
|
|
@@ -19234,7 +19384,7 @@ function SenderSelector(props) {
|
|
|
19234
19384
|
setWalletMessage(error instanceof Error ? error.message : "Wallet login failed. Please try again.");
|
|
19235
19385
|
}
|
|
19236
19386
|
});
|
|
19237
|
-
|
|
19387
|
+
useEffect36(() => {
|
|
19238
19388
|
const pendingProfile = pendingWalletRef.current;
|
|
19239
19389
|
if (!pendingProfile || !directWalletIsConnected || !directWalletAddress) return;
|
|
19240
19390
|
if (directWalletAddress.toLowerCase() !== pendingProfile.externalId?.toLowerCase()) return;
|
|
@@ -19407,12 +19557,12 @@ var init_wallets = __esm({
|
|
|
19407
19557
|
});
|
|
19408
19558
|
|
|
19409
19559
|
// src/internal/components/SendMenu/hyperbridge/hooks/useAvailableSenders.ts
|
|
19410
|
-
import { useEffect as
|
|
19560
|
+
import { useEffect as useEffect37, useRef as useRef19 } from "react";
|
|
19411
19561
|
function useAvailableSenders() {
|
|
19412
19562
|
const address = useSession((st) => st.address);
|
|
19413
19563
|
const { profiles } = useLinkedProfiles();
|
|
19414
|
-
const lastCalcedSenders =
|
|
19415
|
-
|
|
19564
|
+
const lastCalcedSenders = useRef19([]);
|
|
19565
|
+
useEffect37(() => {
|
|
19416
19566
|
const sendersAccumulator = [
|
|
19417
19567
|
{
|
|
19418
19568
|
type: "embarkai-wallet",
|
|
@@ -19774,7 +19924,7 @@ var init_utils8 = __esm({
|
|
|
19774
19924
|
// src/internal/components/SendMenu/hyperbridge/hooks/useHyperlaneHistory.ts
|
|
19775
19925
|
import { useInfiniteQuery as useInfiniteQuery3 } from "@tanstack/react-query";
|
|
19776
19926
|
import { debounce as debounce7 } from "lodash-es";
|
|
19777
|
-
import { useCallback as
|
|
19927
|
+
import { useCallback as useCallback26, useEffect as useEffect38, useMemo as useMemo12 } from "react";
|
|
19778
19928
|
function useHyperlaneHistory() {
|
|
19779
19929
|
const address = useSession((st) => st.address);
|
|
19780
19930
|
const page = useLayoutDataStore((st) => st.page);
|
|
@@ -19794,13 +19944,13 @@ function useHyperlaneHistory() {
|
|
|
19794
19944
|
() => txHistoryData?.pages?.map((p) => p.data).flat(Infinity) || [],
|
|
19795
19945
|
[txHistoryData]
|
|
19796
19946
|
);
|
|
19797
|
-
const updateExpandable =
|
|
19947
|
+
const updateExpandable = useCallback26(
|
|
19798
19948
|
debounce7(() => {
|
|
19799
19949
|
useFlowSelectorStore.getState().setRenderKey(`hyperlane-history-loaded-${Date.now()}`);
|
|
19800
19950
|
}, 250),
|
|
19801
19951
|
[]
|
|
19802
19952
|
);
|
|
19803
|
-
|
|
19953
|
+
useEffect38(() => {
|
|
19804
19954
|
if (isBridgeTxHistoryLoading || txList.length === 0) return;
|
|
19805
19955
|
updateExpandable();
|
|
19806
19956
|
}, [isBridgeTxHistoryLoading, txList]);
|
|
@@ -19821,11 +19971,11 @@ var init_useHyperlaneHistory = __esm({
|
|
|
19821
19971
|
});
|
|
19822
19972
|
|
|
19823
19973
|
// src/internal/components/SendMenu/hyperbridge/hooks/useOperationHashesStore.ts
|
|
19824
|
-
import { create as
|
|
19974
|
+
import { create as create13 } from "zustand";
|
|
19825
19975
|
var useOperationHashesStore;
|
|
19826
19976
|
var init_useOperationHashesStore = __esm({
|
|
19827
19977
|
"src/internal/components/SendMenu/hyperbridge/hooks/useOperationHashesStore.ts"() {
|
|
19828
|
-
useOperationHashesStore =
|
|
19978
|
+
useOperationHashesStore = create13((set) => ({
|
|
19829
19979
|
hyperlaneDatabaseTx: null,
|
|
19830
19980
|
operationHashes: [],
|
|
19831
19981
|
setHyperlaneDatabaseTx: (hyperlaneDatabaseTx) => set({ hyperlaneDatabaseTx }),
|
|
@@ -19836,7 +19986,7 @@ var init_useOperationHashesStore = __esm({
|
|
|
19836
19986
|
|
|
19837
19987
|
// src/internal/components/SendMenu/hyperbridge/hooks/useBridge.ts
|
|
19838
19988
|
import { useMutation as useMutation20, useQueryClient as useQueryClient22 } from "@tanstack/react-query";
|
|
19839
|
-
import { useCallback as
|
|
19989
|
+
import { useCallback as useCallback27 } from "react";
|
|
19840
19990
|
import { useSwitchChain, useWalletClient } from "wagmi";
|
|
19841
19991
|
function useBridge() {
|
|
19842
19992
|
const qc = useQueryClient22();
|
|
@@ -19844,7 +19994,7 @@ function useBridge() {
|
|
|
19844
19994
|
const address = useSession((st) => st.address);
|
|
19845
19995
|
const { data: walletClient } = useWalletClient();
|
|
19846
19996
|
const { switchChainAsync } = useSwitchChain();
|
|
19847
|
-
const swapDirection =
|
|
19997
|
+
const swapDirection = useCallback27(() => {
|
|
19848
19998
|
const {
|
|
19849
19999
|
bridgeStep,
|
|
19850
20000
|
originChain,
|
|
@@ -19896,7 +20046,7 @@ function useBridge() {
|
|
|
19896
20046
|
useFlowSelectorStore.getState().setError(error instanceof Error ? error.message : String(error));
|
|
19897
20047
|
}
|
|
19898
20048
|
});
|
|
19899
|
-
const handleQuoteEstimation =
|
|
20049
|
+
const handleQuoteEstimation = useCallback27((amnt) => {
|
|
19900
20050
|
const { originChain, destinationChain, bridgeSender } = useBridgeStore.getState();
|
|
19901
20051
|
if (!amnt || !Number(amnt)) {
|
|
19902
20052
|
useBridgeStore.getState().setQuote(null);
|
|
@@ -20040,7 +20190,7 @@ var init_useBridge = __esm({
|
|
|
20040
20190
|
|
|
20041
20191
|
// src/internal/components/SendMenu/hyperbridge/hooks/useHyperlaneRoutes.ts
|
|
20042
20192
|
import { useQuery as useQuery18 } from "@tanstack/react-query";
|
|
20043
|
-
import { useEffect as
|
|
20193
|
+
import { useEffect as useEffect39 } from "react";
|
|
20044
20194
|
function useHyperlaneRoutes() {
|
|
20045
20195
|
const address = useSession((st) => st.address);
|
|
20046
20196
|
const page = useLayoutDataStore((st) => st.page);
|
|
@@ -20060,7 +20210,7 @@ function useHyperlaneRoutes() {
|
|
|
20060
20210
|
return warpRoutes;
|
|
20061
20211
|
}
|
|
20062
20212
|
});
|
|
20063
|
-
|
|
20213
|
+
useEffect39(() => {
|
|
20064
20214
|
if (!errorWarpRoutes) return;
|
|
20065
20215
|
useFlowSelectorStore.getState().setError(errorWarpRoutes.message);
|
|
20066
20216
|
const { resetSelections, setRecipient, setOriginChain, setDestinationChain } = useBridgeStore.getState();
|
|
@@ -20069,7 +20219,7 @@ function useHyperlaneRoutes() {
|
|
|
20069
20219
|
setOriginChain(null);
|
|
20070
20220
|
setDestinationChain(null);
|
|
20071
20221
|
}, [errorWarpRoutes]);
|
|
20072
|
-
|
|
20222
|
+
useEffect39(() => {
|
|
20073
20223
|
if (!!hyperRoute || !hyperlaneWarpRoutes.length) return;
|
|
20074
20224
|
const warpRouteToAutoSelect = hyperlaneWarpRoutes.find((route) => route.routeId === hyperRoute);
|
|
20075
20225
|
if (!warpRouteToAutoSelect) return;
|
|
@@ -20102,13 +20252,13 @@ var init_useHyperlaneRoutes = __esm({
|
|
|
20102
20252
|
});
|
|
20103
20253
|
|
|
20104
20254
|
// src/internal/components/SendMenu/hyperbridge/hooks/useMenuTitle.ts
|
|
20105
|
-
import { useEffect as
|
|
20255
|
+
import { useEffect as useEffect40 } from "react";
|
|
20106
20256
|
function useMenuTitle(warpRoutes) {
|
|
20107
20257
|
const { t } = useT();
|
|
20108
20258
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
20109
20259
|
const hyperRoute = useBridgeStore((st) => st.hyperRoute);
|
|
20110
20260
|
const hyperRouteMeta = warpRoutes?.length ? warpRoutes.find((route) => route.routeId === hyperRoute) : null;
|
|
20111
|
-
|
|
20261
|
+
useEffect40(() => {
|
|
20112
20262
|
const updateMenuTitle = useFlowSelectorStore.getState().setMenuTitle;
|
|
20113
20263
|
switch (true) {
|
|
20114
20264
|
case bridgeStep === "sender-selector":
|
|
@@ -20160,7 +20310,7 @@ var init_ResolveChainIcon = __esm({
|
|
|
20160
20310
|
// src/internal/components/SendMenu/hyperbridge/hooks/useBridgeBalance.ts
|
|
20161
20311
|
import { CHAINS_BROWSERS_TRANSPORTS as CHAINS_BROWSERS_TRANSPORTS2 } from "@embarkai/core";
|
|
20162
20312
|
import { useQuery as useQuery19, useQueryClient as useQueryClient23 } from "@tanstack/react-query";
|
|
20163
|
-
import { useCallback as
|
|
20313
|
+
import { useCallback as useCallback28, useEffect as useEffect41 } from "react";
|
|
20164
20314
|
import { createPublicClient as createPublicClient2, erc20Abi as erc20Abi2, formatUnits as formatUnits7, http as http3 } from "viem";
|
|
20165
20315
|
import { useSwitchChain as useSwitchChain2 } from "wagmi";
|
|
20166
20316
|
function checkWrapedTokenSymbol2(symbol) {
|
|
@@ -20255,7 +20405,7 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
|
20255
20405
|
};
|
|
20256
20406
|
}
|
|
20257
20407
|
});
|
|
20258
|
-
const refreshRouteTokenBalance =
|
|
20408
|
+
const refreshRouteTokenBalance = useCallback28(
|
|
20259
20409
|
(senderWallet) => {
|
|
20260
20410
|
switch (true) {
|
|
20261
20411
|
case senderWallet === "embarkai-wallet":
|
|
@@ -20271,7 +20421,7 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
|
20271
20421
|
},
|
|
20272
20422
|
[refreshBalances, qc]
|
|
20273
20423
|
);
|
|
20274
|
-
|
|
20424
|
+
useEffect41(() => {
|
|
20275
20425
|
if (!bridgeSender || !originChain) return;
|
|
20276
20426
|
switch (bridgeSender) {
|
|
20277
20427
|
case "embarkai-wallet":
|
|
@@ -20320,9 +20470,9 @@ var init_useBridgeBalance = __esm({
|
|
|
20320
20470
|
});
|
|
20321
20471
|
|
|
20322
20472
|
// src/internal/components/SendMenu/hyperbridge/steps/SelectStep.tsx
|
|
20323
|
-
import { ArrowLeftRightIcon, ArrowRightLeftIcon, LoaderIcon as
|
|
20324
|
-
import { Fragment as
|
|
20325
|
-
import { Fragment as
|
|
20473
|
+
import { ArrowLeftRightIcon, ArrowRightLeftIcon, LoaderIcon as LoaderIcon11, Wallet2Icon as Wallet2Icon2, XIcon } from "lucide-react";
|
|
20474
|
+
import { Fragment as Fragment36 } from "react";
|
|
20475
|
+
import { Fragment as Fragment37, jsx as jsx95, jsxs as jsxs88 } from "react/jsx-runtime";
|
|
20326
20476
|
function SelectStep(props) {
|
|
20327
20477
|
const { swapChains, hyperlaneWarpRoutes = [], isLoadingWarpRoutes, handleQuoteEstimation } = props;
|
|
20328
20478
|
const { t } = useT();
|
|
@@ -20346,7 +20496,7 @@ function SelectStep(props) {
|
|
|
20346
20496
|
const SelectedWarpRoteIcon = TOKENS_ICONS[(selectedWarpRoute?.symbol || "null_icon").toUpperCase()] || TOKENS_ICONS.EMBARKAI;
|
|
20347
20497
|
const isError = useFlowSelectorStore((st) => !!st.error);
|
|
20348
20498
|
if (isLoadingWarpRoutes) {
|
|
20349
|
-
return /* @__PURE__ */ jsx95("div", { className: "w-full flex items-center justify-center p-[var(--ui-kit-pd)]", children: /* @__PURE__ */ jsx95(
|
|
20499
|
+
return /* @__PURE__ */ jsx95("div", { className: "w-full flex items-center justify-center p-[var(--ui-kit-pd)]", children: /* @__PURE__ */ jsx95(LoaderIcon11, { className: "w-4 h-4 animate-spin" }) });
|
|
20350
20500
|
}
|
|
20351
20501
|
const isBalanceInsufficient = !routeTokenBalance || Number(amount || 0) > Number(routeTokenBalance || 0);
|
|
20352
20502
|
const isFalsyAmount = !amount || !Number(amount) || Number(amount) <= 0;
|
|
@@ -20394,7 +20544,7 @@ function SelectStep(props) {
|
|
|
20394
20544
|
t("passport:common.balance"),
|
|
20395
20545
|
": "
|
|
20396
20546
|
] }),
|
|
20397
|
-
isRouteTokenBalanceLoading && /* @__PURE__ */ jsx95(
|
|
20547
|
+
isRouteTokenBalanceLoading && /* @__PURE__ */ jsx95(LoaderIcon11, { className: "w-4 h-4 animate-spin text-[var(--ui-kit-fg-muted)]" }),
|
|
20398
20548
|
!isRouteTokenBalanceLoading && /* @__PURE__ */ jsxs88("span", { className: cn("font-semibold", { "text-[var(--ui-kit-bg-error)]": isBalanceInsufficient }), children: [
|
|
20399
20549
|
formatPrice(Number(routeTokenBalance || 0)),
|
|
20400
20550
|
" ",
|
|
@@ -20426,7 +20576,7 @@ function SelectStep(props) {
|
|
|
20426
20576
|
variant: "outline",
|
|
20427
20577
|
size: "medium",
|
|
20428
20578
|
className: "bg-[var(--ui-kit-bg)] flex items-center gap-[var(--ui-kit-gap)]",
|
|
20429
|
-
children: selectedWarpRoute.chainPair.map((chain, chIdx) => /* @__PURE__ */ jsxs88(
|
|
20579
|
+
children: selectedWarpRoute.chainPair.map((chain, chIdx) => /* @__PURE__ */ jsxs88(Fragment36, { children: [
|
|
20430
20580
|
chIdx > 0 && /* @__PURE__ */ jsx95(ArrowLeftRightIcon, { className: "w-4 h-4 " }),
|
|
20431
20581
|
/* @__PURE__ */ jsx95(ResolveChainIcon, { chainName: chain.chainName, className: "w-4 h-4" })
|
|
20432
20582
|
] }, `${selectedWarpRoute.id}-icon-${chain.chainID}-${chIdx}`))
|
|
@@ -20449,7 +20599,7 @@ function SelectStep(props) {
|
|
|
20449
20599
|
}
|
|
20450
20600
|
),
|
|
20451
20601
|
/* @__PURE__ */ jsxs88("div", { className: "w-full flex items-center justify-center", children: [
|
|
20452
|
-
/* @__PURE__ */ jsx95(Badge, { variant: "outline", size: "large", className: "block flex-1 flex gap-[var(--ui-kit-gap)] justify-center", children: originChain ? /* @__PURE__ */ jsxs88(
|
|
20602
|
+
/* @__PURE__ */ jsx95(Badge, { variant: "outline", size: "large", className: "block flex-1 flex gap-[var(--ui-kit-gap)] justify-center", children: originChain ? /* @__PURE__ */ jsxs88(Fragment37, { children: [
|
|
20453
20603
|
/* @__PURE__ */ jsx95(ResolveChainIcon, { chainName: originChain, className: "w-6 h-6" }),
|
|
20454
20604
|
/* @__PURE__ */ jsx95("span", { className: "block max-w-[100px] truncate", children: CHAINS_UI_META[originChain]?.chainLabel })
|
|
20455
20605
|
] }) : /* @__PURE__ */ jsx95("span", { className: "text-[var(--ui-kit-fg-muted)]", children: "N/A" }) }),
|
|
@@ -20463,7 +20613,7 @@ function SelectStep(props) {
|
|
|
20463
20613
|
children: /* @__PURE__ */ jsx95(ArrowRightLeftIcon, { className: "w-4 h-4 " })
|
|
20464
20614
|
}
|
|
20465
20615
|
),
|
|
20466
|
-
/* @__PURE__ */ jsx95(Badge, { variant: "outline", size: "large", className: "block flex-1 flex gap-[var(--ui-kit-gap)] justify-center", children: destinationChain ? /* @__PURE__ */ jsxs88(
|
|
20616
|
+
/* @__PURE__ */ jsx95(Badge, { variant: "outline", size: "large", className: "block flex-1 flex gap-[var(--ui-kit-gap)] justify-center", children: destinationChain ? /* @__PURE__ */ jsxs88(Fragment37, { children: [
|
|
20467
20617
|
/* @__PURE__ */ jsx95(ResolveChainIcon, { chainName: destinationChain, className: "w-6 h-6" }),
|
|
20468
20618
|
/* @__PURE__ */ jsx95("span", { className: "block max-w-[100px] truncate", children: CHAINS_UI_META[destinationChain]?.chainLabel })
|
|
20469
20619
|
] }) : /* @__PURE__ */ jsx95("span", { className: "text-[var(--ui-kit-fg-muted)]", children: "N/A" }) })
|
|
@@ -20554,7 +20704,7 @@ function SelectStep(props) {
|
|
|
20554
20704
|
onClick: () => handleQuoteEstimation(amount),
|
|
20555
20705
|
disabled: isQuoteEstimationDisabled,
|
|
20556
20706
|
children: [
|
|
20557
|
-
isQuoteEstimating && /* @__PURE__ */ jsx95(
|
|
20707
|
+
isQuoteEstimating && /* @__PURE__ */ jsx95(LoaderIcon11, { className: "h-4 w-4 animate-spin" }),
|
|
20558
20708
|
/* @__PURE__ */ jsx95("span", { children: isBalanceInsufficient ? t("passport:bridgeMenu.statuses.balanceInsufficient").toUpperCase() : t("passport:bridgeMenu.actions.estimateQuote").toUpperCase() })
|
|
20559
20709
|
]
|
|
20560
20710
|
}
|
|
@@ -20609,12 +20759,12 @@ var init_checkbox = __esm({
|
|
|
20609
20759
|
});
|
|
20610
20760
|
|
|
20611
20761
|
// src/internal/components/SendMenu/hyperbridge/steps/ConfirmStep.tsx
|
|
20612
|
-
import { LoaderIcon as
|
|
20613
|
-
import { useState as
|
|
20762
|
+
import { LoaderIcon as LoaderIcon12 } from "lucide-react";
|
|
20763
|
+
import { useState as useState23 } from "react";
|
|
20614
20764
|
import { jsx as jsx97, jsxs as jsxs89 } from "react/jsx-runtime";
|
|
20615
20765
|
function ConfirmStep(props) {
|
|
20616
20766
|
const { isAssetBridging, bridgeAsset, hyperlaneWarpRoutes } = props;
|
|
20617
|
-
const [userConsent, setUserConsent] =
|
|
20767
|
+
const [userConsent, setUserConsent] = useState23(false);
|
|
20618
20768
|
const { t } = useT();
|
|
20619
20769
|
const address = useSession((st) => st.address);
|
|
20620
20770
|
const bridgeSender = useBridgeStore((st) => st.bridgeSenders.find((s) => s.type === st.bridgeSender));
|
|
@@ -20716,7 +20866,7 @@ function ConfirmStep(props) {
|
|
|
20716
20866
|
onClick: () => bridgeAsset(),
|
|
20717
20867
|
className: "w-full",
|
|
20718
20868
|
children: [
|
|
20719
|
-
isAssetBridging && /* @__PURE__ */ jsx97(
|
|
20869
|
+
isAssetBridging && /* @__PURE__ */ jsx97(LoaderIcon12, { className: "h-4 w-4 animate-spin" }),
|
|
20720
20870
|
/* @__PURE__ */ jsx97("span", { children: (bridgeTxStatus || t("passport:common.continue")).toUpperCase() })
|
|
20721
20871
|
]
|
|
20722
20872
|
}
|
|
@@ -20833,7 +20983,7 @@ var init_SuccessStep = __esm({
|
|
|
20833
20983
|
// src/internal/components/SendMenu/hyperbridge/steps/HistoryStep.tsx
|
|
20834
20984
|
import { useQueryClient as useQueryClient24 } from "@tanstack/react-query";
|
|
20835
20985
|
import dayjs7 from "dayjs";
|
|
20836
|
-
import { ArrowRightIcon, DownloadIcon as DownloadIcon2, ExternalLinkIcon as ExternalLinkIcon3, InfoIcon as
|
|
20986
|
+
import { ArrowRightIcon, DownloadIcon as DownloadIcon2, ExternalLinkIcon as ExternalLinkIcon3, InfoIcon as InfoIcon5, LoaderIcon as LoaderIcon13 } from "lucide-react";
|
|
20837
20987
|
import { jsx as jsx99, jsxs as jsxs91 } from "react/jsx-runtime";
|
|
20838
20988
|
function HistoryDetailsStep() {
|
|
20839
20989
|
const { t } = useT();
|
|
@@ -21040,7 +21190,7 @@ function HistoryItem(props) {
|
|
|
21040
21190
|
setBridgeStep("tx-history-details");
|
|
21041
21191
|
},
|
|
21042
21192
|
children: [
|
|
21043
|
-
/* @__PURE__ */ jsx99(
|
|
21193
|
+
/* @__PURE__ */ jsx99(InfoIcon5, { className: "w-4 h-4" }),
|
|
21044
21194
|
/* @__PURE__ */ jsx99("span", { className: "text-xs leading-5", children: t("passport:common.details") })
|
|
21045
21195
|
]
|
|
21046
21196
|
}
|
|
@@ -21059,7 +21209,7 @@ function HistoryStep() {
|
|
|
21059
21209
|
return /* @__PURE__ */ jsx99(Highlight, { type: "info", className: "w-full text-center text-[10px] text-[var(--ui-kit-fg-muted)] leading-4", children: t("passport:bridgeMenu.errors.noHistory") });
|
|
21060
21210
|
}
|
|
21061
21211
|
return /* @__PURE__ */ jsxs91("div", { className: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: [
|
|
21062
|
-
isLoading && /* @__PURE__ */ jsx99("div", { className: "w-full flex items-center justify-center p-[var(--ui-kit-pd)]", children: /* @__PURE__ */ jsx99(
|
|
21212
|
+
isLoading && /* @__PURE__ */ jsx99("div", { className: "w-full flex items-center justify-center p-[var(--ui-kit-pd)]", children: /* @__PURE__ */ jsx99(LoaderIcon13, { className: "w-4 h-4 animate-spin" }) }),
|
|
21063
21213
|
!isLoading && txList.map((item) => /* @__PURE__ */ jsx99(HistoryItem, { ...item }, item.id)),
|
|
21064
21214
|
hasNextPage && /* @__PURE__ */ jsxs91(
|
|
21065
21215
|
Button,
|
|
@@ -21070,7 +21220,7 @@ function HistoryStep() {
|
|
|
21070
21220
|
className: "w-full",
|
|
21071
21221
|
onClick: () => fetchNextPage(),
|
|
21072
21222
|
children: [
|
|
21073
|
-
isTxDataFetching ? /* @__PURE__ */ jsx99(
|
|
21223
|
+
isTxDataFetching ? /* @__PURE__ */ jsx99(LoaderIcon13, { className: "w-4 h-4 animate-spin" }) : /* @__PURE__ */ jsx99(DownloadIcon2, { className: "w-4 h-4" }),
|
|
21074
21224
|
t("passport:common.loadMore")
|
|
21075
21225
|
]
|
|
21076
21226
|
}
|
|
@@ -21099,12 +21249,12 @@ var init_HistoryStep = __esm({
|
|
|
21099
21249
|
|
|
21100
21250
|
// src/internal/components/SendMenu/hyperbridge/steps/SelectAssetRoute.tsx
|
|
21101
21251
|
import { ArrowLeftRightIcon as ArrowLeftRightIcon2 } from "lucide-react";
|
|
21102
|
-
import { useMemo as useMemo13, useState as
|
|
21103
|
-
import { Fragment as
|
|
21252
|
+
import { useMemo as useMemo13, useState as useState24 } from "react";
|
|
21253
|
+
import { Fragment as Fragment38, jsx as jsx100, jsxs as jsxs92 } from "react/jsx-runtime";
|
|
21104
21254
|
function SelectAssetRoute(props) {
|
|
21105
21255
|
const { hyperlaneWarpRoutes } = props;
|
|
21106
21256
|
const { t } = useT();
|
|
21107
|
-
const [isTokenSymbolSelector, setIsTokenSymbolSelector] =
|
|
21257
|
+
const [isTokenSymbolSelector, setIsTokenSymbolSelector] = useState24(false);
|
|
21108
21258
|
const selectedAssetSymbol = useBridgeStore((st) => st.bridgeAssetSymbol);
|
|
21109
21259
|
const tokenList = useMemo13(() => {
|
|
21110
21260
|
const tokens = hyperlaneWarpRoutes.map((route) => route.symbol);
|
|
@@ -21146,13 +21296,13 @@ function SelectAssetRoute(props) {
|
|
|
21146
21296
|
setIsTokenSymbolSelector(true);
|
|
21147
21297
|
useFlowSelectorStore.getState().setRenderKey(`hyperlane-route-asset-selector-${Date.now()}`);
|
|
21148
21298
|
},
|
|
21149
|
-
children: selectedAsset ? /* @__PURE__ */ jsxs92(
|
|
21299
|
+
children: selectedAsset ? /* @__PURE__ */ jsxs92(Fragment38, { children: [
|
|
21150
21300
|
/* @__PURE__ */ jsx100(selectedAsset.Icon, { className: "w-6 h-6" }),
|
|
21151
21301
|
selectedAsset.symbol
|
|
21152
21302
|
] }) : t("passport:bridgeMenu.actions.selectAsset")
|
|
21153
21303
|
}
|
|
21154
21304
|
),
|
|
21155
|
-
availableChainPairs.length > 0 && /* @__PURE__ */ jsxs92(
|
|
21305
|
+
availableChainPairs.length > 0 && /* @__PURE__ */ jsxs92(Fragment38, { children: [
|
|
21156
21306
|
/* @__PURE__ */ jsx100("span", { className: "block text-[10px] text-[var(--ui-kit-fg-muted)]", children: t("passport:bridgeMenu.labels.availableChainPairs") }),
|
|
21157
21307
|
/* @__PURE__ */ jsx100("div", { className: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: availableChainPairs.map(([fromChain, toChain]) => /* @__PURE__ */ jsxs92(
|
|
21158
21308
|
Button,
|
|
@@ -21227,20 +21377,20 @@ var init_steps = __esm({
|
|
|
21227
21377
|
});
|
|
21228
21378
|
|
|
21229
21379
|
// src/internal/components/SendMenu/hyperbridge/HyperlaneBridge.tsx
|
|
21230
|
-
import { useEffect as
|
|
21231
|
-
import { Fragment as
|
|
21380
|
+
import { useEffect as useEffect42 } from "react";
|
|
21381
|
+
import { Fragment as Fragment39, jsx as jsx101, jsxs as jsxs93 } from "react/jsx-runtime";
|
|
21232
21382
|
function HyperlaneBridge() {
|
|
21233
21383
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
21234
21384
|
const { swapDirection, handleQuoteEstimation, bridgeAsset, isAssetBridging } = useBridge();
|
|
21235
21385
|
const { hyperlaneWarpRoutes, isLoadingWarpRoutes } = useHyperlaneRoutes();
|
|
21236
21386
|
const { directWalletProfile } = useAvailableSenders();
|
|
21237
21387
|
useMenuTitle(hyperlaneWarpRoutes);
|
|
21238
|
-
|
|
21388
|
+
useEffect42(() => {
|
|
21239
21389
|
return () => {
|
|
21240
21390
|
useBridgeStore.getState().resetSelections();
|
|
21241
21391
|
};
|
|
21242
21392
|
}, []);
|
|
21243
|
-
return /* @__PURE__ */ jsxs93(
|
|
21393
|
+
return /* @__PURE__ */ jsxs93(Fragment39, { children: [
|
|
21244
21394
|
bridgeStep === "sender-selector" && /* @__PURE__ */ jsx101(SenderSelector, { directWalletProfile }),
|
|
21245
21395
|
bridgeStep === "select" && /* @__PURE__ */ jsx101(
|
|
21246
21396
|
SelectStep,
|
|
@@ -21281,14 +21431,14 @@ var init_HyperlaneBridge = __esm({
|
|
|
21281
21431
|
});
|
|
21282
21432
|
|
|
21283
21433
|
// src/internal/components/SendMenu/hyperbridge/components/HistorySwitch.tsx
|
|
21284
|
-
import { useRef as
|
|
21434
|
+
import { useRef as useRef20 } from "react";
|
|
21285
21435
|
import { jsx as jsx102 } from "react/jsx-runtime";
|
|
21286
21436
|
function BridgeHistorySwitch(props) {
|
|
21287
21437
|
const { disabled } = props;
|
|
21288
21438
|
const selectorFlow = useFlowSelectorStore((st) => st.flow);
|
|
21289
21439
|
const isUiLocked = useFlowSelectorStore((st) => st.isUiLocked);
|
|
21290
21440
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
21291
|
-
const lastBridgeStepRef =
|
|
21441
|
+
const lastBridgeStepRef = useRef20(null);
|
|
21292
21442
|
if (selectorFlow !== "bridge" || bridgeStep === "confirm" || bridgeStep === "success" || bridgeStep === "sender-selector" || bridgeStep === "select-token" || bridgeStep === "tx-history-details") {
|
|
21293
21443
|
return null;
|
|
21294
21444
|
}
|
|
@@ -21390,7 +21540,7 @@ var init_useErc3643Compliance = __esm({
|
|
|
21390
21540
|
|
|
21391
21541
|
// src/hooks/useNicknameResolve.ts
|
|
21392
21542
|
import { useQuery as useQuery20 } from "@tanstack/react-query";
|
|
21393
|
-
import { useEffect as
|
|
21543
|
+
import { useEffect as useEffect43, useMemo as useMemo14, useState as useState25 } from "react";
|
|
21394
21544
|
function looksLikeNickname(input) {
|
|
21395
21545
|
if (!input) return false;
|
|
21396
21546
|
if (input.startsWith("0x")) return false;
|
|
@@ -21400,11 +21550,11 @@ function looksLikeNickname(input) {
|
|
|
21400
21550
|
}
|
|
21401
21551
|
function useNicknameResolve(input, options) {
|
|
21402
21552
|
const { enabled = true, chainId } = options;
|
|
21403
|
-
const [debouncedInput, setDebouncedInput] =
|
|
21404
|
-
const [isDebouncing, setIsDebouncing] =
|
|
21553
|
+
const [debouncedInput, setDebouncedInput] = useState25("");
|
|
21554
|
+
const [isDebouncing, setIsDebouncing] = useState25(false);
|
|
21405
21555
|
const normalized = normalizeNickname(input);
|
|
21406
21556
|
const isNicknameInput = looksLikeNickname(input) && normalized.length >= 3;
|
|
21407
|
-
|
|
21557
|
+
useEffect43(() => {
|
|
21408
21558
|
if (!isNicknameInput || !enabled) {
|
|
21409
21559
|
setDebouncedInput("");
|
|
21410
21560
|
setIsDebouncing(false);
|
|
@@ -21464,15 +21614,15 @@ var init_useNicknameResolve = __esm({
|
|
|
21464
21614
|
});
|
|
21465
21615
|
|
|
21466
21616
|
// src/hooks/useSendTransaction.ts
|
|
21467
|
-
import { useCallback as
|
|
21617
|
+
import { useCallback as useCallback29, useState as useState26 } from "react";
|
|
21468
21618
|
import { encodeFunctionData as encodeFunctionData2, isAddress, parseEther as parseEther2, parseUnits } from "viem";
|
|
21469
21619
|
function useSendTransaction() {
|
|
21470
21620
|
const session = useSession((st) => st.session);
|
|
21471
21621
|
const address = useSession((st) => st.address);
|
|
21472
|
-
const [isLoading, setIsLoading] =
|
|
21473
|
-
const [error, setError] =
|
|
21474
|
-
const [userOpHash, setUserOpHash] =
|
|
21475
|
-
const sendTransaction =
|
|
21622
|
+
const [isLoading, setIsLoading] = useState26(false);
|
|
21623
|
+
const [error, setError] = useState26(null);
|
|
21624
|
+
const [userOpHash, setUserOpHash] = useState26(null);
|
|
21625
|
+
const sendTransaction = useCallback29(
|
|
21476
21626
|
async (params) => {
|
|
21477
21627
|
if (!session || !address) {
|
|
21478
21628
|
setError("No active session");
|
|
@@ -21569,7 +21719,7 @@ function useSendTransaction() {
|
|
|
21569
21719
|
},
|
|
21570
21720
|
[session, address]
|
|
21571
21721
|
);
|
|
21572
|
-
const reset =
|
|
21722
|
+
const reset = useCallback29(() => {
|
|
21573
21723
|
setError(null);
|
|
21574
21724
|
setUserOpHash(null);
|
|
21575
21725
|
setIsLoading(false);
|
|
@@ -21724,10 +21874,10 @@ var init_AssetInputIcon = __esm({
|
|
|
21724
21874
|
|
|
21725
21875
|
// src/internal/components/SendMenu/send/components/NftDisplayCard.tsx
|
|
21726
21876
|
import { Image as ImageIcon2, Sparkles as Sparkles2 } from "lucide-react";
|
|
21727
|
-
import { useState as
|
|
21877
|
+
import { useState as useState27 } from "react";
|
|
21728
21878
|
import { jsx as jsx104, jsxs as jsxs95 } from "react/jsx-runtime";
|
|
21729
21879
|
function NftDisplayCard({ asset }) {
|
|
21730
|
-
const [imageError, setImageError] =
|
|
21880
|
+
const [imageError, setImageError] = useState27(false);
|
|
21731
21881
|
const nftImage = asset.image || asset.nftMetadata?.image;
|
|
21732
21882
|
return /* @__PURE__ */ jsxs95("div", { className: "flex items-center gap-3 p-3 rounded-[var(--ui-kit-el-bdrs)] bg-[var(--ui-kit-bg-secondary)]", children: [
|
|
21733
21883
|
nftImage && !imageError ? /* @__PURE__ */ jsx104(
|
|
@@ -21761,12 +21911,12 @@ var init_NftDisplayCard = __esm({
|
|
|
21761
21911
|
});
|
|
21762
21912
|
|
|
21763
21913
|
// src/internal/components/SendMenu/send/useSendStore.ts
|
|
21764
|
-
import { create as
|
|
21914
|
+
import { create as create14 } from "zustand";
|
|
21765
21915
|
var useSendStore;
|
|
21766
21916
|
var init_useSendStore = __esm({
|
|
21767
21917
|
"src/internal/components/SendMenu/send/useSendStore.ts"() {
|
|
21768
21918
|
init_useFlowSelector();
|
|
21769
|
-
useSendStore =
|
|
21919
|
+
useSendStore = create14((set) => ({
|
|
21770
21920
|
recipient: "",
|
|
21771
21921
|
//
|
|
21772
21922
|
amount: "",
|
|
@@ -21801,7 +21951,7 @@ var init_useSendStore = __esm({
|
|
|
21801
21951
|
|
|
21802
21952
|
// src/internal/components/SendMenu/send/components/AssetList.tsx
|
|
21803
21953
|
import { formatUnits as formatUnits9 } from "viem";
|
|
21804
|
-
import { Fragment as
|
|
21954
|
+
import { Fragment as Fragment40, jsx as jsx105, jsxs as jsxs96 } from "react/jsx-runtime";
|
|
21805
21955
|
function getAssetBalance3(asset) {
|
|
21806
21956
|
if (isNftAsset3(asset)) return "1";
|
|
21807
21957
|
const balance = Number(formatUnits9(BigInt(asset?.balance || "0"), asset?.decimals || 18));
|
|
@@ -21838,13 +21988,13 @@ function AssetListItem(props) {
|
|
|
21838
21988
|
" \xB7 ",
|
|
21839
21989
|
truncateMiddle(asset.address, 6, 4)
|
|
21840
21990
|
] }),
|
|
21841
|
-
/* @__PURE__ */ jsx105("span", { className: "block text-lg font-bold", children: isNft ? /* @__PURE__ */ jsxs96(
|
|
21991
|
+
/* @__PURE__ */ jsx105("span", { className: "block text-lg font-bold", children: isNft ? /* @__PURE__ */ jsxs96(Fragment40, { children: [
|
|
21842
21992
|
asset.symbol,
|
|
21843
21993
|
asset.tokenId && /* @__PURE__ */ jsxs96("span", { className: "ml-1", children: [
|
|
21844
21994
|
"#",
|
|
21845
21995
|
asset.tokenId.length > 6 ? `${asset.tokenId.slice(0, 4)}...` : asset.tokenId
|
|
21846
21996
|
] })
|
|
21847
|
-
] }) : /* @__PURE__ */ jsxs96(
|
|
21997
|
+
] }) : /* @__PURE__ */ jsxs96(Fragment40, { children: [
|
|
21848
21998
|
BALANCE_PREFIXES[asset.symbol] || null,
|
|
21849
21999
|
/* @__PURE__ */ jsx105("span", { children: getAssetBalance3(asset) }),
|
|
21850
22000
|
" ",
|
|
@@ -21869,20 +22019,20 @@ function AssetList(props) {
|
|
|
21869
22019
|
const tokenAssets = transferableAssets.filter((a) => a.type === "erc20");
|
|
21870
22020
|
const securityAssets = transferableAssets.filter((a) => a.type === "erc3643");
|
|
21871
22021
|
const nftAssets = transferableAssets.filter((a) => a.type === "erc721" || a.type === "erc1155");
|
|
21872
|
-
return /* @__PURE__ */ jsxs96(
|
|
21873
|
-
nativeAssets.length > 0 && /* @__PURE__ */ jsxs96(
|
|
22022
|
+
return /* @__PURE__ */ jsxs96(Fragment40, { children: [
|
|
22023
|
+
nativeAssets.length > 0 && /* @__PURE__ */ jsxs96(Fragment40, { children: [
|
|
21874
22024
|
/* @__PURE__ */ jsx105("div", { className: "text-[10px] text-[var(--ui-kit-fg-muted)] uppercase", children: "Crypto" }),
|
|
21875
22025
|
nativeAssets.map((asset) => /* @__PURE__ */ jsx105(AssetListItem, { asset }, `native-${asset.symbol}`))
|
|
21876
22026
|
] }),
|
|
21877
|
-
tokenAssets.length > 0 && /* @__PURE__ */ jsxs96(
|
|
22027
|
+
tokenAssets.length > 0 && /* @__PURE__ */ jsxs96(Fragment40, { children: [
|
|
21878
22028
|
/* @__PURE__ */ jsx105("div", { className: "text-[10px] text-[var(--ui-kit-fg-muted)] uppercase", children: "Tokens" }),
|
|
21879
22029
|
tokenAssets.map((asset) => /* @__PURE__ */ jsx105(AssetListItem, { asset }, `token-${asset.address}`))
|
|
21880
22030
|
] }),
|
|
21881
|
-
securityAssets.length > 0 && /* @__PURE__ */ jsxs96(
|
|
22031
|
+
securityAssets.length > 0 && /* @__PURE__ */ jsxs96(Fragment40, { children: [
|
|
21882
22032
|
/* @__PURE__ */ jsx105("div", { className: "text-[10px] text-[var(--ui-kit-fg-muted)] uppercase", children: "Security Tokens" }),
|
|
21883
22033
|
securityAssets.map((asset) => /* @__PURE__ */ jsx105(AssetListItem, { asset }, `security-${asset.address}`))
|
|
21884
22034
|
] }),
|
|
21885
|
-
nftAssets.length > 0 && /* @__PURE__ */ jsxs96(
|
|
22035
|
+
nftAssets.length > 0 && /* @__PURE__ */ jsxs96(Fragment40, { children: [
|
|
21886
22036
|
/* @__PURE__ */ jsx105("div", { className: "text-[10px] text-[var(--ui-kit-fg-muted)] uppercase", children: "NFTs" }),
|
|
21887
22037
|
nftAssets.map((asset) => /* @__PURE__ */ jsx105(AssetListItem, { asset }, `nft-${asset.address}-${asset.tokenId}`))
|
|
21888
22038
|
] }),
|
|
@@ -21903,7 +22053,7 @@ var init_AssetList = __esm({
|
|
|
21903
22053
|
|
|
21904
22054
|
// src/internal/components/SendMenu/send/components/NicknameData.tsx
|
|
21905
22055
|
import { AtSign, CheckCircle2 as CheckCircle24, ShieldAlert, ShieldCheck as ShieldCheck2 } from "lucide-react";
|
|
21906
|
-
import { useEffect as
|
|
22056
|
+
import { useEffect as useEffect44 } from "react";
|
|
21907
22057
|
import { jsx as jsx106, jsxs as jsxs97 } from "react/jsx-runtime";
|
|
21908
22058
|
function NicknameData(props) {
|
|
21909
22059
|
const { resolvedNicknameData, isNicknameInput } = props;
|
|
@@ -21916,11 +22066,11 @@ function NicknameData(props) {
|
|
|
21916
22066
|
isWalletNotSetup,
|
|
21917
22067
|
isFrozen
|
|
21918
22068
|
} = resolvedNicknameData;
|
|
21919
|
-
|
|
22069
|
+
useEffect44(() => {
|
|
21920
22070
|
if (!resolvedNicknameData?.data?.fingerprint || !isNicknameInput) return;
|
|
21921
22071
|
useFlowSelectorStore.getState().setRenderKey(`nickname-resolved-${Date.now()}`);
|
|
21922
22072
|
}, [resolvedNicknameData, isNicknameInput]);
|
|
21923
|
-
|
|
22073
|
+
useEffect44(() => {
|
|
21924
22074
|
if (isResolving) return;
|
|
21925
22075
|
let errMessage = null;
|
|
21926
22076
|
switch (true) {
|
|
@@ -22081,9 +22231,9 @@ var init_useTokenBalance = __esm({
|
|
|
22081
22231
|
});
|
|
22082
22232
|
|
|
22083
22233
|
// src/internal/components/SendMenu/send/sendSteps/InputSendStep.tsx
|
|
22084
|
-
import { AlertCircle as
|
|
22234
|
+
import { AlertCircle as AlertCircle4, AtSign as AtSign2, CheckCircle2 as CheckCircle25, Loader as Loader21, Wallet2 as Wallet24 } from "lucide-react";
|
|
22085
22235
|
import { formatUnits as formatUnits11, isAddress as isAddress2 } from "viem";
|
|
22086
|
-
import { Fragment as
|
|
22236
|
+
import { Fragment as Fragment41, jsx as jsx107, jsxs as jsxs98 } from "react/jsx-runtime";
|
|
22087
22237
|
function InputSendStep(props) {
|
|
22088
22238
|
const { erc3643Compliance, isNicknameInput, resolvedNicknameData, isAssetsLoading } = props;
|
|
22089
22239
|
const address = useSession((st) => st.address);
|
|
@@ -22182,7 +22332,7 @@ function InputSendStep(props) {
|
|
|
22182
22332
|
setError(null);
|
|
22183
22333
|
return true;
|
|
22184
22334
|
};
|
|
22185
|
-
return /* @__PURE__ */ jsxs98(
|
|
22335
|
+
return /* @__PURE__ */ jsxs98(Fragment41, { children: [
|
|
22186
22336
|
/* @__PURE__ */ jsx107("span", { className: "block text-[10px] text-[var(--ui-kit-fg-muted)]", children: t("passport:sendMenu.selectAsset") }),
|
|
22187
22337
|
/* @__PURE__ */ jsxs98(
|
|
22188
22338
|
Button,
|
|
@@ -22246,14 +22396,14 @@ function InputSendStep(props) {
|
|
|
22246
22396
|
{
|
|
22247
22397
|
type: isComplianceLoading ? "info" : erc3643CanTransfer ? "success" : "error",
|
|
22248
22398
|
className: "flex gap-[var(--ui-kit-gap)]",
|
|
22249
|
-
children: isComplianceLoading ? /* @__PURE__ */ jsxs98(
|
|
22399
|
+
children: isComplianceLoading ? /* @__PURE__ */ jsxs98(Fragment41, { children: [
|
|
22250
22400
|
/* @__PURE__ */ jsx107(Loader21, { className: "h-4 w-4 animate-spin" }),
|
|
22251
22401
|
/* @__PURE__ */ jsx107("span", { children: "Checking compliance..." })
|
|
22252
|
-
] }) : erc3643CanTransfer ? /* @__PURE__ */ jsxs98(
|
|
22402
|
+
] }) : erc3643CanTransfer ? /* @__PURE__ */ jsxs98(Fragment41, { children: [
|
|
22253
22403
|
/* @__PURE__ */ jsx107(CheckCircle25, { className: "h-4 w-4" }),
|
|
22254
22404
|
/* @__PURE__ */ jsx107("span", { children: "Transfer compliant" })
|
|
22255
|
-
] }) : /* @__PURE__ */ jsxs98(
|
|
22256
|
-
/* @__PURE__ */ jsx107(
|
|
22405
|
+
] }) : /* @__PURE__ */ jsxs98(Fragment41, { children: [
|
|
22406
|
+
/* @__PURE__ */ jsx107(AlertCircle4, { className: "h-4 w-4" }),
|
|
22257
22407
|
/* @__PURE__ */ jsx107("span", { children: complianceError || "Transfer not allowed" })
|
|
22258
22408
|
] })
|
|
22259
22409
|
}
|
|
@@ -22292,7 +22442,7 @@ var init_InputSendStep = __esm({
|
|
|
22292
22442
|
// src/internal/components/SendMenu/send/sendSteps/ConfirmSendStep.tsx
|
|
22293
22443
|
import { useMutation as useMutation21 } from "@tanstack/react-query";
|
|
22294
22444
|
import { AlertTriangle as AlertTriangle5, AtSign as AtSign3, Loader as Loader27, Shield as Shield2, ShieldAlert as ShieldAlert2, ShieldCheck as ShieldCheck3 } from "lucide-react";
|
|
22295
|
-
import { Fragment as
|
|
22445
|
+
import { Fragment as Fragment42, jsx as jsx108, jsxs as jsxs99 } from "react/jsx-runtime";
|
|
22296
22446
|
function ConfirmSendStep(props) {
|
|
22297
22447
|
const { sendTransaction, erc3643Compliance, isNicknameInput, resolvedNicknameData } = props;
|
|
22298
22448
|
const { t } = useT();
|
|
@@ -22329,7 +22479,7 @@ function ConfirmSendStep(props) {
|
|
|
22329
22479
|
useFlowSelectorStore.getState().setError(error?.message || "Transaction failed");
|
|
22330
22480
|
}
|
|
22331
22481
|
});
|
|
22332
|
-
return /* @__PURE__ */ jsxs99(
|
|
22482
|
+
return /* @__PURE__ */ jsxs99(Fragment42, { children: [
|
|
22333
22483
|
isNicknameInput && isFrozen && /* @__PURE__ */ jsxs99(Highlight, { type: "warning", className: "flex gap-[var(--ui-kit-gap)]", children: [
|
|
22334
22484
|
/* @__PURE__ */ jsx108(AlertTriangle5, { className: "h-4 w-4" }),
|
|
22335
22485
|
/* @__PURE__ */ jsx108("span", { children: "This handle is frozen. Proceed with caution." })
|
|
@@ -22349,7 +22499,7 @@ function ConfirmSendStep(props) {
|
|
|
22349
22499
|
selectedAsset.symbol
|
|
22350
22500
|
] })
|
|
22351
22501
|
] }),
|
|
22352
|
-
/* @__PURE__ */ jsx108(Highlight, { type: "info", className: "flex flex-col gap-[var(--ui-kit-gap)]", children: isNicknameInput && nicknameData ? /* @__PURE__ */ jsxs99(
|
|
22502
|
+
/* @__PURE__ */ jsx108(Highlight, { type: "info", className: "flex flex-col gap-[var(--ui-kit-gap)]", children: isNicknameInput && nicknameData ? /* @__PURE__ */ jsxs99(Fragment42, { children: [
|
|
22353
22503
|
/* @__PURE__ */ jsxs99("div", { className: "flex items-start gap-[var(--ui-kit-gap)]", children: [
|
|
22354
22504
|
nicknameData.avatarSvg ? /* @__PURE__ */ jsx108(
|
|
22355
22505
|
"img",
|
|
@@ -22407,7 +22557,7 @@ function ConfirmSendStep(props) {
|
|
|
22407
22557
|
/* @__PURE__ */ jsx108("span", { className: "text-sm font-bold", children: chainConfig.name })
|
|
22408
22558
|
] })
|
|
22409
22559
|
] })
|
|
22410
|
-
] }) : /* @__PURE__ */ jsxs99(
|
|
22560
|
+
] }) : /* @__PURE__ */ jsxs99(Fragment42, { children: [
|
|
22411
22561
|
/* @__PURE__ */ jsx108("h3", { className: "font-medium mb-3 text-[var(--ui-kit-fg)]", children: "Transaction Details" }),
|
|
22412
22562
|
/* @__PURE__ */ jsxs99("div", { className: "space-y-2 text-sm text-[var(--ui-kit-fg)]", children: [
|
|
22413
22563
|
/* @__PURE__ */ jsxs99("div", { className: "flex justify-between", children: [
|
|
@@ -22416,7 +22566,7 @@ function ConfirmSendStep(props) {
|
|
|
22416
22566
|
] }),
|
|
22417
22567
|
isNft ? (
|
|
22418
22568
|
// NFT details
|
|
22419
|
-
/* @__PURE__ */ jsx108(
|
|
22569
|
+
/* @__PURE__ */ jsx108(Fragment42, { children: /* @__PURE__ */ jsxs99("div", { className: "flex justify-between items-start", children: [
|
|
22420
22570
|
/* @__PURE__ */ jsx108("span", { className: "text-[var(--ui-kit-fg-muted)]", children: "NFT:" }),
|
|
22421
22571
|
/* @__PURE__ */ jsxs99("div", { className: "text-right", children: [
|
|
22422
22572
|
/* @__PURE__ */ jsx108("span", { className: "font-semibold block", children: selectedAsset.nftMetadata?.name || selectedAsset.name }),
|
|
@@ -22482,9 +22632,9 @@ var init_sendSteps = __esm({
|
|
|
22482
22632
|
|
|
22483
22633
|
// src/internal/components/SendMenu/send/SendMenu.tsx
|
|
22484
22634
|
import { CheckCircle2 as CheckCircle26, Loader as Loader28 } from "lucide-react";
|
|
22485
|
-
import { useEffect as
|
|
22635
|
+
import { useEffect as useEffect45, useMemo as useMemo15 } from "react";
|
|
22486
22636
|
import { parseUnits as parseUnits2 } from "viem";
|
|
22487
|
-
import { Fragment as
|
|
22637
|
+
import { Fragment as Fragment43, jsx as jsx109, jsxs as jsxs100 } from "react/jsx-runtime";
|
|
22488
22638
|
function SendMenu() {
|
|
22489
22639
|
const address = useSession((st) => st.address);
|
|
22490
22640
|
const activeChainId = useSession((st) => st.activeChainId);
|
|
@@ -22503,10 +22653,10 @@ function SendMenu() {
|
|
|
22503
22653
|
userOpHash,
|
|
22504
22654
|
reset
|
|
22505
22655
|
} = useSendTransaction();
|
|
22506
|
-
|
|
22656
|
+
useEffect45(() => {
|
|
22507
22657
|
useFlowSelectorStore.getState().setIsUiLocked(isAssetsLoading || isTransactionPending);
|
|
22508
22658
|
}, [isAssetsLoading, isTransactionPending]);
|
|
22509
|
-
|
|
22659
|
+
useEffect45(() => {
|
|
22510
22660
|
useFlowSelectorStore.getState().setError(sendTransactionError || null);
|
|
22511
22661
|
}, [sendTransactionError]);
|
|
22512
22662
|
const {
|
|
@@ -22521,7 +22671,7 @@ function SendMenu() {
|
|
|
22521
22671
|
} = useSendStore();
|
|
22522
22672
|
const isNft = isNftAsset3(selectedAsset);
|
|
22523
22673
|
const isSecurity = isSecurityToken2(selectedAsset);
|
|
22524
|
-
|
|
22674
|
+
useEffect45(() => {
|
|
22525
22675
|
const shouldDefaultAsset = assets.length > 0 && !selectedAsset;
|
|
22526
22676
|
if (!shouldDefaultAsset) return;
|
|
22527
22677
|
const chainNativeCurrency = useSession.getState().chainConfig?.nativeCurrency;
|
|
@@ -22531,7 +22681,7 @@ function SendMenu() {
|
|
|
22531
22681
|
if (isBalance(erc20)) return setSelectedAsset(erc20);
|
|
22532
22682
|
setSelectedAsset(assets[0]);
|
|
22533
22683
|
}, [assets, selectedAsset]);
|
|
22534
|
-
|
|
22684
|
+
useEffect45(
|
|
22535
22685
|
() => () => {
|
|
22536
22686
|
setSelectedAsset(null);
|
|
22537
22687
|
setRecipient("");
|
|
@@ -22559,7 +22709,7 @@ function SendMenu() {
|
|
|
22559
22709
|
enabled: isSecurity && !!effectiveAddress && !!complianceAmount,
|
|
22560
22710
|
chainId: activeChainId
|
|
22561
22711
|
});
|
|
22562
|
-
|
|
22712
|
+
useEffect45(() => {
|
|
22563
22713
|
const updateMenuTitle = useFlowSelectorStore.getState().setMenuTitle;
|
|
22564
22714
|
switch (true) {
|
|
22565
22715
|
case txStep === "select-asset":
|
|
@@ -22582,7 +22732,7 @@ function SendMenu() {
|
|
|
22582
22732
|
break;
|
|
22583
22733
|
}
|
|
22584
22734
|
}, [txStep, selectedAsset, isNft, t]);
|
|
22585
|
-
return /* @__PURE__ */ jsxs100(
|
|
22735
|
+
return /* @__PURE__ */ jsxs100(Fragment43, { children: [
|
|
22586
22736
|
txStep === "select-asset" && /* @__PURE__ */ jsx109(AssetList, { assets }),
|
|
22587
22737
|
txStep === "input" && /* @__PURE__ */ jsx109(
|
|
22588
22738
|
InputSendStep,
|
|
@@ -22609,7 +22759,7 @@ function SendMenu() {
|
|
|
22609
22759
|
/* @__PURE__ */ jsx109("span", { children: t("passport:sendMenu.pendingStepMsg") })
|
|
22610
22760
|
] })
|
|
22611
22761
|
] }),
|
|
22612
|
-
txStep === "success" && userOpHash && /* @__PURE__ */ jsxs100(
|
|
22762
|
+
txStep === "success" && userOpHash && /* @__PURE__ */ jsxs100(Fragment43, { children: [
|
|
22613
22763
|
/* @__PURE__ */ jsxs100(Highlight, { type: "success", className: "flex gap-[var(--ui-kit-gap)]", children: [
|
|
22614
22764
|
/* @__PURE__ */ jsx109(CheckCircle26, { className: "h-4 w-4" }),
|
|
22615
22765
|
/* @__PURE__ */ jsxs100("span", { className: "flex-1", children: [
|
|
@@ -22657,8 +22807,8 @@ var init_send = __esm({
|
|
|
22657
22807
|
});
|
|
22658
22808
|
|
|
22659
22809
|
// src/internal/components/SendMenu/SendFlowSelector.tsx
|
|
22660
|
-
import { ArrowLeft as ArrowLeft19, ArrowRightIcon as ArrowRightIcon2, ArrowRightLeftIcon as ArrowRightLeftIcon2, InfoIcon as
|
|
22661
|
-
import { useEffect as
|
|
22810
|
+
import { ArrowLeft as ArrowLeft19, ArrowRightIcon as ArrowRightIcon2, ArrowRightLeftIcon as ArrowRightLeftIcon2, InfoIcon as InfoIcon6 } from "lucide-react";
|
|
22811
|
+
import { useEffect as useEffect46 } from "react";
|
|
22662
22812
|
import { jsx as jsx110, jsxs as jsxs101 } from "react/jsx-runtime";
|
|
22663
22813
|
function SelectorFlowButtons() {
|
|
22664
22814
|
const { t } = useT();
|
|
@@ -22721,7 +22871,7 @@ function SendFlowSelector() {
|
|
|
22721
22871
|
const error = useFlowSelectorStore((st) => st.error);
|
|
22722
22872
|
const menuTitle = useFlowSelectorStore((st) => st.menuTitle);
|
|
22723
22873
|
const selectorFlow = useFlowSelectorStore((st) => st.flow);
|
|
22724
|
-
|
|
22874
|
+
useEffect46(
|
|
22725
22875
|
() => () => {
|
|
22726
22876
|
useFlowSelectorStore.getState().setError(null);
|
|
22727
22877
|
},
|
|
@@ -22779,7 +22929,7 @@ function SendFlowSelector() {
|
|
|
22779
22929
|
SELECTOR_FLOW[selectorFlow],
|
|
22780
22930
|
error && /* @__PURE__ */ jsxs101(Highlight, { type: "error", className: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: [
|
|
22781
22931
|
/* @__PURE__ */ jsxs101("div", { className: "w-full flex gap-[var(--ui-kit-gap)]", children: [
|
|
22782
|
-
/* @__PURE__ */ jsx110(
|
|
22932
|
+
/* @__PURE__ */ jsx110(InfoIcon6, { className: "h-4 w-4 flex-none" }),
|
|
22783
22933
|
/* @__PURE__ */ jsx110("span", { children: error })
|
|
22784
22934
|
] }),
|
|
22785
22935
|
/* @__PURE__ */ jsx110(
|
|
@@ -22887,7 +23037,7 @@ var init_constants6 = __esm({
|
|
|
22887
23037
|
// src/internal/components/SettingsMenu/SettingsMenu.tsx
|
|
22888
23038
|
import { useQuery as useQuery22 } from "@tanstack/react-query";
|
|
22889
23039
|
import { ArrowLeft as ArrowLeft20, HardDrive as HardDrive3 } from "lucide-react";
|
|
22890
|
-
import { useEffect as
|
|
23040
|
+
import { useEffect as useEffect47 } from "react";
|
|
22891
23041
|
import { jsx as jsx111, jsxs as jsxs102 } from "react/jsx-runtime";
|
|
22892
23042
|
function useSettingsButtons() {
|
|
22893
23043
|
const config = useProviderConfig().config;
|
|
@@ -22906,7 +23056,7 @@ function useSettingsButtons() {
|
|
|
22906
23056
|
if (proMode) {
|
|
22907
23057
|
settingsButtons.push({ id: "devices" /* DEVICES */, name: "Guardians", Icon: HardDrive3 });
|
|
22908
23058
|
}
|
|
22909
|
-
|
|
23059
|
+
useEffect47(() => {
|
|
22910
23060
|
const cssvEl = document.querySelector(".embarkai-ui-scope");
|
|
22911
23061
|
if (!cssvEl || !window?.getComputedStyle) {
|
|
22912
23062
|
return;
|
|
@@ -23033,9 +23183,9 @@ var init_TermsOfService = __esm({
|
|
|
23033
23183
|
import {
|
|
23034
23184
|
ARBITRUM_SEPOLIA_CHAIN_ID as ARBITRUM_SEPOLIA_CHAIN_ID2,
|
|
23035
23185
|
BASE_SEPOLIA_CHAIN_ID as BASE_SEPOLIA_CHAIN_ID2,
|
|
23036
|
-
BSC_TESTNET_CHAIN_ID as
|
|
23186
|
+
BSC_TESTNET_CHAIN_ID as BSC_TESTNET_CHAIN_ID2,
|
|
23037
23187
|
LUMIA_MAINNET_CHAIN_ID as LUMIA_MAINNET_CHAIN_ID4,
|
|
23038
|
-
LUMIA_TESTNET_CHAIN_ID as
|
|
23188
|
+
LUMIA_TESTNET_CHAIN_ID as LUMIA_TESTNET_CHAIN_ID2,
|
|
23039
23189
|
SEPOLIA_CHAIN_ID as SEPOLIA_CHAIN_ID2
|
|
23040
23190
|
} from "@embarkai/core/read";
|
|
23041
23191
|
function isTransactionHistorySupported(chainId) {
|
|
@@ -23111,10 +23261,10 @@ var init_txUrls = __esm({
|
|
|
23111
23261
|
BASE_SEPOLIA_CHAIN_ID2
|
|
23112
23262
|
]);
|
|
23113
23263
|
UNSUPPORTED_HISTORY_CHAINS = /* @__PURE__ */ new Set([
|
|
23114
|
-
|
|
23264
|
+
BSC_TESTNET_CHAIN_ID2
|
|
23115
23265
|
]);
|
|
23116
23266
|
TX_HISTORY_URLS = {
|
|
23117
|
-
[
|
|
23267
|
+
[LUMIA_TESTNET_CHAIN_ID2]: (p) => {
|
|
23118
23268
|
const result = getBlockscoutHistoryUrls(p);
|
|
23119
23269
|
return {
|
|
23120
23270
|
transactionsUrl: result.transactionsUrl,
|
|
@@ -23714,7 +23864,7 @@ var init_utils10 = __esm({
|
|
|
23714
23864
|
|
|
23715
23865
|
// src/internal/components/TransactionsMenu/TransactionsGroup.tsx
|
|
23716
23866
|
import { ChevronDown, ChevronLeft as ChevronLeft2, ChevronRight as ChevronRight5, ChevronUp, Copy as Copy3 } from "lucide-react";
|
|
23717
|
-
import { Fragment as
|
|
23867
|
+
import { Fragment as Fragment44, jsx as jsx113, jsxs as jsxs104 } from "react/jsx-runtime";
|
|
23718
23868
|
function InternalTransaction({ internal, assetSymbol, assetDecimals }) {
|
|
23719
23869
|
const internalSymbol = internal.assetSymbol || assetSymbol;
|
|
23720
23870
|
const internalDecimals = internal.decimals ?? assetDecimals;
|
|
@@ -23789,7 +23939,7 @@ function TransactionsGroup(props) {
|
|
|
23789
23939
|
}
|
|
23790
23940
|
) })
|
|
23791
23941
|
] }),
|
|
23792
|
-
internalsToRender.length > 0 && /* @__PURE__ */ jsxs104(
|
|
23942
|
+
internalsToRender.length > 0 && /* @__PURE__ */ jsxs104(Fragment44, { children: [
|
|
23793
23943
|
/* @__PURE__ */ jsx113("div", { className: "w-full flex items-center h-4", children: /* @__PURE__ */ jsx113("div", { style: { borderTop: "1px solid var(--ui-kit-bd)" }, className: "flex-1" }) }),
|
|
23794
23944
|
/* @__PURE__ */ jsxs104(
|
|
23795
23945
|
"div",
|
|
@@ -23845,7 +23995,7 @@ var init_TransactionsGroup = __esm({
|
|
|
23845
23995
|
// src/internal/components/TransactionsMenu/TransactionsMenu.tsx
|
|
23846
23996
|
import { useQuery as useQuery23, useQueryClient as useQueryClient25 } from "@tanstack/react-query";
|
|
23847
23997
|
import { ArrowLeft as ArrowLeft22, Loader as Loader29, RefreshCw as RefreshCw3, XCircle } from "lucide-react";
|
|
23848
|
-
import { useCallback as
|
|
23998
|
+
import { useCallback as useCallback30, useState as useState28 } from "react";
|
|
23849
23999
|
import { jsx as jsx114, jsxs as jsxs105 } from "react/jsx-runtime";
|
|
23850
24000
|
function TransactionsMenu() {
|
|
23851
24001
|
const qc = useQueryClient25();
|
|
@@ -23854,7 +24004,7 @@ function TransactionsMenu() {
|
|
|
23854
24004
|
const { t } = useT();
|
|
23855
24005
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
23856
24006
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
23857
|
-
const [expandedGroups, setExpandedGroups] =
|
|
24007
|
+
const [expandedGroups, setExpandedGroups] = useState28({});
|
|
23858
24008
|
const historySupported = isTransactionHistorySupported(chainConfig?.id);
|
|
23859
24009
|
const {
|
|
23860
24010
|
data: txHistoryGroups = [],
|
|
@@ -23867,7 +24017,7 @@ function TransactionsMenu() {
|
|
|
23867
24017
|
queryKey: [TRANSACTIONS_HISTORY_QUERY_KEY, chainConfig.id, address],
|
|
23868
24018
|
queryFn: () => getTransactionsListQuery({ address, chainConfig })
|
|
23869
24019
|
});
|
|
23870
|
-
const refreshTxHistory =
|
|
24020
|
+
const refreshTxHistory = useCallback30(
|
|
23871
24021
|
() => qc.invalidateQueries({ queryKey: [TRANSACTIONS_HISTORY_QUERY_KEY, chainConfig.id, address] }),
|
|
23872
24022
|
[qc, chainConfig.id, address]
|
|
23873
24023
|
);
|
|
@@ -23943,7 +24093,7 @@ var PAGE_MAP;
|
|
|
23943
24093
|
var init_PageMap = __esm({
|
|
23944
24094
|
"src/internal/components/PageMap.tsx"() {
|
|
23945
24095
|
init_AuthMenu2();
|
|
23946
|
-
|
|
24096
|
+
init_BuyMenu2();
|
|
23947
24097
|
init_ChainsMenu2();
|
|
23948
24098
|
init_DeviceLinkScreen();
|
|
23949
24099
|
init_DeviceManageScreen();
|
|
@@ -24106,7 +24256,7 @@ var init_PageMap = __esm({
|
|
|
24106
24256
|
});
|
|
24107
24257
|
|
|
24108
24258
|
// src/internal/hooks/usePageMapper.tsx
|
|
24109
|
-
import { useCallback as
|
|
24259
|
+
import { useCallback as useCallback31, useEffect as useEffect48 } from "react";
|
|
24110
24260
|
import { jsx as jsx115 } from "react/jsx-runtime";
|
|
24111
24261
|
function usePageMapper() {
|
|
24112
24262
|
const page = useLayoutDataStore((st) => st.page);
|
|
@@ -24118,7 +24268,7 @@ function usePageMapper() {
|
|
|
24118
24268
|
setIsDialogOpen,
|
|
24119
24269
|
setIsDialogClosing
|
|
24120
24270
|
} = useLayoutStore();
|
|
24121
|
-
const closeDialog =
|
|
24271
|
+
const closeDialog = useCallback31(() => {
|
|
24122
24272
|
setIsDialogClosing(true);
|
|
24123
24273
|
setTimeout(() => {
|
|
24124
24274
|
setDialogContent(null);
|
|
@@ -24129,7 +24279,7 @@ function usePageMapper() {
|
|
|
24129
24279
|
setIsDialogOpen(false);
|
|
24130
24280
|
}, CLEAR_DIALOG_TIMEOUT);
|
|
24131
24281
|
}, [setDialogContent, setDialogDescription, setDialogTitle, setIsDialogForced, setIsDialogOpen, setIsDialogClosing]);
|
|
24132
|
-
const openDialog =
|
|
24282
|
+
const openDialog = useCallback31(
|
|
24133
24283
|
(pageItem) => {
|
|
24134
24284
|
const PageContentComponent = pageItem.component;
|
|
24135
24285
|
setDialogTitle(pageItem.title);
|
|
@@ -24139,7 +24289,7 @@ function usePageMapper() {
|
|
|
24139
24289
|
},
|
|
24140
24290
|
[setDialogContent, setDialogDescription, setDialogTitle, setIsDialogOpen]
|
|
24141
24291
|
);
|
|
24142
|
-
|
|
24292
|
+
useEffect48(() => {
|
|
24143
24293
|
if (page === null) return closeDialog();
|
|
24144
24294
|
const pageItem = PAGE_MAP[page];
|
|
24145
24295
|
if (!pageItem) {
|
|
@@ -24163,7 +24313,7 @@ var init_usePageMapper = __esm({
|
|
|
24163
24313
|
|
|
24164
24314
|
// src/internal/hooks/useSettingsNotifications.ts
|
|
24165
24315
|
import { useQuery as useQuery24 } from "@tanstack/react-query";
|
|
24166
|
-
import { useEffect as
|
|
24316
|
+
import { useEffect as useEffect49 } from "react";
|
|
24167
24317
|
function useSettingsNotifications() {
|
|
24168
24318
|
const address = useSession((st) => st.address);
|
|
24169
24319
|
const setSettingsNotifications = useLayoutDataStore((st) => st.setSettingsNotifications);
|
|
@@ -24175,14 +24325,14 @@ function useSettingsNotifications() {
|
|
|
24175
24325
|
queryKey: [QUERY_KEYS.userProfile, address],
|
|
24176
24326
|
queryFn: getUserProfile
|
|
24177
24327
|
});
|
|
24178
|
-
|
|
24328
|
+
useEffect49(() => {
|
|
24179
24329
|
const isKYCVerified = userProfile?.kycDetails?.kycStatus === "verified";
|
|
24180
24330
|
setSettingsNotifications({
|
|
24181
24331
|
...COMPLETE_KYC_PROGRESS,
|
|
24182
24332
|
status: isKYCVerified ? "resolved" : "active"
|
|
24183
24333
|
});
|
|
24184
24334
|
}, [userProfile, setSettingsNotifications]);
|
|
24185
|
-
|
|
24335
|
+
useEffect49(() => {
|
|
24186
24336
|
setSettingsNotifications({
|
|
24187
24337
|
...EMAIL_NOT_CONNECTED_NOTIFICATION,
|
|
24188
24338
|
status: hasEmail ? "resolved" : "active"
|
|
@@ -24215,7 +24365,7 @@ var init_package = __esm({
|
|
|
24215
24365
|
"package.json"() {
|
|
24216
24366
|
package_default = {
|
|
24217
24367
|
name: "@embarkai/ui-kit",
|
|
24218
|
-
version: "0.4.
|
|
24368
|
+
version: "0.4.58",
|
|
24219
24369
|
description: "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
|
|
24220
24370
|
type: "module",
|
|
24221
24371
|
main: "./dist/index.cjs",
|
|
@@ -24452,8 +24602,8 @@ var init_Footer2 = __esm({
|
|
|
24452
24602
|
// src/internal/components/Header/Header.tsx
|
|
24453
24603
|
import { useQuery as useQuery25 } from "@tanstack/react-query";
|
|
24454
24604
|
import { Copy as Copy4, Loader as Loader31 } from "lucide-react";
|
|
24455
|
-
import { useCallback as
|
|
24456
|
-
import { Fragment as
|
|
24605
|
+
import { useCallback as useCallback32, useRef as useRef21, useState as useState29 } from "react";
|
|
24606
|
+
import { Fragment as Fragment45, jsx as jsx117, jsxs as jsxs107 } from "react/jsx-runtime";
|
|
24457
24607
|
function formatAddress2(addr) {
|
|
24458
24608
|
if (!addr) return "";
|
|
24459
24609
|
return `${addr.slice(0, 10)}...${addr.slice(-4)}`;
|
|
@@ -24464,11 +24614,11 @@ function Header() {
|
|
|
24464
24614
|
const chainConfig = useSession((st) => st.chainConfig);
|
|
24465
24615
|
const { t } = useT();
|
|
24466
24616
|
const proMode = useProMode();
|
|
24467
|
-
const [proToast, setProToast] =
|
|
24468
|
-
const [copied, setCopied] =
|
|
24469
|
-
const clickCountRef =
|
|
24470
|
-
const clickTimerRef =
|
|
24471
|
-
const handleAvatarClick =
|
|
24617
|
+
const [proToast, setProToast] = useState29(false);
|
|
24618
|
+
const [copied, setCopied] = useState29(false);
|
|
24619
|
+
const clickCountRef = useRef21(0);
|
|
24620
|
+
const clickTimerRef = useRef21(null);
|
|
24621
|
+
const handleAvatarClick = useCallback32(() => {
|
|
24472
24622
|
clickCountRef.current += 1;
|
|
24473
24623
|
if (clickTimerRef.current) {
|
|
24474
24624
|
clearTimeout(clickTimerRef.current);
|
|
@@ -24520,7 +24670,7 @@ function Header() {
|
|
|
24520
24670
|
className: "flex-1 flex flex-col justify-center gap-1",
|
|
24521
24671
|
children: [
|
|
24522
24672
|
isProfileLoading && /* @__PURE__ */ jsx117(Loader31, { className: "w-4 h-4 animate-spin" }),
|
|
24523
|
-
!!address && !isProfileLoading && !!profile && /* @__PURE__ */ jsxs107(
|
|
24673
|
+
!!address && !isProfileLoading && !!profile && /* @__PURE__ */ jsxs107(Fragment45, { children: [
|
|
24524
24674
|
/* @__PURE__ */ jsxs107("div", { className: "w-full flex items-center gap-[var(--ui-kit-gap)]", children: [
|
|
24525
24675
|
/* @__PURE__ */ jsx117(
|
|
24526
24676
|
"span",
|
|
@@ -24770,7 +24920,7 @@ var init_visually_hidden = __esm({
|
|
|
24770
24920
|
|
|
24771
24921
|
// src/internal/components/Dialog/Dialog.tsx
|
|
24772
24922
|
import { AnimatePresence, motion } from "framer-motion";
|
|
24773
|
-
import { useEffect as
|
|
24923
|
+
import { useEffect as useEffect50 } from "react";
|
|
24774
24924
|
import { jsx as jsx120, jsxs as jsxs109 } from "react/jsx-runtime";
|
|
24775
24925
|
function Dialog2() {
|
|
24776
24926
|
const config = useProviderConfig().config;
|
|
@@ -24782,7 +24932,7 @@ function Dialog2() {
|
|
|
24782
24932
|
const isWalletLinking = useLayoutDataStore((st) => st.isWalletLinking);
|
|
24783
24933
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
24784
24934
|
const { colorMode, isDialogOpen, dialogTitle, dialogDescription, dialogContent, isDialogForced, setIsSettings } = useLayoutStore();
|
|
24785
|
-
|
|
24935
|
+
useEffect50(() => setIsSettings(!!session), [session, setIsSettings]);
|
|
24786
24936
|
usePageMapper();
|
|
24787
24937
|
useAutoConnect();
|
|
24788
24938
|
useBackupStatusChanges();
|
|
@@ -24848,7 +24998,7 @@ var init_Dialog2 = __esm({
|
|
|
24848
24998
|
});
|
|
24849
24999
|
|
|
24850
25000
|
// src/internal/components/TssManager.tsx
|
|
24851
|
-
import React26, { useCallback as
|
|
25001
|
+
import React26, { useCallback as useCallback33 } from "react";
|
|
24852
25002
|
var TssManagerWithRef;
|
|
24853
25003
|
var init_TssManager = __esm({
|
|
24854
25004
|
"src/internal/components/TssManager.tsx"() {
|
|
@@ -24863,7 +25013,7 @@ var init_TssManager = __esm({
|
|
|
24863
25013
|
const setStatus = useSession((st) => st.setStatus);
|
|
24864
25014
|
const setSession = useSession((st) => st.setSession);
|
|
24865
25015
|
const setAddress = useSession((st) => st.setAddress);
|
|
24866
|
-
const onSessionCreated =
|
|
25016
|
+
const onSessionCreated = useCallback33(
|
|
24867
25017
|
(session, address) => {
|
|
24868
25018
|
setSession(session);
|
|
24869
25019
|
setAddress(address);
|
|
@@ -24904,7 +25054,7 @@ var init_TssManager = __esm({
|
|
|
24904
25054
|
// src/internal/components/WalletConnectHandler.tsx
|
|
24905
25055
|
import { useConnectModal as useConnectModal2 } from "@rainbow-me/rainbowkit";
|
|
24906
25056
|
import { useMutation as useMutation23, useQueryClient as useQueryClient27 } from "@tanstack/react-query";
|
|
24907
|
-
import React27, { useCallback as
|
|
25057
|
+
import React27, { useCallback as useCallback34, useEffect as useEffect51 } from "react";
|
|
24908
25058
|
import { useAccount, useDisconnect as useDisconnect4, useSignMessage as useSignMessage2 } from "wagmi";
|
|
24909
25059
|
function WalletConnectHandler() {
|
|
24910
25060
|
const qc = useQueryClient27();
|
|
@@ -24927,7 +25077,7 @@ function WalletConnectHandler() {
|
|
|
24927
25077
|
const projectId = providerConfig?.projectId;
|
|
24928
25078
|
const setExternalWallet = useExternalWalletStore((st) => st.setExternalWallet);
|
|
24929
25079
|
const setPendingWalletLogin = useLayoutDataStore((st) => st.setPendingWalletLogin);
|
|
24930
|
-
const onLinkingComplete =
|
|
25080
|
+
const onLinkingComplete = useCallback34(
|
|
24931
25081
|
async (success) => {
|
|
24932
25082
|
setIsWalletLinking(false);
|
|
24933
25083
|
if (!success && !passportWalletAddress) {
|
|
@@ -24959,7 +25109,7 @@ function WalletConnectHandler() {
|
|
|
24959
25109
|
const [hasStartedLinking, setHasStartedLinking] = React27.useState(false);
|
|
24960
25110
|
const [modalWasOpened, setModalWasOpened] = React27.useState(false);
|
|
24961
25111
|
const [pendingModalOpen, setPendingModalOpen] = React27.useState(false);
|
|
24962
|
-
|
|
25112
|
+
useEffect51(() => {
|
|
24963
25113
|
if (isWalletLinking && !hasStartedLinking) {
|
|
24964
25114
|
console.log("[WalletConnectHandler] Starting wallet link flow:", {
|
|
24965
25115
|
isConnected,
|
|
@@ -24997,18 +25147,18 @@ function WalletConnectHandler() {
|
|
|
24997
25147
|
setProviderType,
|
|
24998
25148
|
walletMode
|
|
24999
25149
|
]);
|
|
25000
|
-
|
|
25150
|
+
useEffect51(() => {
|
|
25001
25151
|
if (pendingModalOpen && !isConnected && openConnectModal) {
|
|
25002
25152
|
setPendingModalOpen(false);
|
|
25003
25153
|
openConnectModal();
|
|
25004
25154
|
}
|
|
25005
25155
|
}, [pendingModalOpen, isConnected, openConnectModal]);
|
|
25006
|
-
|
|
25156
|
+
useEffect51(() => {
|
|
25007
25157
|
if (connectModalOpen && hasStartedLinking) {
|
|
25008
25158
|
setModalWasOpened(true);
|
|
25009
25159
|
}
|
|
25010
25160
|
}, [connectModalOpen, hasStartedLinking]);
|
|
25011
|
-
|
|
25161
|
+
useEffect51(() => {
|
|
25012
25162
|
if (modalWasOpened && !connectModalOpen && !isConnected && isWalletLinking) {
|
|
25013
25163
|
console.log("[WalletConnectHandler] Modal closed without connecting");
|
|
25014
25164
|
onLinkingComplete(false);
|
|
@@ -25016,7 +25166,7 @@ function WalletConnectHandler() {
|
|
|
25016
25166
|
setModalWasOpened(false);
|
|
25017
25167
|
}
|
|
25018
25168
|
}, [connectModalOpen, modalWasOpened, isConnected, isWalletLinking]);
|
|
25019
|
-
|
|
25169
|
+
useEffect51(() => {
|
|
25020
25170
|
if (isWalletLinking) {
|
|
25021
25171
|
const timeout = setTimeout(() => {
|
|
25022
25172
|
console.warn("[WalletConnectHandler] Wallet linking timed out, resetting state");
|
|
@@ -25136,7 +25286,7 @@ function WalletConnectHandler() {
|
|
|
25136
25286
|
setPage(passportWalletAddress ? "manage-wallet" /* MANAGE_WALLET */ : "auth" /* AUTH */);
|
|
25137
25287
|
}
|
|
25138
25288
|
});
|
|
25139
|
-
|
|
25289
|
+
useEffect51(() => {
|
|
25140
25290
|
if (!!chain?.id && isConnected && walletAddress && isWalletLinking && hasStartedLinking && modalWasOpened && !pendingModalOpen) {
|
|
25141
25291
|
console.log("[WalletConnectHandler] handleWalletSign triggered");
|
|
25142
25292
|
if (!passportWalletAddress) {
|
|
@@ -25146,7 +25296,7 @@ function WalletConnectHandler() {
|
|
|
25146
25296
|
handleWalletSign({ chainId: chain.id, signingWalletAddress: walletAddress });
|
|
25147
25297
|
}
|
|
25148
25298
|
}, [chain, isConnected, walletAddress, isWalletLinking, hasStartedLinking, modalWasOpened, pendingModalOpen]);
|
|
25149
|
-
|
|
25299
|
+
useEffect51(() => {
|
|
25150
25300
|
if (isConnected && !chain?.id && isWalletLinking && hasStartedLinking && !connectModalOpen && !isWalletSigning) {
|
|
25151
25301
|
const timeout = setTimeout(() => {
|
|
25152
25302
|
console.warn("[WalletConnectHandler] Wallet connected but chain info missing, resetting");
|
|
@@ -25182,7 +25332,7 @@ var init_WalletConnectHandler = __esm({
|
|
|
25182
25332
|
});
|
|
25183
25333
|
|
|
25184
25334
|
// src/internal/components/DirectWalletHandler.tsx
|
|
25185
|
-
import { useEffect as
|
|
25335
|
+
import { useEffect as useEffect52 } from "react";
|
|
25186
25336
|
import { useAccount as useAccount2 } from "wagmi";
|
|
25187
25337
|
function DirectWalletHandler() {
|
|
25188
25338
|
const walletMode = useProviderConfig().config.current?.wallet?.mode || "linked";
|
|
@@ -25194,13 +25344,13 @@ function DirectWalletHandler() {
|
|
|
25194
25344
|
const setExternalChainId = useExternalWalletStore((st) => st.setExternalChainId);
|
|
25195
25345
|
const setConfigMode = useExternalWalletStore((st) => st.setConfigMode);
|
|
25196
25346
|
const setActiveMode = useExternalWalletStore((st) => st.setActiveMode);
|
|
25197
|
-
|
|
25347
|
+
useEffect52(() => {
|
|
25198
25348
|
setConfigMode(walletMode);
|
|
25199
25349
|
if (walletMode !== "both") {
|
|
25200
25350
|
setActiveMode(walletMode);
|
|
25201
25351
|
}
|
|
25202
25352
|
}, [walletMode, setConfigMode, setActiveMode]);
|
|
25203
|
-
|
|
25353
|
+
useEffect52(() => {
|
|
25204
25354
|
if (isConnected && address && !isExternalConnected && connector && chain?.id) {
|
|
25205
25355
|
setExternalWallet({
|
|
25206
25356
|
address,
|
|
@@ -25209,17 +25359,17 @@ function DirectWalletHandler() {
|
|
|
25209
25359
|
});
|
|
25210
25360
|
}
|
|
25211
25361
|
}, [isConnected, address, isExternalConnected, connector, chain?.id, setExternalWallet]);
|
|
25212
|
-
|
|
25362
|
+
useEffect52(() => {
|
|
25213
25363
|
if (isExternalConnected && !isConnected) {
|
|
25214
25364
|
clearExternalWallet();
|
|
25215
25365
|
}
|
|
25216
25366
|
}, [isConnected, isExternalConnected, clearExternalWallet]);
|
|
25217
|
-
|
|
25367
|
+
useEffect52(() => {
|
|
25218
25368
|
if (isExternalConnected && isConnected && chain?.id) {
|
|
25219
25369
|
setExternalChainId(chain.id);
|
|
25220
25370
|
}
|
|
25221
25371
|
}, [chain?.id, isConnected, isExternalConnected, setExternalChainId]);
|
|
25222
|
-
|
|
25372
|
+
useEffect52(() => {
|
|
25223
25373
|
if (isExternalConnected && isConnected && address && address !== externalAddress && connector && chain?.id) {
|
|
25224
25374
|
setExternalWallet({
|
|
25225
25375
|
address,
|
|
@@ -25245,8 +25395,8 @@ import {
|
|
|
25245
25395
|
getChainConfig as getChainConfig12,
|
|
25246
25396
|
getViemChain as getViemChain2
|
|
25247
25397
|
} from "@embarkai/core/read";
|
|
25248
|
-
import { Fragment as
|
|
25249
|
-
import { create as
|
|
25398
|
+
import { Fragment as Fragment46 } from "react";
|
|
25399
|
+
import { create as create15 } from "zustand";
|
|
25250
25400
|
import { persist as persist4 } from "zustand/middleware";
|
|
25251
25401
|
import { jsx as jsx121, jsxs as jsxs110 } from "react/jsx-runtime";
|
|
25252
25402
|
function getChainParams(chainCfg) {
|
|
@@ -25266,7 +25416,7 @@ function waitForStoreHydration() {
|
|
|
25266
25416
|
}
|
|
25267
25417
|
function SessionProvider({ children }) {
|
|
25268
25418
|
const config = useProviderConfig().config;
|
|
25269
|
-
return /* @__PURE__ */ jsxs110(
|
|
25419
|
+
return /* @__PURE__ */ jsxs110(Fragment46, { children: [
|
|
25270
25420
|
children,
|
|
25271
25421
|
config.current?.wallet?.enabled && /* @__PURE__ */ jsx121(WalletConnectHandler, {}),
|
|
25272
25422
|
config.current?.wallet?.enabled && (config.current?.wallet?.mode === "direct" || config.current?.wallet?.mode === "both") && /* @__PURE__ */ jsx121(DirectWalletHandler, {}),
|
|
@@ -25291,7 +25441,7 @@ var init_SessionContext = __esm({
|
|
|
25291
25441
|
init_WalletConnectHandler();
|
|
25292
25442
|
init_DirectWalletHandler();
|
|
25293
25443
|
init_ProviderContext();
|
|
25294
|
-
useSession =
|
|
25444
|
+
useSession = create15()(
|
|
25295
25445
|
persist4(
|
|
25296
25446
|
(set) => ({
|
|
25297
25447
|
isLoading: false,
|
|
@@ -26259,13 +26409,13 @@ async function clearLocalKeyshare(userId) {
|
|
|
26259
26409
|
console.log("[clearLocalKeyshare] Keyshares are now managed by secure iframe");
|
|
26260
26410
|
console.log("[clearLocalKeyshare] To clear keyshares, user must revoke authorization in iframe");
|
|
26261
26411
|
if (typeof window !== "undefined" && window.localStorage) {
|
|
26262
|
-
const
|
|
26412
|
+
const keys2 = [
|
|
26263
26413
|
`tss.${userId}.keyshare`,
|
|
26264
26414
|
`tss.${userId}.ownerAddress`,
|
|
26265
26415
|
`tss.${userId}.sessionId`,
|
|
26266
26416
|
...Object.keys(window.localStorage).filter((key) => key.startsWith(`tss.${userId}.dkg.`))
|
|
26267
26417
|
];
|
|
26268
|
-
|
|
26418
|
+
keys2.forEach((key) => window.localStorage.removeItem(key));
|
|
26269
26419
|
console.log("[clearLocalKeyshare] Cleared old localStorage keys for migration");
|
|
26270
26420
|
}
|
|
26271
26421
|
}
|
|
@@ -27970,7 +28120,7 @@ import { darkTheme, lightTheme, RainbowKitProvider as NativeRainbowKitProvider }
|
|
|
27970
28120
|
import { useMemo as useMemo16 } from "react";
|
|
27971
28121
|
import { WagmiProvider } from "wagmi";
|
|
27972
28122
|
import "@rainbow-me/rainbowkit/styles.css";
|
|
27973
|
-
import { Fragment as
|
|
28123
|
+
import { Fragment as Fragment47, jsx as jsx122 } from "react/jsx-runtime";
|
|
27974
28124
|
function RainbowKitProvider({ children }) {
|
|
27975
28125
|
const config = useProviderConfig().config;
|
|
27976
28126
|
const colorMode = useLayoutStore((st) => st.colorMode);
|
|
@@ -28002,7 +28152,7 @@ function RainbowKitProvider({ children }) {
|
|
|
28002
28152
|
radii: rainbowTheme.lightMode.radii
|
|
28003
28153
|
};
|
|
28004
28154
|
}, [colorMode]);
|
|
28005
|
-
if (!config.current?.wallet?.enabled) return /* @__PURE__ */ jsx122(
|
|
28155
|
+
if (!config.current?.wallet?.enabled) return /* @__PURE__ */ jsx122(Fragment47, { children });
|
|
28006
28156
|
return /* @__PURE__ */ jsx122(WagmiProvider, { config: rainbowConfig, children: /* @__PURE__ */ jsx122(NativeRainbowKitProvider, { theme: customTheme, modalSize: "compact", showRecentTransactions: true, children }) });
|
|
28007
28157
|
}
|
|
28008
28158
|
var init_RainbowKitContext = __esm({
|
|
@@ -28046,11 +28196,11 @@ import { initSdkErrorTracking } from "@embarkai/core/internal/error-tracking";
|
|
|
28046
28196
|
import { merge as merge3 } from "lodash-es";
|
|
28047
28197
|
import {
|
|
28048
28198
|
createContext,
|
|
28049
|
-
useCallback as
|
|
28199
|
+
useCallback as useCallback35,
|
|
28050
28200
|
useContext,
|
|
28051
|
-
useEffect as
|
|
28201
|
+
useEffect as useEffect53,
|
|
28052
28202
|
useMemo as useMemo17,
|
|
28053
|
-
useRef as
|
|
28203
|
+
useRef as useRef22
|
|
28054
28204
|
} from "react";
|
|
28055
28205
|
import { jsx as jsx124 } from "react/jsx-runtime";
|
|
28056
28206
|
function clearLegacyWagmiStorage() {
|
|
@@ -28070,10 +28220,10 @@ function clearLegacyWagmiStorage() {
|
|
|
28070
28220
|
}
|
|
28071
28221
|
function Provider(props) {
|
|
28072
28222
|
const { children, projectId, initialConfig = {}, callbacks } = props;
|
|
28073
|
-
const callbacksRef =
|
|
28074
|
-
|
|
28075
|
-
const config =
|
|
28076
|
-
const updateConfig =
|
|
28223
|
+
const callbacksRef = useRef22(callbacks);
|
|
28224
|
+
useEffect53(() => notifyNoProjetctId(projectId), [projectId]);
|
|
28225
|
+
const config = useRef22(merge3({}, DEFAULT_PROVIDER_CONFIG, { projectId }, initialConfig));
|
|
28226
|
+
const updateConfig = useCallback35((updates) => {
|
|
28077
28227
|
const prev = config.current;
|
|
28078
28228
|
const next = { ...prev };
|
|
28079
28229
|
if (updates.projectId !== void 0) next.projectId = updates.projectId;
|
|
@@ -28107,12 +28257,12 @@ function Provider(props) {
|
|
|
28107
28257
|
if (updates.translations) next.translations = { ...next.translations, ...updates.translations };
|
|
28108
28258
|
config.current = next;
|
|
28109
28259
|
}, []);
|
|
28110
|
-
const updateCallbacks =
|
|
28260
|
+
const updateCallbacks = useCallback35((updates) => {
|
|
28111
28261
|
const prev = callbacksRef.current;
|
|
28112
28262
|
const next = updates ? { ...prev, ...updates } : void 0;
|
|
28113
28263
|
callbacksRef.current = next;
|
|
28114
28264
|
}, []);
|
|
28115
|
-
|
|
28265
|
+
useEffect53(() => {
|
|
28116
28266
|
if (typeof window === "undefined" || !projectId) return;
|
|
28117
28267
|
const mergedConfig = merge3(DEFAULT_PROVIDER_CONFIG, initialConfig);
|
|
28118
28268
|
updateConfig(mergedConfig);
|
|
@@ -28132,7 +28282,7 @@ function Provider(props) {
|
|
|
28132
28282
|
useSession.getState().setActiveChainId(mergedConfig.network.chainId);
|
|
28133
28283
|
}
|
|
28134
28284
|
}, [projectId, initialConfig]);
|
|
28135
|
-
|
|
28285
|
+
useEffect53(() => {
|
|
28136
28286
|
if (typeof window === "undefined" || !projectId) return;
|
|
28137
28287
|
try {
|
|
28138
28288
|
initSdkErrorTracking();
|
|
@@ -28222,8 +28372,8 @@ init_pro_mode();
|
|
|
28222
28372
|
init_utils2();
|
|
28223
28373
|
import { useQuery as useQuery26 } from "@tanstack/react-query";
|
|
28224
28374
|
import { Cloud as Cloud4, Laptop as Laptop2, Loader as Loader32, Shield as Shield3 } from "lucide-react";
|
|
28225
|
-
import { useEffect as
|
|
28226
|
-
import { Fragment as
|
|
28375
|
+
import { useEffect as useEffect54, useMemo as useMemo18 } from "react";
|
|
28376
|
+
import { Fragment as Fragment48, jsx as jsx125, jsxs as jsxs111 } from "react/jsx-runtime";
|
|
28227
28377
|
function getFormattedStatus(label, status, showStatus) {
|
|
28228
28378
|
const isStatus = showStatus && status && status !== "idle" && status !== "ready";
|
|
28229
28379
|
if (!isStatus) return label;
|
|
@@ -28242,7 +28392,7 @@ function ConnectWalletButton(props) {
|
|
|
28242
28392
|
const colorMode = useLayoutStore((st) => st.colorMode);
|
|
28243
28393
|
const { session, address, hasServerVault, isLoading, isIframeReady, status, setUsePaymaster } = useSession();
|
|
28244
28394
|
const connectButtonLabel = getFormattedStatus(label || "Connect", status, isIframeReady);
|
|
28245
|
-
|
|
28395
|
+
useEffect54(() => setUsePaymaster(usePaymaster), [setUsePaymaster, usePaymaster]);
|
|
28246
28396
|
const { data: profile, isLoading: isProfileLoading } = useQuery26({
|
|
28247
28397
|
retry: false,
|
|
28248
28398
|
enabled: !!address,
|
|
@@ -28261,7 +28411,7 @@ function ConnectWalletButton(props) {
|
|
|
28261
28411
|
const isConnecting = connectButtonLabel !== label || isLoading;
|
|
28262
28412
|
return /* @__PURE__ */ jsx125("div", { "data-current-theme-mode": colorMode, className: cn("embarkai-ui-scope w-fit h-fit", className), children: !address ? (
|
|
28263
28413
|
/** external Buttons can be provided */
|
|
28264
|
-
/* @__PURE__ */ jsx125(
|
|
28414
|
+
/* @__PURE__ */ jsx125(Fragment48, { children: ConnectButton ? /* @__PURE__ */ jsxs111(
|
|
28265
28415
|
ConnectButton,
|
|
28266
28416
|
{
|
|
28267
28417
|
type: "button",
|
|
@@ -28504,7 +28654,7 @@ init_useLayoutDataStore();
|
|
|
28504
28654
|
init_getUserOperationByHash();
|
|
28505
28655
|
init_getUserOperationReceipt();
|
|
28506
28656
|
init_cn();
|
|
28507
|
-
import { AlertCircle as
|
|
28657
|
+
import { AlertCircle as AlertCircle5, CheckCircle2 as CheckCircle27, Clock as Clock2, Copy as Copy6, ExternalLink as ExternalLink3, RefreshCw as RefreshCw4 } from "lucide-react";
|
|
28508
28658
|
import * as React29 from "react";
|
|
28509
28659
|
|
|
28510
28660
|
// src/internal/components/Address.tsx
|
|
@@ -28688,19 +28838,19 @@ var UserOpStatus = ({
|
|
|
28688
28838
|
if (receipt) {
|
|
28689
28839
|
const ok = !!receipt.success;
|
|
28690
28840
|
return /* @__PURE__ */ jsxs113(Badge, { variant: ok ? "success" : "destructive", children: [
|
|
28691
|
-
ok ? /* @__PURE__ */ jsx129(CheckCircle27, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx129(
|
|
28841
|
+
ok ? /* @__PURE__ */ jsx129(CheckCircle27, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx129(AlertCircle5, { className: "h-3 w-3" }),
|
|
28692
28842
|
ok ? "Included" : "Failed"
|
|
28693
28843
|
] });
|
|
28694
28844
|
}
|
|
28695
28845
|
if (rejected) {
|
|
28696
28846
|
return /* @__PURE__ */ jsxs113(Badge, { variant: "destructive", children: [
|
|
28697
|
-
/* @__PURE__ */ jsx129(
|
|
28847
|
+
/* @__PURE__ */ jsx129(AlertCircle5, { className: "h-3 w-3" }),
|
|
28698
28848
|
" Rejected by bundler"
|
|
28699
28849
|
] });
|
|
28700
28850
|
}
|
|
28701
28851
|
if (timedOut) {
|
|
28702
28852
|
return /* @__PURE__ */ jsxs113(Badge, { variant: "warning", children: [
|
|
28703
|
-
/* @__PURE__ */ jsx129(
|
|
28853
|
+
/* @__PURE__ */ jsx129(AlertCircle5, { className: "h-3 w-3" }),
|
|
28704
28854
|
" Timeout - may be rejected"
|
|
28705
28855
|
] });
|
|
28706
28856
|
}
|
|
@@ -28808,16 +28958,16 @@ var UserOpStatus = ({
|
|
|
28808
28958
|
] })
|
|
28809
28959
|
] }),
|
|
28810
28960
|
error && /* @__PURE__ */ jsxs113("div", { className: "text-sm text-destructive flex items-center gap-1 mt-4", children: [
|
|
28811
|
-
/* @__PURE__ */ jsx129(
|
|
28961
|
+
/* @__PURE__ */ jsx129(AlertCircle5, { className: "h-4 w-4" }),
|
|
28812
28962
|
" ",
|
|
28813
28963
|
error
|
|
28814
28964
|
] }),
|
|
28815
28965
|
rejected && /* @__PURE__ */ jsxs113("div", { className: "text-sm text-destructive flex items-center gap-1 mt-4", children: [
|
|
28816
|
-
/* @__PURE__ */ jsx129(
|
|
28966
|
+
/* @__PURE__ */ jsx129(AlertCircle5, { className: "h-4 w-4" }),
|
|
28817
28967
|
"UserOperation was dropped from bundler mempool. This usually means it was invalid or replaced."
|
|
28818
28968
|
] }),
|
|
28819
28969
|
timedOut && /* @__PURE__ */ jsxs113("div", { className: "text-sm text-destructive flex items-center gap-1 mt-4", children: [
|
|
28820
|
-
/* @__PURE__ */ jsx129(
|
|
28970
|
+
/* @__PURE__ */ jsx129(AlertCircle5, { className: "h-4 w-4" }),
|
|
28821
28971
|
"Stopped polling after ",
|
|
28822
28972
|
Math.round(maxPollTimeMs / 1e3),
|
|
28823
28973
|
"s. UserOperation may have been rejected by the bundler."
|
|
@@ -28893,13 +29043,13 @@ var Hash = ({
|
|
|
28893
29043
|
|
|
28894
29044
|
// src/internal/components/TransactionsMenu/TransactionsList.tsx
|
|
28895
29045
|
init_base2();
|
|
28896
|
-
import { useEffect as
|
|
29046
|
+
import { useEffect as useEffect56, useState as useState33 } from "react";
|
|
28897
29047
|
import { jsx as jsx131, jsxs as jsxs115 } from "react/jsx-runtime";
|
|
28898
29048
|
var TransactionsList = ({ address, itemsCount = 10 }) => {
|
|
28899
|
-
const [transactions, setTransactions] =
|
|
28900
|
-
const [loading, setLoading] =
|
|
28901
|
-
const [error, setError] =
|
|
28902
|
-
|
|
29049
|
+
const [transactions, setTransactions] = useState33([]);
|
|
29050
|
+
const [loading, setLoading] = useState33(true);
|
|
29051
|
+
const [error, setError] = useState33(null);
|
|
29052
|
+
useEffect56(() => {
|
|
28903
29053
|
const fetchTransactions2 = async () => {
|
|
28904
29054
|
try {
|
|
28905
29055
|
setLoading(true);
|
|
@@ -29191,12 +29341,12 @@ init_useErc3643Compliance();
|
|
|
29191
29341
|
|
|
29192
29342
|
// src/hooks/useWalletMode.ts
|
|
29193
29343
|
init_useExternalWalletStore();
|
|
29194
|
-
import { useCallback as
|
|
29344
|
+
import { useCallback as useCallback38 } from "react";
|
|
29195
29345
|
function useWalletMode() {
|
|
29196
29346
|
const configMode = useExternalWalletStore((st) => st.configMode);
|
|
29197
29347
|
const activeMode = useExternalWalletStore((st) => st.activeMode);
|
|
29198
29348
|
const setActiveMode = useExternalWalletStore((st) => st.setActiveMode);
|
|
29199
|
-
const switchMode =
|
|
29349
|
+
const switchMode = useCallback38(
|
|
29200
29350
|
(mode) => {
|
|
29201
29351
|
if (configMode !== "both") return;
|
|
29202
29352
|
setActiveMode(mode);
|
|
@@ -29214,7 +29364,7 @@ function useWalletMode() {
|
|
|
29214
29364
|
// src/hooks/useDirectWallet.ts
|
|
29215
29365
|
init_useExternalWalletStore();
|
|
29216
29366
|
init_useLayoutDataStore();
|
|
29217
|
-
import { useCallback as
|
|
29367
|
+
import { useCallback as useCallback39 } from "react";
|
|
29218
29368
|
import { useConnectModal as useConnectModal3 } from "@rainbow-me/rainbowkit";
|
|
29219
29369
|
import { useDisconnect as useDisconnect5 } from "wagmi";
|
|
29220
29370
|
function useDirectWallet() {
|
|
@@ -29226,13 +29376,13 @@ function useDirectWallet() {
|
|
|
29226
29376
|
const { disconnect: wagmiDisconnect } = useDisconnect5();
|
|
29227
29377
|
const { openConnectModal } = useConnectModal3();
|
|
29228
29378
|
const setIsWalletLinking = useLayoutDataStore((st) => st.setIsWalletLinking);
|
|
29229
|
-
const connect =
|
|
29379
|
+
const connect = useCallback39(() => {
|
|
29230
29380
|
setIsWalletLinking(true);
|
|
29231
29381
|
}, [setIsWalletLinking]);
|
|
29232
|
-
const reconnect =
|
|
29382
|
+
const reconnect = useCallback39(() => {
|
|
29233
29383
|
if (openConnectModal) openConnectModal();
|
|
29234
29384
|
}, [openConnectModal]);
|
|
29235
|
-
const disconnect =
|
|
29385
|
+
const disconnect = useCallback39(() => {
|
|
29236
29386
|
wagmiDisconnect();
|
|
29237
29387
|
clearExternalWallet();
|
|
29238
29388
|
}, [wagmiDisconnect, clearExternalWallet]);
|
|
@@ -29249,7 +29399,7 @@ function useDirectWallet() {
|
|
|
29249
29399
|
|
|
29250
29400
|
// src/hooks/useSendDirectTransaction.ts
|
|
29251
29401
|
init_useExternalWalletStore();
|
|
29252
|
-
import { useCallback as
|
|
29402
|
+
import { useCallback as useCallback40, useState as useState35 } from "react";
|
|
29253
29403
|
import { isAddress as isAddress3, parseEther as parseEther3 } from "viem";
|
|
29254
29404
|
import { useSendTransaction as useWagmiSendTransaction, useSwitchChain as useSwitchChain3 } from "wagmi";
|
|
29255
29405
|
function useSendDirectTransaction() {
|
|
@@ -29257,10 +29407,10 @@ function useSendDirectTransaction() {
|
|
|
29257
29407
|
const externalChainId = useExternalWalletStore((st) => st.externalChainId);
|
|
29258
29408
|
const { sendTransactionAsync } = useWagmiSendTransaction();
|
|
29259
29409
|
const { switchChainAsync } = useSwitchChain3();
|
|
29260
|
-
const [isPending, setIsPending] =
|
|
29261
|
-
const [error, setError] =
|
|
29262
|
-
const [txHash, setTxHash] =
|
|
29263
|
-
const sendTransaction =
|
|
29410
|
+
const [isPending, setIsPending] = useState35(false);
|
|
29411
|
+
const [error, setError] = useState35(null);
|
|
29412
|
+
const [txHash, setTxHash] = useState35(null);
|
|
29413
|
+
const sendTransaction = useCallback40(
|
|
29264
29414
|
async (params) => {
|
|
29265
29415
|
if (!isConnected) {
|
|
29266
29416
|
setError("No external wallet connected");
|
|
@@ -29294,7 +29444,7 @@ function useSendDirectTransaction() {
|
|
|
29294
29444
|
},
|
|
29295
29445
|
[isConnected, externalChainId, sendTransactionAsync, switchChainAsync]
|
|
29296
29446
|
);
|
|
29297
|
-
const reset =
|
|
29447
|
+
const reset = useCallback40(() => {
|
|
29298
29448
|
setError(null);
|
|
29299
29449
|
setTxHash(null);
|
|
29300
29450
|
setIsPending(false);
|
|
@@ -29306,7 +29456,7 @@ function useSendDirectTransaction() {
|
|
|
29306
29456
|
init_SessionContext();
|
|
29307
29457
|
init_account2();
|
|
29308
29458
|
init_linkedProfiles();
|
|
29309
|
-
import { useCallback as
|
|
29459
|
+
import { useCallback as useCallback41, useMemo as useMemo19, useState as useState36 } from "react";
|
|
29310
29460
|
import { encodeFunctionData as encodeFunctionData3, isAddress as isAddress4, parseEther as parseEther4, parseUnits as parseUnits3 } from "viem";
|
|
29311
29461
|
var ERC20_TRANSFER_ABI2 = [
|
|
29312
29462
|
{
|
|
@@ -29322,14 +29472,14 @@ var ERC20_TRANSFER_ABI2 = [
|
|
|
29322
29472
|
function useTransferToLinkedWallet() {
|
|
29323
29473
|
const session = useSession((st) => st.session);
|
|
29324
29474
|
const { profiles } = useLinkedProfiles();
|
|
29325
|
-
const [isPending, setIsPending] =
|
|
29326
|
-
const [error, setError] =
|
|
29327
|
-
const [userOpHash, setUserOpHash] =
|
|
29475
|
+
const [isPending, setIsPending] = useState36(false);
|
|
29476
|
+
const [error, setError] = useState36(null);
|
|
29477
|
+
const [userOpHash, setUserOpHash] = useState36(null);
|
|
29328
29478
|
const linkedWallets = useMemo19(
|
|
29329
29479
|
() => (profiles || []).filter((p) => p.provider === "wallet" && p.externalId).map((p) => p.externalId),
|
|
29330
29480
|
[profiles]
|
|
29331
29481
|
);
|
|
29332
|
-
const transfer =
|
|
29482
|
+
const transfer = useCallback41(
|
|
29333
29483
|
async (params) => {
|
|
29334
29484
|
if (!session) {
|
|
29335
29485
|
setError("No active session");
|
|
@@ -29380,7 +29530,7 @@ function useTransferToLinkedWallet() {
|
|
|
29380
29530
|
},
|
|
29381
29531
|
[session, linkedWallets]
|
|
29382
29532
|
);
|
|
29383
|
-
const reset =
|
|
29533
|
+
const reset = useCallback41(() => {
|
|
29384
29534
|
setError(null);
|
|
29385
29535
|
setUserOpHash(null);
|
|
29386
29536
|
setIsPending(false);
|
|
@@ -29407,7 +29557,7 @@ init_ProviderContext();
|
|
|
29407
29557
|
init_SessionContext();
|
|
29408
29558
|
init_useExternalWalletStore();
|
|
29409
29559
|
import { logout as coreLogout, jwtTokenManager as jwtTokenManager3 } from "@embarkai/core/auth";
|
|
29410
|
-
import { useCallback as
|
|
29560
|
+
import { useCallback as useCallback42 } from "react";
|
|
29411
29561
|
import { useDisconnect as useDisconnect6 } from "wagmi";
|
|
29412
29562
|
function useLogout() {
|
|
29413
29563
|
const { callbacksRef } = useProviderConfig();
|
|
@@ -29424,7 +29574,7 @@ function useLogout() {
|
|
|
29424
29574
|
}
|
|
29425
29575
|
}
|
|
29426
29576
|
});
|
|
29427
|
-
const logout2 =
|
|
29577
|
+
const logout2 = useCallback42(async () => {
|
|
29428
29578
|
const { setSession, setIsLoading, setAddress, setStatus, setError } = useSession.getState();
|
|
29429
29579
|
const prevAddress = address;
|
|
29430
29580
|
let userId = null;
|
|
@@ -29467,7 +29617,7 @@ init_bundler();
|
|
|
29467
29617
|
// src/index.ts
|
|
29468
29618
|
init_auth();
|
|
29469
29619
|
init_profile();
|
|
29470
|
-
|
|
29620
|
+
init_SecurityMenu2();
|
|
29471
29621
|
init_linkedProfiles();
|
|
29472
29622
|
init_nickname_fingerprint();
|
|
29473
29623
|
init_errors();
|
|
@@ -29761,6 +29911,7 @@ function useSmartAccountTransactions() {
|
|
|
29761
29911
|
|
|
29762
29912
|
// src/index.ts
|
|
29763
29913
|
init_iframe_manager();
|
|
29914
|
+
init_BuyMenu2();
|
|
29764
29915
|
|
|
29765
29916
|
// src/internal/assets/index.ts
|
|
29766
29917
|
init_networks2();
|
|
@@ -29821,6 +29972,7 @@ export {
|
|
|
29821
29972
|
getAvailableLanguages,
|
|
29822
29973
|
getExplorerUrl,
|
|
29823
29974
|
getIframeManager,
|
|
29975
|
+
getInProgressOnrampTransactionsList,
|
|
29824
29976
|
getLanguageIcon,
|
|
29825
29977
|
getShareRecoveryStats,
|
|
29826
29978
|
getSmartAccountForChain,
|