@embarkai/ui-kit 0.4.36 → 0.4.37
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 +171 -162
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +146 -137
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -15747,38 +15747,33 @@ var init_MainMenu2 = __esm({
|
|
|
15747
15747
|
});
|
|
15748
15748
|
|
|
15749
15749
|
// src/modules/linkedProfiles.ts
|
|
15750
|
-
async function getLinkProfilesData() {
|
|
15751
|
-
const list = await getLinkedProviders();
|
|
15752
|
-
const loadedProfiles = list.map((p) => {
|
|
15753
|
-
const info = getProviderDisplayInfo(p.provider);
|
|
15754
|
-
return { ...p, displayName: info.name, icon: info.icon };
|
|
15755
|
-
});
|
|
15756
|
-
let avatar = null;
|
|
15757
|
-
try {
|
|
15758
|
-
avatar = import_auth20.jwtTokenManager.getAvatar() || null;
|
|
15759
|
-
} catch {
|
|
15760
|
-
avatar = null;
|
|
15761
|
-
}
|
|
15762
|
-
return { profiles: loadedProfiles, avatar };
|
|
15763
|
-
}
|
|
15764
15750
|
function useLinkedProfiles() {
|
|
15765
15751
|
const qc = (0, import_react_query25.useQueryClient)();
|
|
15766
15752
|
const address = useSession((st) => st.address);
|
|
15767
|
-
const {
|
|
15768
|
-
data,
|
|
15769
|
-
isFetching: isLoading,
|
|
15770
|
-
error
|
|
15771
|
-
} = (0, import_react_query25.useQuery)({
|
|
15753
|
+
const { data, isFetching, isLoading, error } = (0, import_react_query25.useQuery)({
|
|
15772
15754
|
retry: false,
|
|
15773
15755
|
enabled: !!address,
|
|
15774
15756
|
queryKey: [LINKED_PROFILES_QUERY_KEY, address],
|
|
15775
|
-
queryFn:
|
|
15757
|
+
queryFn: async () => {
|
|
15758
|
+
const list = await getLinkedProviders();
|
|
15759
|
+
const loadedProfiles = list.map((p) => {
|
|
15760
|
+
const info = getProviderDisplayInfo(p.provider);
|
|
15761
|
+
return { ...p, displayName: info.name, icon: info.icon };
|
|
15762
|
+
});
|
|
15763
|
+
let avatar2 = null;
|
|
15764
|
+
try {
|
|
15765
|
+
avatar2 = import_auth20.jwtTokenManager.getAvatar() || null;
|
|
15766
|
+
} catch {
|
|
15767
|
+
avatar2 = null;
|
|
15768
|
+
}
|
|
15769
|
+
return { profiles: loadedProfiles, avatar: avatar2 };
|
|
15770
|
+
}
|
|
15776
15771
|
});
|
|
15777
15772
|
const { profiles = [], avatar = null } = data || {};
|
|
15778
15773
|
const refresh = (0, import_react46.useCallback)(async () => {
|
|
15779
15774
|
await qc.invalidateQueries({ queryKey: [LINKED_PROFILES_QUERY_KEY, address] });
|
|
15780
15775
|
}, [qc, address]);
|
|
15781
|
-
return { profiles, avatar, isLoading, error, refresh };
|
|
15776
|
+
return { profiles, avatar, isLoading, isFetching, error, refresh };
|
|
15782
15777
|
}
|
|
15783
15778
|
var import_react_query25, import_react46, LINKED_PROFILES_QUERY_KEY;
|
|
15784
15779
|
var init_linkedProfiles = __esm({
|
|
@@ -16798,11 +16793,44 @@ var init_ManageWallet = __esm({
|
|
|
16798
16793
|
}
|
|
16799
16794
|
});
|
|
16800
16795
|
|
|
16796
|
+
// src/internal/stores/useExternalWalletStore.ts
|
|
16797
|
+
var import_zustand8, useExternalWalletStore;
|
|
16798
|
+
var init_useExternalWalletStore = __esm({
|
|
16799
|
+
"src/internal/stores/useExternalWalletStore.ts"() {
|
|
16800
|
+
import_zustand8 = require("zustand");
|
|
16801
|
+
useExternalWalletStore = (0, import_zustand8.create)((set) => ({
|
|
16802
|
+
configMode: "linked",
|
|
16803
|
+
activeMode: "linked",
|
|
16804
|
+
externalAddress: null,
|
|
16805
|
+
externalChainId: null,
|
|
16806
|
+
isExternalConnected: false,
|
|
16807
|
+
connectorName: null,
|
|
16808
|
+
setConfigMode: (mode) => set({ configMode: mode }),
|
|
16809
|
+
setActiveMode: (mode) => set({ activeMode: mode }),
|
|
16810
|
+
setExternalWallet: ({ address, chainId, connectorName }) => set({
|
|
16811
|
+
externalAddress: address,
|
|
16812
|
+
externalChainId: chainId,
|
|
16813
|
+
isExternalConnected: true,
|
|
16814
|
+
connectorName
|
|
16815
|
+
}),
|
|
16816
|
+
clearExternalWallet: () => set({
|
|
16817
|
+
externalAddress: null,
|
|
16818
|
+
externalChainId: null,
|
|
16819
|
+
isExternalConnected: false,
|
|
16820
|
+
connectorName: null
|
|
16821
|
+
}),
|
|
16822
|
+
setExternalChainId: (chainId) => set({ externalChainId: chainId })
|
|
16823
|
+
}));
|
|
16824
|
+
}
|
|
16825
|
+
});
|
|
16826
|
+
|
|
16801
16827
|
// src/internal/components/ManageWalletMenu/UnlinkProviderMenu.tsx
|
|
16802
16828
|
function UnlinkProviderMenu() {
|
|
16803
16829
|
const qc = (0, import_react_query32.useQueryClient)();
|
|
16804
16830
|
const address = useSession((st) => st.address);
|
|
16805
16831
|
const { callbacksRef } = useProviderConfig();
|
|
16832
|
+
const { disconnect: disconnectExternalWallet } = (0, import_wagmi.useDisconnect)();
|
|
16833
|
+
const isExternalConnected = useExternalWalletStore((st) => st.isExternalConnected);
|
|
16806
16834
|
const { t } = useT();
|
|
16807
16835
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
16808
16836
|
const { confirmUnlink, setConfirmUnlink, setAlert } = useManageWalletStore();
|
|
@@ -16813,6 +16841,13 @@ function UnlinkProviderMenu() {
|
|
|
16813
16841
|
throw new Error("No provider to unlink");
|
|
16814
16842
|
}
|
|
16815
16843
|
const { provider, externalId } = confirmUnlink;
|
|
16844
|
+
if (provider === "wallet" && isExternalConnected) {
|
|
16845
|
+
await new Promise((resolve) => {
|
|
16846
|
+
disconnectExternalWallet();
|
|
16847
|
+
useExternalWalletStore.getState().clearExternalWallet();
|
|
16848
|
+
setTimeout(() => resolve(null), 1e3);
|
|
16849
|
+
});
|
|
16850
|
+
}
|
|
16816
16851
|
await unlinkProvider(provider, externalId);
|
|
16817
16852
|
},
|
|
16818
16853
|
onSuccess: async () => {
|
|
@@ -16881,7 +16916,7 @@ function UnlinkProviderMenu() {
|
|
|
16881
16916
|
] })
|
|
16882
16917
|
] });
|
|
16883
16918
|
}
|
|
16884
|
-
var import_react_query32, import_lucide_react45, import_react50, import_jsx_runtime74;
|
|
16919
|
+
var import_react_query32, import_lucide_react45, import_react50, import_wagmi, import_jsx_runtime74;
|
|
16885
16920
|
var init_UnlinkProviderMenu = __esm({
|
|
16886
16921
|
"src/internal/components/ManageWalletMenu/UnlinkProviderMenu.tsx"() {
|
|
16887
16922
|
init_useLayoutDataStore();
|
|
@@ -16892,7 +16927,9 @@ var init_UnlinkProviderMenu = __esm({
|
|
|
16892
16927
|
import_react_query32 = require("@tanstack/react-query");
|
|
16893
16928
|
import_lucide_react45 = require("lucide-react");
|
|
16894
16929
|
import_react50 = require("react");
|
|
16930
|
+
import_wagmi = require("wagmi");
|
|
16895
16931
|
init_auth();
|
|
16932
|
+
init_useExternalWalletStore();
|
|
16896
16933
|
init_button();
|
|
16897
16934
|
init_input();
|
|
16898
16935
|
init_useProvidersList();
|
|
@@ -19052,37 +19089,6 @@ var init_wallet = __esm({
|
|
|
19052
19089
|
}
|
|
19053
19090
|
});
|
|
19054
19091
|
|
|
19055
|
-
// src/internal/stores/useExternalWalletStore.ts
|
|
19056
|
-
var import_zustand8, useExternalWalletStore;
|
|
19057
|
-
var init_useExternalWalletStore = __esm({
|
|
19058
|
-
"src/internal/stores/useExternalWalletStore.ts"() {
|
|
19059
|
-
import_zustand8 = require("zustand");
|
|
19060
|
-
useExternalWalletStore = (0, import_zustand8.create)((set) => ({
|
|
19061
|
-
configMode: "linked",
|
|
19062
|
-
activeMode: "linked",
|
|
19063
|
-
externalAddress: null,
|
|
19064
|
-
externalChainId: null,
|
|
19065
|
-
isExternalConnected: false,
|
|
19066
|
-
connectorName: null,
|
|
19067
|
-
setConfigMode: (mode) => set({ configMode: mode }),
|
|
19068
|
-
setActiveMode: (mode) => set({ activeMode: mode }),
|
|
19069
|
-
setExternalWallet: ({ address, chainId, connectorName }) => set({
|
|
19070
|
-
externalAddress: address,
|
|
19071
|
-
externalChainId: chainId,
|
|
19072
|
-
isExternalConnected: true,
|
|
19073
|
-
connectorName
|
|
19074
|
-
}),
|
|
19075
|
-
clearExternalWallet: () => set({
|
|
19076
|
-
externalAddress: null,
|
|
19077
|
-
externalChainId: null,
|
|
19078
|
-
isExternalConnected: false,
|
|
19079
|
-
connectorName: null
|
|
19080
|
-
}),
|
|
19081
|
-
setExternalChainId: (chainId) => set({ externalChainId: chainId })
|
|
19082
|
-
}));
|
|
19083
|
-
}
|
|
19084
|
-
});
|
|
19085
|
-
|
|
19086
19092
|
// src/internal/components/SendMenu/useFlowSelector.ts
|
|
19087
19093
|
var import_zustand9, import_middleware2, useFlowSelectorStore;
|
|
19088
19094
|
var init_useFlowSelector = __esm({
|
|
@@ -19229,10 +19235,10 @@ var init_useBridgeStore = __esm({
|
|
|
19229
19235
|
|
|
19230
19236
|
// src/internal/components/SendMenu/hyperbridge/components/SenderSelector.tsx
|
|
19231
19237
|
function SenderSelector(props) {
|
|
19232
|
-
const {
|
|
19238
|
+
const { directWalletProfile } = props;
|
|
19233
19239
|
const { t } = useT();
|
|
19234
19240
|
const config = useProviderConfig().config;
|
|
19235
|
-
const { signMessageAsync } = (0,
|
|
19241
|
+
const { signMessageAsync } = (0, import_wagmi2.useSignMessage)();
|
|
19236
19242
|
const { openConnectModal } = (0, import_rainbowkit.useConnectModal)();
|
|
19237
19243
|
const directWalletAddress = useExternalWalletStore((st) => st.externalAddress);
|
|
19238
19244
|
const directWalletIsConnected = useExternalWalletStore((st) => st.isExternalConnected);
|
|
@@ -19244,22 +19250,15 @@ function SenderSelector(props) {
|
|
|
19244
19250
|
(0, import_react61.useEffect)(() => {
|
|
19245
19251
|
useFlowSelectorStore.getState().setRenderKey(`sender-selected-${Date.now()}`);
|
|
19246
19252
|
}, [walletMessage]);
|
|
19247
|
-
(0,
|
|
19248
|
-
|
|
19249
|
-
|
|
19250
|
-
|
|
19251
|
-
pendingWalletRef.current = null;
|
|
19252
|
-
directWalletFlow(pending);
|
|
19253
|
-
}, [directWalletIsConnected, directWalletAddress]);
|
|
19254
|
-
const { mutate: directWalletFlow, isPending: isDirectWalletLogin } = (0, import_react_query42.useMutation)({
|
|
19255
|
-
mutationFn: async (walletProfile2) => {
|
|
19256
|
-
if (!walletProfile2?.meta?.walletName || !walletProfile2?.externalId || !walletProfile2?.meta?.walletType) {
|
|
19257
|
-
console.error("[SENDER SELECTOR] Invalid wallet profile:", walletProfile2);
|
|
19253
|
+
const { mutate: loginDirectWallet, isPending: isDirectWalletLoggingIn } = (0, import_react_query42.useMutation)({
|
|
19254
|
+
mutationFn: async (walletProfile) => {
|
|
19255
|
+
if (!walletProfile?.meta?.walletName || !walletProfile?.externalId || !walletProfile?.meta?.walletType) {
|
|
19256
|
+
console.error("[SENDER SELECTOR] Invalid wallet profile:", walletProfile);
|
|
19258
19257
|
setWalletMessage("Invalid wallet profile. Please try connecting your wallet again.");
|
|
19259
19258
|
return;
|
|
19260
19259
|
}
|
|
19261
19260
|
const projectName = config.current?.projectId ? await fetchProjectName(config.current.projectId) : "EmbarkAI";
|
|
19262
|
-
const signingWalletAddress =
|
|
19261
|
+
const signingWalletAddress = walletProfile?.externalId;
|
|
19263
19262
|
const message = createLoginMessage(signingWalletAddress, projectName);
|
|
19264
19263
|
const signature = await Promise.race([
|
|
19265
19264
|
signMessageAsync({ message, account: signingWalletAddress }),
|
|
@@ -19283,19 +19282,17 @@ function SenderSelector(props) {
|
|
|
19283
19282
|
address: signingWalletAddress,
|
|
19284
19283
|
signature,
|
|
19285
19284
|
message,
|
|
19286
|
-
walletName:
|
|
19287
|
-
walletType:
|
|
19285
|
+
walletName: walletProfile.meta.walletName,
|
|
19286
|
+
walletType: walletProfile.meta.walletType
|
|
19288
19287
|
};
|
|
19289
|
-
console.log("[SENDER SELECTOR] Wallet login data prepared:", walletData);
|
|
19290
19288
|
const loginData = await walletLogin(walletData);
|
|
19291
|
-
return { fromChainId, loginData, walletProfile
|
|
19289
|
+
return { fromChainId, loginData, walletProfile };
|
|
19292
19290
|
},
|
|
19293
|
-
onSuccess: ({ fromChainId, loginData, walletProfile
|
|
19294
|
-
console.log("[SENDER SELECTOR] Wallet login successful:", loginData);
|
|
19291
|
+
onSuccess: ({ fromChainId, loginData, walletProfile }) => {
|
|
19295
19292
|
useExternalWalletStore.getState().setExternalWallet({
|
|
19296
|
-
address:
|
|
19293
|
+
address: walletProfile?.externalId,
|
|
19297
19294
|
chainId: fromChainId,
|
|
19298
|
-
connectorName:
|
|
19295
|
+
connectorName: walletProfile?.meta?.walletName || "Unknown Wallet"
|
|
19299
19296
|
});
|
|
19300
19297
|
setWalletMessage(null);
|
|
19301
19298
|
useBridgeStore.getState().setBridgeSender("direct-wallet");
|
|
@@ -19306,7 +19303,13 @@ function SenderSelector(props) {
|
|
|
19306
19303
|
setWalletMessage(error instanceof Error ? error.message : "Wallet login failed. Please try again.");
|
|
19307
19304
|
}
|
|
19308
19305
|
});
|
|
19309
|
-
|
|
19306
|
+
(0, import_react61.useEffect)(() => {
|
|
19307
|
+
const pendingProfile = pendingWalletRef.current;
|
|
19308
|
+
if (!pendingProfile || !directWalletIsConnected || !directWalletAddress) return;
|
|
19309
|
+
if (directWalletAddress.toLowerCase() !== pendingProfile.externalId?.toLowerCase()) return;
|
|
19310
|
+
pendingWalletRef.current = null;
|
|
19311
|
+
loginDirectWallet(pendingProfile);
|
|
19312
|
+
}, [directWalletIsConnected, directWalletAddress]);
|
|
19310
19313
|
return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: [
|
|
19311
19314
|
bridgeSenders.map((sender) => /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(
|
|
19312
19315
|
Button,
|
|
@@ -19358,14 +19361,14 @@ function SenderSelector(props) {
|
|
|
19358
19361
|
variant: "default",
|
|
19359
19362
|
size: "large",
|
|
19360
19363
|
className: "w-full",
|
|
19361
|
-
disabled: !
|
|
19364
|
+
disabled: !directWalletProfile || isDirectWalletLoggingIn,
|
|
19362
19365
|
onClick: () => {
|
|
19363
|
-
const isConnectedToRightWallet = directWalletIsConnected && directWalletAddress?.toLowerCase() ===
|
|
19366
|
+
const isConnectedToRightWallet = directWalletIsConnected && directWalletAddress?.toLowerCase() === directWalletProfile?.externalId?.toLowerCase();
|
|
19364
19367
|
if (isConnectedToRightWallet) {
|
|
19365
|
-
|
|
19368
|
+
loginDirectWallet(directWalletProfile);
|
|
19366
19369
|
} else {
|
|
19367
19370
|
useLayoutDataStore.getState().setPage(null);
|
|
19368
|
-
pendingWalletRef.current =
|
|
19371
|
+
pendingWalletRef.current = directWalletProfile;
|
|
19369
19372
|
openConnectModal?.();
|
|
19370
19373
|
}
|
|
19371
19374
|
},
|
|
@@ -19375,7 +19378,7 @@ function SenderSelector(props) {
|
|
|
19375
19378
|
] })
|
|
19376
19379
|
] });
|
|
19377
19380
|
}
|
|
19378
|
-
var import_rainbowkit, import_react_query42, import_react61,
|
|
19381
|
+
var import_rainbowkit, import_react_query42, import_react61, import_wagmi2, import_jsx_runtime89;
|
|
19379
19382
|
var init_SenderSelector = __esm({
|
|
19380
19383
|
"src/internal/components/SendMenu/hyperbridge/components/SenderSelector.tsx"() {
|
|
19381
19384
|
init_ProviderContext();
|
|
@@ -19383,7 +19386,7 @@ var init_SenderSelector = __esm({
|
|
|
19383
19386
|
import_rainbowkit = require("@rainbow-me/rainbowkit");
|
|
19384
19387
|
import_react_query42 = require("@tanstack/react-query");
|
|
19385
19388
|
import_react61 = require("react");
|
|
19386
|
-
|
|
19389
|
+
import_wagmi2 = require("wagmi");
|
|
19387
19390
|
init_wallet();
|
|
19388
19391
|
init_useLayoutDataStore();
|
|
19389
19392
|
init_useExternalWalletStore();
|
|
@@ -19496,7 +19499,6 @@ function useAvailableSenders() {
|
|
|
19496
19499
|
const address = useSession((st) => st.address);
|
|
19497
19500
|
const activeChainId = useSession((st) => st.activeChainId);
|
|
19498
19501
|
const { profiles } = useLinkedProfiles();
|
|
19499
|
-
const walletProfiles = profiles.filter((p) => p.provider === "wallet");
|
|
19500
19502
|
const lastCalcedSenders = (0, import_react62.useRef)([]);
|
|
19501
19503
|
(0, import_react62.useEffect)(() => {
|
|
19502
19504
|
const sendersAccumulator = [
|
|
@@ -19508,15 +19510,14 @@ function useAvailableSenders() {
|
|
|
19508
19510
|
Icon: TOKENS_ICONS["EMBARKAI"]
|
|
19509
19511
|
}
|
|
19510
19512
|
];
|
|
19511
|
-
|
|
19512
|
-
|
|
19513
|
-
|
|
19514
|
-
|
|
19515
|
-
|
|
19516
|
-
|
|
19517
|
-
|
|
19518
|
-
|
|
19519
|
-
});
|
|
19513
|
+
const walletProfile = profiles.filter((p) => p.provider === "wallet")[0] || null;
|
|
19514
|
+
if (!!walletProfile) {
|
|
19515
|
+
sendersAccumulator.push({
|
|
19516
|
+
type: "direct-wallet",
|
|
19517
|
+
name: walletProfile?.meta?.walletName || "External wallet",
|
|
19518
|
+
chainId: null,
|
|
19519
|
+
address: walletProfile?.externalId,
|
|
19520
|
+
Icon: WALLET_ICONS[walletProfile?.meta?.walletName?.toLowerCase()] || WALLET_ICONS["default"]
|
|
19520
19521
|
});
|
|
19521
19522
|
}
|
|
19522
19523
|
if (sendersAccumulator.map((s) => `${s.name}-${s.address}`).join(",") === lastCalcedSenders.current.join(",")) {
|
|
@@ -19525,8 +19526,10 @@ function useAvailableSenders() {
|
|
|
19525
19526
|
lastCalcedSenders.current = sendersAccumulator.map((s) => `${s.name}-${s.address}`);
|
|
19526
19527
|
useBridgeStore.getState().setBridgeSenders(sendersAccumulator);
|
|
19527
19528
|
useFlowSelectorStore.getState().setRenderKey(`sender-selected-${Date.now()}`);
|
|
19528
|
-
}, [address,
|
|
19529
|
-
return {
|
|
19529
|
+
}, [address, profiles, activeChainId]);
|
|
19530
|
+
return {
|
|
19531
|
+
directWalletProfile: profiles.filter((p) => p.provider === "wallet")[0] || null
|
|
19532
|
+
};
|
|
19530
19533
|
}
|
|
19531
19534
|
var import_react62;
|
|
19532
19535
|
var init_useAvailableSenders = __esm({
|
|
@@ -19718,8 +19721,8 @@ var init_useOperationHashesStore = __esm({
|
|
|
19718
19721
|
function useBridge() {
|
|
19719
19722
|
const { t } = useT();
|
|
19720
19723
|
const address = useSession((st) => st.address);
|
|
19721
|
-
const { data: walletClient } = (0,
|
|
19722
|
-
const { switchChainAsync } = (0,
|
|
19724
|
+
const { data: walletClient } = (0, import_wagmi3.useWalletClient)();
|
|
19725
|
+
const { switchChainAsync } = (0, import_wagmi3.useSwitchChain)();
|
|
19723
19726
|
const swapDirection = (0, import_react63.useCallback)(() => {
|
|
19724
19727
|
const {
|
|
19725
19728
|
bridgeStep,
|
|
@@ -19899,7 +19902,7 @@ function useBridge() {
|
|
|
19899
19902
|
isAssetBridging
|
|
19900
19903
|
};
|
|
19901
19904
|
}
|
|
19902
|
-
var import_react_query43, import_react63,
|
|
19905
|
+
var import_react_query43, import_react63, import_wagmi3;
|
|
19903
19906
|
var init_useBridge = __esm({
|
|
19904
19907
|
"src/internal/components/SendMenu/hyperbridge/hooks/useBridge.ts"() {
|
|
19905
19908
|
init_SessionContext();
|
|
@@ -19907,7 +19910,7 @@ var init_useBridge = __esm({
|
|
|
19907
19910
|
init_useExternalWalletStore();
|
|
19908
19911
|
import_react_query43 = require("@tanstack/react-query");
|
|
19909
19912
|
import_react63 = require("react");
|
|
19910
|
-
|
|
19913
|
+
import_wagmi3 = require("wagmi");
|
|
19911
19914
|
init_useLayoutStore();
|
|
19912
19915
|
init_useFlowSelector();
|
|
19913
19916
|
init_api3();
|
|
@@ -20043,7 +20046,7 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
|
20043
20046
|
const address = useSession((st) => st.address);
|
|
20044
20047
|
const directWalletAddress = useExternalWalletStore((st) => st.externalAddress);
|
|
20045
20048
|
const directWalletChainId = useExternalWalletStore((st) => st.externalChainId);
|
|
20046
|
-
const { switchChainAsync } = (0,
|
|
20049
|
+
const { switchChainAsync } = (0, import_wagmi4.useSwitchChain)();
|
|
20047
20050
|
const hyperRoute = useBridgeStore((st) => st.hyperRoute);
|
|
20048
20051
|
const bridgeSender = useBridgeStore((st) => st.bridgeSender);
|
|
20049
20052
|
const originChain = useBridgeStore((st) => st.originChain);
|
|
@@ -20111,7 +20114,7 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
|
20111
20114
|
data: externalNativeBalanceData,
|
|
20112
20115
|
refetch: refetchExternalNativeBalance,
|
|
20113
20116
|
isLoading: isExternalNativeBalanceLoading
|
|
20114
|
-
} = (0,
|
|
20117
|
+
} = (0, import_wagmi4.useBalance)({
|
|
20115
20118
|
address: directWalletAddress,
|
|
20116
20119
|
chainId: directWalletChainId,
|
|
20117
20120
|
query: {
|
|
@@ -20165,7 +20168,7 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
|
20165
20168
|
isRouteTokenBalanceLoading: isAssetsLoading || isExternalBalanceLoading || isExternalNativeBalanceLoading
|
|
20166
20169
|
};
|
|
20167
20170
|
}
|
|
20168
|
-
var import_react_query45, import_react66, import_viem13,
|
|
20171
|
+
var import_react_query45, import_react66, import_viem13, import_wagmi4, EXTERNAL_WALLET_BRIDGING_BALANCE_QUERY;
|
|
20169
20172
|
var init_useBridgeBalance = __esm({
|
|
20170
20173
|
"src/internal/components/SendMenu/hyperbridge/hooks/useBridgeBalance.ts"() {
|
|
20171
20174
|
init_SessionContext();
|
|
@@ -20173,7 +20176,7 @@ var init_useBridgeBalance = __esm({
|
|
|
20173
20176
|
import_react_query45 = require("@tanstack/react-query");
|
|
20174
20177
|
import_react66 = require("react");
|
|
20175
20178
|
import_viem13 = require("viem");
|
|
20176
|
-
|
|
20179
|
+
import_wagmi4 = require("wagmi");
|
|
20177
20180
|
init_useBlockscoutAssets();
|
|
20178
20181
|
init_useExternalWalletStore();
|
|
20179
20182
|
init_useFlowSelector();
|
|
@@ -20193,14 +20196,13 @@ function SelectStep(props) {
|
|
|
20193
20196
|
destinationChain,
|
|
20194
20197
|
hyperRoute,
|
|
20195
20198
|
amount,
|
|
20196
|
-
// bridgeSenders,
|
|
20197
20199
|
isQuoteEstimating,
|
|
20198
20200
|
recipient,
|
|
20199
20201
|
setBridgeStep,
|
|
20200
20202
|
setAmount,
|
|
20201
20203
|
setRecipient
|
|
20202
20204
|
} = useBridgeStore();
|
|
20203
|
-
const selectedSender = useBridgeStore((st) => st.bridgeSenders
|
|
20205
|
+
const selectedSender = useBridgeStore((st) => st.bridgeSenders?.find((s) => s.type === st.bridgeSender)) || null;
|
|
20204
20206
|
const { routeTokenBalance, isRouteTokenBalanceLoading } = useBridgeBalance(hyperlaneWarpRoutes);
|
|
20205
20207
|
const selectedWarpRoute = hyperlaneWarpRoutes.find((route) => {
|
|
20206
20208
|
const { routeId, chainPair } = route;
|
|
@@ -20712,22 +20714,29 @@ function useHyperlaneHistory() {
|
|
|
20712
20714
|
queryKey: [HYPERLANE_HISTORY_QUERY_KEY, address, currentPage],
|
|
20713
20715
|
queryFn: async () => await getHyperlaneBridgeHistory({ page: currentPage, pageSize: TX_HISTORY_PAGE_SIZE })
|
|
20714
20716
|
});
|
|
20717
|
+
const updateExpandable = (0, import_react69.useCallback)(
|
|
20718
|
+
(0, import_lodash_es7.debounce)(() => {
|
|
20719
|
+
useFlowSelectorStore.getState().setRenderKey(`hyperlane-history-loaded-${Date.now()}`);
|
|
20720
|
+
}, 500),
|
|
20721
|
+
[]
|
|
20722
|
+
);
|
|
20715
20723
|
(0, import_react69.useEffect)(() => {
|
|
20716
20724
|
const { data, isLoading } = query;
|
|
20717
|
-
if (isLoading || data.data
|
|
20718
|
-
|
|
20719
|
-
}, [query
|
|
20725
|
+
if (isLoading || data.data?.length === 0) return;
|
|
20726
|
+
updateExpandable();
|
|
20727
|
+
}, [query]);
|
|
20720
20728
|
return {
|
|
20721
20729
|
...query,
|
|
20722
20730
|
currentPage,
|
|
20723
20731
|
setCurrentPage
|
|
20724
20732
|
};
|
|
20725
20733
|
}
|
|
20726
|
-
var import_react_query46, import_react69, HYPERLANE_HISTORY_QUERY_KEY, TX_HISTORY_PAGE_SIZE, TX_HISTORY_POLLING_INTERVAL;
|
|
20734
|
+
var import_react_query46, import_lodash_es7, import_react69, HYPERLANE_HISTORY_QUERY_KEY, TX_HISTORY_PAGE_SIZE, TX_HISTORY_POLLING_INTERVAL;
|
|
20727
20735
|
var init_useHyperlaneHistory = __esm({
|
|
20728
20736
|
"src/internal/components/SendMenu/hyperbridge/hooks/useHyperlaneHistory.ts"() {
|
|
20729
20737
|
init_SessionContext();
|
|
20730
20738
|
import_react_query46 = require("@tanstack/react-query");
|
|
20739
|
+
import_lodash_es7 = require("lodash-es");
|
|
20731
20740
|
import_react69 = require("react");
|
|
20732
20741
|
init_useLayoutDataStore();
|
|
20733
20742
|
init_useFlowSelector();
|
|
@@ -21124,7 +21133,7 @@ function HyperlaneBridge() {
|
|
|
21124
21133
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
21125
21134
|
const { swapDirection, handleQuoteEstimation, bridgeAsset, isAssetBridging } = useBridge();
|
|
21126
21135
|
const { hyperlaneWarpRoutes, isLoadingWarpRoutes } = useHyperlaneRoutes();
|
|
21127
|
-
const {
|
|
21136
|
+
const { directWalletProfile } = useAvailableSenders();
|
|
21128
21137
|
useMenuTitle(hyperlaneWarpRoutes);
|
|
21129
21138
|
(0, import_react71.useEffect)(
|
|
21130
21139
|
() => () => {
|
|
@@ -21133,7 +21142,7 @@ function HyperlaneBridge() {
|
|
|
21133
21142
|
[]
|
|
21134
21143
|
);
|
|
21135
21144
|
return /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(import_jsx_runtime99.Fragment, { children: [
|
|
21136
|
-
bridgeStep === "sender-selector" && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(SenderSelector, {
|
|
21145
|
+
bridgeStep === "sender-selector" && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(SenderSelector, { directWalletProfile }),
|
|
21137
21146
|
bridgeStep === "select" && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
21138
21147
|
SelectStep,
|
|
21139
21148
|
{
|
|
@@ -21228,7 +21237,7 @@ function useErc3643Compliance(options) {
|
|
|
21228
21237
|
isLoading,
|
|
21229
21238
|
error: queryError,
|
|
21230
21239
|
refetch
|
|
21231
|
-
} = (0,
|
|
21240
|
+
} = (0, import_wagmi5.useReadContract)({
|
|
21232
21241
|
address: tokenAddress,
|
|
21233
21242
|
abi: ERC3643_CAN_TRANSFER_ABI,
|
|
21234
21243
|
functionName: "canTransfer",
|
|
@@ -21265,10 +21274,10 @@ function useErc3643Compliance(options) {
|
|
|
21265
21274
|
refetch
|
|
21266
21275
|
};
|
|
21267
21276
|
}
|
|
21268
|
-
var
|
|
21277
|
+
var import_wagmi5, ERC3643_CAN_TRANSFER_ABI;
|
|
21269
21278
|
var init_useErc3643Compliance = __esm({
|
|
21270
21279
|
"src/hooks/useErc3643Compliance.ts"() {
|
|
21271
|
-
|
|
21280
|
+
import_wagmi5 = require("wagmi");
|
|
21272
21281
|
ERC3643_CAN_TRANSFER_ABI = [
|
|
21273
21282
|
{
|
|
21274
21283
|
type: "function",
|
|
@@ -24106,7 +24115,7 @@ var init_package = __esm({
|
|
|
24106
24115
|
"package.json"() {
|
|
24107
24116
|
package_default = {
|
|
24108
24117
|
name: "@embarkai/ui-kit",
|
|
24109
|
-
version: "0.4.
|
|
24118
|
+
version: "0.4.37",
|
|
24110
24119
|
description: "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
|
|
24111
24120
|
type: "module",
|
|
24112
24121
|
main: "./dist/index.cjs",
|
|
@@ -24475,17 +24484,17 @@ function useDecideContentStyles() {
|
|
|
24475
24484
|
return {
|
|
24476
24485
|
isClosing,
|
|
24477
24486
|
isMobileView,
|
|
24478
|
-
style: (0,
|
|
24487
|
+
style: (0, import_lodash_es8.merge)({}, mobileStyles)
|
|
24479
24488
|
};
|
|
24480
24489
|
}
|
|
24481
|
-
var DialogPrimitive,
|
|
24490
|
+
var DialogPrimitive, import_lodash_es8, import_lucide_react78, import_react84, import_jsx_runtime118, Dialog, DialogPortal, DialogOverlay, CONTENT_BG_SETUP, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription;
|
|
24482
24491
|
var init_dialog = __esm({
|
|
24483
24492
|
"src/internal/components/ui/dialog.tsx"() {
|
|
24484
24493
|
init_utils2();
|
|
24485
24494
|
init_SessionContext();
|
|
24486
24495
|
init_i18n();
|
|
24487
24496
|
DialogPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
24488
|
-
|
|
24497
|
+
import_lodash_es8 = require("lodash-es");
|
|
24489
24498
|
import_lucide_react78 = require("lucide-react");
|
|
24490
24499
|
import_react84 = require("react");
|
|
24491
24500
|
init_useLayoutDataStore();
|
|
@@ -24781,10 +24790,10 @@ function WalletConnectHandler() {
|
|
|
24781
24790
|
const qc = (0, import_react_query54.useQueryClient)();
|
|
24782
24791
|
const { callbacksRef } = useProviderConfig();
|
|
24783
24792
|
const passportWalletAddress = useSession((st) => st.address);
|
|
24784
|
-
const { address: walletAddress, isConnected, chain, connector } = (0,
|
|
24793
|
+
const { address: walletAddress, isConnected, chain, connector } = (0, import_wagmi6.useAccount)();
|
|
24785
24794
|
const { openConnectModal, connectModalOpen } = (0, import_rainbowkit2.useConnectModal)();
|
|
24786
|
-
const { disconnect } = (0,
|
|
24787
|
-
const { signMessageAsync } = (0,
|
|
24795
|
+
const { disconnect } = (0, import_wagmi6.useDisconnect)();
|
|
24796
|
+
const { signMessageAsync } = (0, import_wagmi6.useSignMessage)();
|
|
24788
24797
|
const isWalletLinking = useLayoutDataStore((st) => st.isWalletLinking);
|
|
24789
24798
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
24790
24799
|
const setIsWalletLinking = useLayoutDataStore((st) => st.setIsWalletLinking);
|
|
@@ -25039,7 +25048,7 @@ function WalletConnectHandler() {
|
|
|
25039
25048
|
]);
|
|
25040
25049
|
return null;
|
|
25041
25050
|
}
|
|
25042
|
-
var import_rainbowkit2, import_react_query54, import_react87,
|
|
25051
|
+
var import_rainbowkit2, import_react_query54, import_react87, import_wagmi6;
|
|
25043
25052
|
var init_WalletConnectHandler = __esm({
|
|
25044
25053
|
"src/internal/components/WalletConnectHandler.tsx"() {
|
|
25045
25054
|
init_ProviderContext();
|
|
@@ -25048,7 +25057,7 @@ var init_WalletConnectHandler = __esm({
|
|
|
25048
25057
|
import_rainbowkit2 = require("@rainbow-me/rainbowkit");
|
|
25049
25058
|
import_react_query54 = require("@tanstack/react-query");
|
|
25050
25059
|
import_react87 = __toESM(require("react"), 1);
|
|
25051
|
-
|
|
25060
|
+
import_wagmi6 = require("wagmi");
|
|
25052
25061
|
init_wallet();
|
|
25053
25062
|
init_AuthMenu2();
|
|
25054
25063
|
init_useLayoutDataStore();
|
|
@@ -25060,7 +25069,7 @@ var init_WalletConnectHandler = __esm({
|
|
|
25060
25069
|
// src/internal/components/DirectWalletHandler.tsx
|
|
25061
25070
|
function DirectWalletHandler() {
|
|
25062
25071
|
const walletMode = useProviderConfig().config.current?.wallet?.mode || "linked";
|
|
25063
|
-
const { address, isConnected, chain, connector } = (0,
|
|
25072
|
+
const { address, isConnected, chain, connector } = (0, import_wagmi7.useAccount)();
|
|
25064
25073
|
const isExternalConnected = useExternalWalletStore((st) => st.isExternalConnected);
|
|
25065
25074
|
const externalAddress = useExternalWalletStore((st) => st.externalAddress);
|
|
25066
25075
|
const setExternalWallet = useExternalWalletStore((st) => st.setExternalWallet);
|
|
@@ -25104,11 +25113,11 @@ function DirectWalletHandler() {
|
|
|
25104
25113
|
}, [address, isConnected, isExternalConnected, externalAddress, chain?.id, connector, setExternalWallet]);
|
|
25105
25114
|
return null;
|
|
25106
25115
|
}
|
|
25107
|
-
var import_react88,
|
|
25116
|
+
var import_react88, import_wagmi7;
|
|
25108
25117
|
var init_DirectWalletHandler = __esm({
|
|
25109
25118
|
"src/internal/components/DirectWalletHandler.tsx"() {
|
|
25110
25119
|
import_react88 = require("react");
|
|
25111
|
-
|
|
25120
|
+
import_wagmi7 = require("wagmi");
|
|
25112
25121
|
init_ProviderContext();
|
|
25113
25122
|
init_useExternalWalletStore();
|
|
25114
25123
|
}
|
|
@@ -27562,13 +27571,13 @@ var init_iframe_manager = __esm({
|
|
|
27562
27571
|
});
|
|
27563
27572
|
|
|
27564
27573
|
// src/config/rainbowkit.ts
|
|
27565
|
-
var import_read18, import_rainbowkit3, import_wallets2,
|
|
27574
|
+
var import_read18, import_rainbowkit3, import_wallets2, import_wagmi8, import_chains12, getProjectId2, WALLET_MAP, getWagmiStorageKey, buildRainbowChains, createRainbowConfig, rainbowTheme;
|
|
27566
27575
|
var init_rainbowkit = __esm({
|
|
27567
27576
|
"src/config/rainbowkit.ts"() {
|
|
27568
27577
|
import_read18 = require("@embarkai/core/read");
|
|
27569
27578
|
import_rainbowkit3 = require("@rainbow-me/rainbowkit");
|
|
27570
27579
|
import_wallets2 = require("@rainbow-me/rainbowkit/wallets");
|
|
27571
|
-
|
|
27580
|
+
import_wagmi8 = require("wagmi");
|
|
27572
27581
|
import_chains12 = require("wagmi/chains");
|
|
27573
27582
|
getProjectId2 = (configProjectId) => {
|
|
27574
27583
|
if (configProjectId) return configProjectId;
|
|
@@ -27617,7 +27626,7 @@ var init_rainbowkit = __esm({
|
|
|
27617
27626
|
appName: "EmbarkAI Wallet",
|
|
27618
27627
|
projectId: getProjectId2(opts.projectId),
|
|
27619
27628
|
chains: buildRainbowChains(opts.supportedChains, opts.preferredChainId),
|
|
27620
|
-
storage: (0,
|
|
27629
|
+
storage: (0, import_wagmi8.createStorage)({ key: getWagmiStorageKey(opts) }),
|
|
27621
27630
|
ssr: false
|
|
27622
27631
|
};
|
|
27623
27632
|
if (opts.allowedWallets && opts.allowedWallets.length > 0) {
|
|
@@ -27847,14 +27856,14 @@ function RainbowKitProvider({ children }) {
|
|
|
27847
27856
|
};
|
|
27848
27857
|
}, [colorMode]);
|
|
27849
27858
|
if (!config.current?.wallet?.enabled) return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(import_jsx_runtime122.Fragment, { children });
|
|
27850
|
-
return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
27859
|
+
return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(import_wagmi9.WagmiProvider, { config: rainbowConfig, children: /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(import_rainbowkit4.RainbowKitProvider, { theme: customTheme, modalSize: "compact", showRecentTransactions: true, children }) });
|
|
27851
27860
|
}
|
|
27852
|
-
var import_rainbowkit4, import_react90,
|
|
27861
|
+
var import_rainbowkit4, import_react90, import_wagmi9, import_styles, import_jsx_runtime122;
|
|
27853
27862
|
var init_RainbowKitContext = __esm({
|
|
27854
27863
|
"src/context/RainbowKitContext.tsx"() {
|
|
27855
27864
|
import_rainbowkit4 = require("@rainbow-me/rainbowkit");
|
|
27856
27865
|
import_react90 = require("react");
|
|
27857
|
-
|
|
27866
|
+
import_wagmi9 = require("wagmi");
|
|
27858
27867
|
init_rainbowkit();
|
|
27859
27868
|
init_useLayoutStore();
|
|
27860
27869
|
init_ProviderContext();
|
|
@@ -27881,7 +27890,7 @@ var init_utils11 = __esm({
|
|
|
27881
27890
|
// src/config/wagmi.ts
|
|
27882
27891
|
function buildTransport(urls) {
|
|
27883
27892
|
const transports = urls.map(
|
|
27884
|
-
(url) => (0,
|
|
27893
|
+
(url) => (0, import_wagmi10.http)(url, {
|
|
27885
27894
|
timeout: 1e4,
|
|
27886
27895
|
retryCount: 0,
|
|
27887
27896
|
batch: false,
|
|
@@ -27897,35 +27906,35 @@ function buildTransport(urls) {
|
|
|
27897
27906
|
retryCount: 0
|
|
27898
27907
|
});
|
|
27899
27908
|
}
|
|
27900
|
-
var import_read19, import_viem20,
|
|
27909
|
+
var import_read19, import_viem20, import_wagmi10, import_chains13, wagmiConfig;
|
|
27901
27910
|
var init_wagmi = __esm({
|
|
27902
27911
|
"src/config/wagmi.ts"() {
|
|
27903
27912
|
import_read19 = require("@embarkai/core/read");
|
|
27904
27913
|
import_viem20 = require("viem");
|
|
27905
|
-
|
|
27914
|
+
import_wagmi10 = require("wagmi");
|
|
27906
27915
|
import_chains13 = require("wagmi/chains");
|
|
27907
|
-
wagmiConfig = (0,
|
|
27916
|
+
wagmiConfig = (0, import_wagmi10.createConfig)({
|
|
27908
27917
|
chains: [import_read19.lumiaMainnetChain, import_read19.lumiaTestnetChain, import_chains13.bsc, import_chains13.mainnet],
|
|
27909
|
-
storage: (0,
|
|
27918
|
+
storage: (0, import_wagmi10.createStorage)({ key: "embark-wagmi-static-v2" }),
|
|
27910
27919
|
transports: {
|
|
27911
27920
|
[import_read19.lumiaTestnetChain.id]: buildTransport(import_read19.lumiaTestnetChain.rpcUrls.default.http),
|
|
27912
27921
|
[import_read19.lumiaMainnetChain.id]: buildTransport(import_read19.lumiaMainnetChain.rpcUrls.default.http),
|
|
27913
|
-
[import_chains13.bsc.id]: (0,
|
|
27914
|
-
[import_chains13.mainnet.id]: (0,
|
|
27922
|
+
[import_chains13.bsc.id]: (0, import_wagmi10.http)(),
|
|
27923
|
+
[import_chains13.mainnet.id]: (0, import_wagmi10.http)()
|
|
27915
27924
|
}
|
|
27916
27925
|
});
|
|
27917
27926
|
}
|
|
27918
27927
|
});
|
|
27919
27928
|
|
|
27920
27929
|
// src/context/WagmiContext.tsx
|
|
27921
|
-
var
|
|
27930
|
+
var import_wagmi11, import_jsx_runtime123, WagmiProvider2;
|
|
27922
27931
|
var init_WagmiContext = __esm({
|
|
27923
27932
|
"src/context/WagmiContext.tsx"() {
|
|
27924
|
-
|
|
27933
|
+
import_wagmi11 = require("wagmi");
|
|
27925
27934
|
init_wagmi();
|
|
27926
27935
|
import_jsx_runtime123 = require("react/jsx-runtime");
|
|
27927
27936
|
WagmiProvider2 = ({ children }) => {
|
|
27928
|
-
return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
27937
|
+
return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(import_wagmi11.WagmiProvider, { config: wagmiConfig, children });
|
|
27929
27938
|
};
|
|
27930
27939
|
}
|
|
27931
27940
|
});
|
|
@@ -27950,7 +27959,7 @@ function Provider(props) {
|
|
|
27950
27959
|
const { children, projectId, initialConfig = {}, callbacks } = props;
|
|
27951
27960
|
const callbacksRef = (0, import_react91.useRef)(callbacks);
|
|
27952
27961
|
(0, import_react91.useEffect)(() => notifyNoProjetctId(projectId), [projectId]);
|
|
27953
|
-
const config = (0, import_react91.useRef)((0,
|
|
27962
|
+
const config = (0, import_react91.useRef)((0, import_lodash_es9.merge)({}, DEFAULT_PROVIDER_CONFIG, { projectId }, initialConfig));
|
|
27954
27963
|
const updateConfig = (0, import_react91.useCallback)((updates) => {
|
|
27955
27964
|
const prev = config.current;
|
|
27956
27965
|
const next = { ...prev };
|
|
@@ -27992,7 +28001,7 @@ function Provider(props) {
|
|
|
27992
28001
|
}, []);
|
|
27993
28002
|
(0, import_react91.useEffect)(() => {
|
|
27994
28003
|
if (typeof window === "undefined" || !projectId) return;
|
|
27995
|
-
const mergedConfig = (0,
|
|
28004
|
+
const mergedConfig = (0, import_lodash_es9.merge)(DEFAULT_PROVIDER_CONFIG, initialConfig);
|
|
27996
28005
|
updateConfig(mergedConfig);
|
|
27997
28006
|
if (mergedConfig.wallet?.enabled) {
|
|
27998
28007
|
clearLegacyWagmiStorage();
|
|
@@ -28054,11 +28063,11 @@ function Provider(props) {
|
|
|
28054
28063
|
return /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(UIContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(RainbowKitProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(SessionProvider, { children }) }) });
|
|
28055
28064
|
return /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(WagmiProvider2, { children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(UIContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(SessionProvider, { children }) }) });
|
|
28056
28065
|
}
|
|
28057
|
-
var import_error_tracking4,
|
|
28066
|
+
var import_error_tracking4, import_lodash_es9, import_react91, import_jsx_runtime124, UIContext, useProviderConfig;
|
|
28058
28067
|
var init_ProviderContext = __esm({
|
|
28059
28068
|
"src/context/ProviderContext.tsx"() {
|
|
28060
28069
|
import_error_tracking4 = require("@embarkai/core/internal/error-tracking");
|
|
28061
|
-
|
|
28070
|
+
import_lodash_es9 = require("lodash-es");
|
|
28062
28071
|
import_react91 = require("react");
|
|
28063
28072
|
init_initial();
|
|
28064
28073
|
init_iframe_manager();
|
|
@@ -29396,7 +29405,7 @@ function useWalletMode() {
|
|
|
29396
29405
|
// src/hooks/useDirectWallet.ts
|
|
29397
29406
|
var import_react96 = require("react");
|
|
29398
29407
|
var import_rainbowkit6 = require("@rainbow-me/rainbowkit");
|
|
29399
|
-
var
|
|
29408
|
+
var import_wagmi13 = require("wagmi");
|
|
29400
29409
|
init_useExternalWalletStore();
|
|
29401
29410
|
init_useLayoutDataStore();
|
|
29402
29411
|
function useDirectWallet() {
|
|
@@ -29405,7 +29414,7 @@ function useDirectWallet() {
|
|
|
29405
29414
|
const isConnected = useExternalWalletStore((st) => st.isExternalConnected);
|
|
29406
29415
|
const connectorName = useExternalWalletStore((st) => st.connectorName);
|
|
29407
29416
|
const clearExternalWallet = useExternalWalletStore((st) => st.clearExternalWallet);
|
|
29408
|
-
const { disconnect: wagmiDisconnect } = (0,
|
|
29417
|
+
const { disconnect: wagmiDisconnect } = (0, import_wagmi13.useDisconnect)();
|
|
29409
29418
|
const { openConnectModal } = (0, import_rainbowkit6.useConnectModal)();
|
|
29410
29419
|
const setIsWalletLinking = useLayoutDataStore((st) => st.setIsWalletLinking);
|
|
29411
29420
|
const connect = (0, import_react96.useCallback)(() => {
|
|
@@ -29432,13 +29441,13 @@ function useDirectWallet() {
|
|
|
29432
29441
|
// src/hooks/useSendDirectTransaction.ts
|
|
29433
29442
|
var import_react97 = require("react");
|
|
29434
29443
|
var import_viem21 = require("viem");
|
|
29435
|
-
var
|
|
29444
|
+
var import_wagmi14 = require("wagmi");
|
|
29436
29445
|
init_useExternalWalletStore();
|
|
29437
29446
|
function useSendDirectTransaction() {
|
|
29438
29447
|
const isConnected = useExternalWalletStore((st) => st.isExternalConnected);
|
|
29439
29448
|
const externalChainId = useExternalWalletStore((st) => st.externalChainId);
|
|
29440
|
-
const { sendTransactionAsync } = (0,
|
|
29441
|
-
const { switchChainAsync } = (0,
|
|
29449
|
+
const { sendTransactionAsync } = (0, import_wagmi14.useSendTransaction)();
|
|
29450
|
+
const { switchChainAsync } = (0, import_wagmi14.useSwitchChain)();
|
|
29442
29451
|
const [isPending, setIsPending] = (0, import_react97.useState)(false);
|
|
29443
29452
|
const [error, setError] = (0, import_react97.useState)(null);
|
|
29444
29453
|
const [txHash, setTxHash] = (0, import_react97.useState)(null);
|
|
@@ -29571,11 +29580,11 @@ function useTransferToLinkedWallet() {
|
|
|
29571
29580
|
}
|
|
29572
29581
|
|
|
29573
29582
|
// src/hooks/useNativeWalletSignature.ts
|
|
29574
|
-
var
|
|
29583
|
+
var import_wagmi15 = require("wagmi");
|
|
29575
29584
|
init_providers();
|
|
29576
29585
|
function useNativeWalletSignature() {
|
|
29577
|
-
const signMessage = (0,
|
|
29578
|
-
const signTypedMessage = (0,
|
|
29586
|
+
const signMessage = (0, import_wagmi15.useSignMessage)();
|
|
29587
|
+
const signTypedMessage = (0, import_wagmi15.useSignTypedData)();
|
|
29579
29588
|
return {
|
|
29580
29589
|
signMessage,
|
|
29581
29590
|
/** EIP-712 signature */
|
|
@@ -29640,13 +29649,13 @@ init_useBlockscoutAssets();
|
|
|
29640
29649
|
init_SessionContext();
|
|
29641
29650
|
var import_read22 = require("@embarkai/core/read");
|
|
29642
29651
|
var import_viem23 = require("viem");
|
|
29643
|
-
var
|
|
29652
|
+
var import_wagmi16 = require("wagmi");
|
|
29644
29653
|
function useTransactions() {
|
|
29645
29654
|
const chainId = requireActiveChainId();
|
|
29646
29655
|
const viemChain = (0, import_read22.getViemChain)(chainId);
|
|
29647
|
-
const publicClient = (0,
|
|
29648
|
-
const { data: walletClient } = (0,
|
|
29649
|
-
const { address } = (0,
|
|
29656
|
+
const publicClient = (0, import_wagmi16.usePublicClient)({ chainId });
|
|
29657
|
+
const { data: walletClient } = (0, import_wagmi16.useWalletClient)();
|
|
29658
|
+
const { address } = (0, import_wagmi16.useAccount)();
|
|
29650
29659
|
const sendTransaction = async (params) => {
|
|
29651
29660
|
if (!walletClient) {
|
|
29652
29661
|
throw new Error("Wallet not connected");
|
|
@@ -29706,7 +29715,7 @@ function useTransactions() {
|
|
|
29706
29715
|
init_SessionContext();
|
|
29707
29716
|
var import_react100 = __toESM(require("react"), 1);
|
|
29708
29717
|
var import_viem24 = require("viem");
|
|
29709
|
-
var
|
|
29718
|
+
var import_wagmi17 = require("wagmi");
|
|
29710
29719
|
var COMMON_TOKENS = [
|
|
29711
29720
|
// Add real token addresses here when available
|
|
29712
29721
|
// {
|
|
@@ -29723,7 +29732,7 @@ function useAssets(address) {
|
|
|
29723
29732
|
data: nativeBalance,
|
|
29724
29733
|
isLoading: nativeBalanceLoading,
|
|
29725
29734
|
refetch: refetchNativeBalance
|
|
29726
|
-
} = (0,
|
|
29735
|
+
} = (0, import_wagmi17.useBalance)({
|
|
29727
29736
|
address,
|
|
29728
29737
|
chainId,
|
|
29729
29738
|
query: {
|
|
@@ -29737,7 +29746,7 @@ function useAssets(address) {
|
|
|
29737
29746
|
args: [address],
|
|
29738
29747
|
chainId
|
|
29739
29748
|
}));
|
|
29740
|
-
const readContractsResult = (0,
|
|
29749
|
+
const readContractsResult = (0, import_wagmi17.useReadContracts)({
|
|
29741
29750
|
contracts: tokenContracts,
|
|
29742
29751
|
query: {
|
|
29743
29752
|
enabled: !!address && COMMON_TOKENS.length > 0
|
|
@@ -29818,7 +29827,7 @@ function useAssets(address) {
|
|
|
29818
29827
|
}
|
|
29819
29828
|
function useTokenInfo(tokenAddress) {
|
|
29820
29829
|
const chainId = requireActiveChainId();
|
|
29821
|
-
const readContractsResult = (0,
|
|
29830
|
+
const readContractsResult = (0, import_wagmi17.useReadContracts)({
|
|
29822
29831
|
contracts: [
|
|
29823
29832
|
{ address: tokenAddress, abi: import_viem24.erc20Abi, functionName: "name", chainId },
|
|
29824
29833
|
{ address: tokenAddress, abi: import_viem24.erc20Abi, functionName: "symbol", chainId },
|
|
@@ -29849,7 +29858,7 @@ function useTokenBalance(tokenAddress, userAddress) {
|
|
|
29849
29858
|
data: balance,
|
|
29850
29859
|
isLoading,
|
|
29851
29860
|
refetch
|
|
29852
|
-
} = (0,
|
|
29861
|
+
} = (0, import_wagmi17.useReadContract)({
|
|
29853
29862
|
address: tokenAddress,
|
|
29854
29863
|
abi: import_viem24.erc20Abi,
|
|
29855
29864
|
functionName: "balanceOf",
|