@embarkai/ui-kit 0.4.36 → 0.4.38
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 +183 -175
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +158 -150
- 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({
|
|
@@ -19167,7 +19173,6 @@ var init_useBridgeStore = __esm({
|
|
|
19167
19173
|
bridgeStep: "select",
|
|
19168
19174
|
bridgeType: "hyper",
|
|
19169
19175
|
bridgeSender: "embarkai-wallet",
|
|
19170
|
-
bridgeSenders: [],
|
|
19171
19176
|
amount: "",
|
|
19172
19177
|
quote: null,
|
|
19173
19178
|
isQuoteEstimating: false,
|
|
@@ -19176,6 +19181,7 @@ var init_useBridgeStore = __esm({
|
|
|
19176
19181
|
useBridgeStore = (0, import_zustand10.create)()(
|
|
19177
19182
|
(0, import_middleware3.persist)(
|
|
19178
19183
|
(set, get) => ({
|
|
19184
|
+
bridgeSenders: [],
|
|
19179
19185
|
hyperRoute: null,
|
|
19180
19186
|
recipient: null,
|
|
19181
19187
|
originChain: null,
|
|
@@ -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();
|
|
@@ -19494,39 +19497,39 @@ var init_wallets = __esm({
|
|
|
19494
19497
|
// src/internal/components/SendMenu/hyperbridge/hooks/useAvailableSenders.ts
|
|
19495
19498
|
function useAvailableSenders() {
|
|
19496
19499
|
const address = useSession((st) => st.address);
|
|
19497
|
-
const activeChainId = useSession((st) => st.activeChainId);
|
|
19498
19500
|
const { profiles } = useLinkedProfiles();
|
|
19499
|
-
const walletProfiles = profiles.filter((p) => p.provider === "wallet");
|
|
19500
19501
|
const lastCalcedSenders = (0, import_react62.useRef)([]);
|
|
19501
19502
|
(0, import_react62.useEffect)(() => {
|
|
19502
19503
|
const sendersAccumulator = [
|
|
19503
19504
|
{
|
|
19504
19505
|
type: "embarkai-wallet",
|
|
19505
19506
|
name: "embarkAI",
|
|
19506
|
-
chainId:
|
|
19507
|
+
chainId: null,
|
|
19507
19508
|
address,
|
|
19508
19509
|
Icon: TOKENS_ICONS["EMBARKAI"]
|
|
19509
19510
|
}
|
|
19510
19511
|
];
|
|
19511
|
-
|
|
19512
|
-
|
|
19513
|
-
|
|
19514
|
-
|
|
19515
|
-
|
|
19516
|
-
|
|
19517
|
-
|
|
19518
|
-
|
|
19519
|
-
});
|
|
19512
|
+
const walletProfile = profiles.filter((p) => p.provider === "wallet")[0] || null;
|
|
19513
|
+
if (!!walletProfile) {
|
|
19514
|
+
sendersAccumulator.push({
|
|
19515
|
+
type: "direct-wallet",
|
|
19516
|
+
name: walletProfile?.meta?.walletName || "External wallet",
|
|
19517
|
+
chainId: null,
|
|
19518
|
+
address: walletProfile?.externalId,
|
|
19519
|
+
Icon: WALLET_ICONS[walletProfile?.meta?.walletName?.toLowerCase()] || WALLET_ICONS["default"]
|
|
19520
19520
|
});
|
|
19521
19521
|
}
|
|
19522
19522
|
if (sendersAccumulator.map((s) => `${s.name}-${s.address}`).join(",") === lastCalcedSenders.current.join(",")) {
|
|
19523
19523
|
return;
|
|
19524
19524
|
}
|
|
19525
19525
|
lastCalcedSenders.current = sendersAccumulator.map((s) => `${s.name}-${s.address}`);
|
|
19526
|
+
console.info("[SENDER SELECTOR] setting bridge senders", sendersAccumulator);
|
|
19526
19527
|
useBridgeStore.getState().setBridgeSenders(sendersAccumulator);
|
|
19527
19528
|
useFlowSelectorStore.getState().setRenderKey(`sender-selected-${Date.now()}`);
|
|
19528
|
-
}, [address,
|
|
19529
|
-
return {
|
|
19529
|
+
}, [address, profiles]);
|
|
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();
|
|
@@ -20189,18 +20192,16 @@ function SelectStep(props) {
|
|
|
20189
20192
|
const { swapChains, hyperlaneWarpRoutes, isLoadingWarpRoutes, handleQuoteEstimation } = props;
|
|
20190
20193
|
const { t } = useT();
|
|
20191
20194
|
const {
|
|
20195
|
+
bridgeSenders,
|
|
20196
|
+
bridgeSender,
|
|
20192
20197
|
originChain,
|
|
20193
20198
|
destinationChain,
|
|
20194
20199
|
hyperRoute,
|
|
20195
20200
|
amount,
|
|
20196
|
-
// bridgeSenders,
|
|
20197
20201
|
isQuoteEstimating,
|
|
20198
|
-
recipient
|
|
20199
|
-
setBridgeStep,
|
|
20200
|
-
setAmount,
|
|
20201
|
-
setRecipient
|
|
20202
|
+
recipient
|
|
20202
20203
|
} = useBridgeStore();
|
|
20203
|
-
const selectedSender =
|
|
20204
|
+
const selectedSender = bridgeSenders?.find((s) => s.type === bridgeSender) || null;
|
|
20204
20205
|
const { routeTokenBalance, isRouteTokenBalanceLoading } = useBridgeBalance(hyperlaneWarpRoutes);
|
|
20205
20206
|
const selectedWarpRoute = hyperlaneWarpRoutes.find((route) => {
|
|
20206
20207
|
const { routeId, chainPair } = route;
|
|
@@ -20232,7 +20233,7 @@ function SelectStep(props) {
|
|
|
20232
20233
|
className: "w-full justify-between",
|
|
20233
20234
|
onClick: () => {
|
|
20234
20235
|
useFlowSelectorStore.getState().setError(null);
|
|
20235
|
-
setBridgeStep("sender-selector");
|
|
20236
|
+
useBridgeStore.getState().setBridgeStep("sender-selector");
|
|
20236
20237
|
},
|
|
20237
20238
|
children: [
|
|
20238
20239
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "flex items-center gap-[var(--ui-kit-gap)]", children: [
|
|
@@ -20271,7 +20272,7 @@ function SelectStep(props) {
|
|
|
20271
20272
|
className: "w-full justify-between",
|
|
20272
20273
|
onClick: () => {
|
|
20273
20274
|
useFlowSelectorStore.getState().setError(null);
|
|
20274
|
-
setBridgeStep("select-token");
|
|
20275
|
+
useBridgeStore.getState().setBridgeStep("select-token");
|
|
20275
20276
|
},
|
|
20276
20277
|
children: [
|
|
20277
20278
|
selectedWarpRoute ? /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "flex items-center gap-[var(--ui-kit-gap)]", children: [
|
|
@@ -20355,9 +20356,9 @@ function SelectStep(props) {
|
|
|
20355
20356
|
}
|
|
20356
20357
|
if (regex.test(value) || value === "") {
|
|
20357
20358
|
if (value === "") {
|
|
20358
|
-
setAmount("0");
|
|
20359
|
+
useBridgeStore.getState().setAmount("0");
|
|
20359
20360
|
} else {
|
|
20360
|
-
setAmount(value);
|
|
20361
|
+
useBridgeStore.getState().setAmount(value);
|
|
20361
20362
|
}
|
|
20362
20363
|
}
|
|
20363
20364
|
},
|
|
@@ -20388,7 +20389,7 @@ function SelectStep(props) {
|
|
|
20388
20389
|
Icon: import_lucide_react59.Wallet2Icon,
|
|
20389
20390
|
onChange: (e) => {
|
|
20390
20391
|
useFlowSelectorStore.getState().setError(null);
|
|
20391
|
-
setRecipient(e.target.value);
|
|
20392
|
+
useBridgeStore.getState().setRecipient(e.target.value);
|
|
20392
20393
|
},
|
|
20393
20394
|
element: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
20394
20395
|
Button,
|
|
@@ -20398,7 +20399,7 @@ function SelectStep(props) {
|
|
|
20398
20399
|
variant: "ghost",
|
|
20399
20400
|
onClick: (e) => {
|
|
20400
20401
|
e.stopPropagation();
|
|
20401
|
-
setRecipient(null);
|
|
20402
|
+
useBridgeStore.getState().setRecipient(null);
|
|
20402
20403
|
},
|
|
20403
20404
|
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react59.XIcon, { className: "w-4 h-4" })
|
|
20404
20405
|
}
|
|
@@ -20712,22 +20713,29 @@ function useHyperlaneHistory() {
|
|
|
20712
20713
|
queryKey: [HYPERLANE_HISTORY_QUERY_KEY, address, currentPage],
|
|
20713
20714
|
queryFn: async () => await getHyperlaneBridgeHistory({ page: currentPage, pageSize: TX_HISTORY_PAGE_SIZE })
|
|
20714
20715
|
});
|
|
20716
|
+
const updateExpandable = (0, import_react69.useCallback)(
|
|
20717
|
+
(0, import_lodash_es7.debounce)(() => {
|
|
20718
|
+
useFlowSelectorStore.getState().setRenderKey(`hyperlane-history-loaded-${Date.now()}`);
|
|
20719
|
+
}, 500),
|
|
20720
|
+
[]
|
|
20721
|
+
);
|
|
20715
20722
|
(0, import_react69.useEffect)(() => {
|
|
20716
20723
|
const { data, isLoading } = query;
|
|
20717
|
-
if (isLoading || data.data
|
|
20718
|
-
|
|
20719
|
-
}, [query
|
|
20724
|
+
if (isLoading || data.data?.length === 0) return;
|
|
20725
|
+
updateExpandable();
|
|
20726
|
+
}, [query]);
|
|
20720
20727
|
return {
|
|
20721
20728
|
...query,
|
|
20722
20729
|
currentPage,
|
|
20723
20730
|
setCurrentPage
|
|
20724
20731
|
};
|
|
20725
20732
|
}
|
|
20726
|
-
var import_react_query46, import_react69, HYPERLANE_HISTORY_QUERY_KEY, TX_HISTORY_PAGE_SIZE, TX_HISTORY_POLLING_INTERVAL;
|
|
20733
|
+
var import_react_query46, import_lodash_es7, import_react69, HYPERLANE_HISTORY_QUERY_KEY, TX_HISTORY_PAGE_SIZE, TX_HISTORY_POLLING_INTERVAL;
|
|
20727
20734
|
var init_useHyperlaneHistory = __esm({
|
|
20728
20735
|
"src/internal/components/SendMenu/hyperbridge/hooks/useHyperlaneHistory.ts"() {
|
|
20729
20736
|
init_SessionContext();
|
|
20730
20737
|
import_react_query46 = require("@tanstack/react-query");
|
|
20738
|
+
import_lodash_es7 = require("lodash-es");
|
|
20731
20739
|
import_react69 = require("react");
|
|
20732
20740
|
init_useLayoutDataStore();
|
|
20733
20741
|
init_useFlowSelector();
|
|
@@ -21124,7 +21132,7 @@ function HyperlaneBridge() {
|
|
|
21124
21132
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
21125
21133
|
const { swapDirection, handleQuoteEstimation, bridgeAsset, isAssetBridging } = useBridge();
|
|
21126
21134
|
const { hyperlaneWarpRoutes, isLoadingWarpRoutes } = useHyperlaneRoutes();
|
|
21127
|
-
const {
|
|
21135
|
+
const { directWalletProfile } = useAvailableSenders();
|
|
21128
21136
|
useMenuTitle(hyperlaneWarpRoutes);
|
|
21129
21137
|
(0, import_react71.useEffect)(
|
|
21130
21138
|
() => () => {
|
|
@@ -21133,7 +21141,7 @@ function HyperlaneBridge() {
|
|
|
21133
21141
|
[]
|
|
21134
21142
|
);
|
|
21135
21143
|
return /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(import_jsx_runtime99.Fragment, { children: [
|
|
21136
|
-
bridgeStep === "sender-selector" && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(SenderSelector, {
|
|
21144
|
+
bridgeStep === "sender-selector" && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(SenderSelector, { directWalletProfile }),
|
|
21137
21145
|
bridgeStep === "select" && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
21138
21146
|
SelectStep,
|
|
21139
21147
|
{
|
|
@@ -21228,7 +21236,7 @@ function useErc3643Compliance(options) {
|
|
|
21228
21236
|
isLoading,
|
|
21229
21237
|
error: queryError,
|
|
21230
21238
|
refetch
|
|
21231
|
-
} = (0,
|
|
21239
|
+
} = (0, import_wagmi5.useReadContract)({
|
|
21232
21240
|
address: tokenAddress,
|
|
21233
21241
|
abi: ERC3643_CAN_TRANSFER_ABI,
|
|
21234
21242
|
functionName: "canTransfer",
|
|
@@ -21265,10 +21273,10 @@ function useErc3643Compliance(options) {
|
|
|
21265
21273
|
refetch
|
|
21266
21274
|
};
|
|
21267
21275
|
}
|
|
21268
|
-
var
|
|
21276
|
+
var import_wagmi5, ERC3643_CAN_TRANSFER_ABI;
|
|
21269
21277
|
var init_useErc3643Compliance = __esm({
|
|
21270
21278
|
"src/hooks/useErc3643Compliance.ts"() {
|
|
21271
|
-
|
|
21279
|
+
import_wagmi5 = require("wagmi");
|
|
21272
21280
|
ERC3643_CAN_TRANSFER_ABI = [
|
|
21273
21281
|
{
|
|
21274
21282
|
type: "function",
|
|
@@ -24106,7 +24114,7 @@ var init_package = __esm({
|
|
|
24106
24114
|
"package.json"() {
|
|
24107
24115
|
package_default = {
|
|
24108
24116
|
name: "@embarkai/ui-kit",
|
|
24109
|
-
version: "0.4.
|
|
24117
|
+
version: "0.4.38",
|
|
24110
24118
|
description: "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
|
|
24111
24119
|
type: "module",
|
|
24112
24120
|
main: "./dist/index.cjs",
|
|
@@ -24475,17 +24483,17 @@ function useDecideContentStyles() {
|
|
|
24475
24483
|
return {
|
|
24476
24484
|
isClosing,
|
|
24477
24485
|
isMobileView,
|
|
24478
|
-
style: (0,
|
|
24486
|
+
style: (0, import_lodash_es8.merge)({}, mobileStyles)
|
|
24479
24487
|
};
|
|
24480
24488
|
}
|
|
24481
|
-
var DialogPrimitive,
|
|
24489
|
+
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
24490
|
var init_dialog = __esm({
|
|
24483
24491
|
"src/internal/components/ui/dialog.tsx"() {
|
|
24484
24492
|
init_utils2();
|
|
24485
24493
|
init_SessionContext();
|
|
24486
24494
|
init_i18n();
|
|
24487
24495
|
DialogPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
24488
|
-
|
|
24496
|
+
import_lodash_es8 = require("lodash-es");
|
|
24489
24497
|
import_lucide_react78 = require("lucide-react");
|
|
24490
24498
|
import_react84 = require("react");
|
|
24491
24499
|
init_useLayoutDataStore();
|
|
@@ -24781,10 +24789,10 @@ function WalletConnectHandler() {
|
|
|
24781
24789
|
const qc = (0, import_react_query54.useQueryClient)();
|
|
24782
24790
|
const { callbacksRef } = useProviderConfig();
|
|
24783
24791
|
const passportWalletAddress = useSession((st) => st.address);
|
|
24784
|
-
const { address: walletAddress, isConnected, chain, connector } = (0,
|
|
24792
|
+
const { address: walletAddress, isConnected, chain, connector } = (0, import_wagmi6.useAccount)();
|
|
24785
24793
|
const { openConnectModal, connectModalOpen } = (0, import_rainbowkit2.useConnectModal)();
|
|
24786
|
-
const { disconnect } = (0,
|
|
24787
|
-
const { signMessageAsync } = (0,
|
|
24794
|
+
const { disconnect } = (0, import_wagmi6.useDisconnect)();
|
|
24795
|
+
const { signMessageAsync } = (0, import_wagmi6.useSignMessage)();
|
|
24788
24796
|
const isWalletLinking = useLayoutDataStore((st) => st.isWalletLinking);
|
|
24789
24797
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
24790
24798
|
const setIsWalletLinking = useLayoutDataStore((st) => st.setIsWalletLinking);
|
|
@@ -25039,7 +25047,7 @@ function WalletConnectHandler() {
|
|
|
25039
25047
|
]);
|
|
25040
25048
|
return null;
|
|
25041
25049
|
}
|
|
25042
|
-
var import_rainbowkit2, import_react_query54, import_react87,
|
|
25050
|
+
var import_rainbowkit2, import_react_query54, import_react87, import_wagmi6;
|
|
25043
25051
|
var init_WalletConnectHandler = __esm({
|
|
25044
25052
|
"src/internal/components/WalletConnectHandler.tsx"() {
|
|
25045
25053
|
init_ProviderContext();
|
|
@@ -25048,7 +25056,7 @@ var init_WalletConnectHandler = __esm({
|
|
|
25048
25056
|
import_rainbowkit2 = require("@rainbow-me/rainbowkit");
|
|
25049
25057
|
import_react_query54 = require("@tanstack/react-query");
|
|
25050
25058
|
import_react87 = __toESM(require("react"), 1);
|
|
25051
|
-
|
|
25059
|
+
import_wagmi6 = require("wagmi");
|
|
25052
25060
|
init_wallet();
|
|
25053
25061
|
init_AuthMenu2();
|
|
25054
25062
|
init_useLayoutDataStore();
|
|
@@ -25060,7 +25068,7 @@ var init_WalletConnectHandler = __esm({
|
|
|
25060
25068
|
// src/internal/components/DirectWalletHandler.tsx
|
|
25061
25069
|
function DirectWalletHandler() {
|
|
25062
25070
|
const walletMode = useProviderConfig().config.current?.wallet?.mode || "linked";
|
|
25063
|
-
const { address, isConnected, chain, connector } = (0,
|
|
25071
|
+
const { address, isConnected, chain, connector } = (0, import_wagmi7.useAccount)();
|
|
25064
25072
|
const isExternalConnected = useExternalWalletStore((st) => st.isExternalConnected);
|
|
25065
25073
|
const externalAddress = useExternalWalletStore((st) => st.externalAddress);
|
|
25066
25074
|
const setExternalWallet = useExternalWalletStore((st) => st.setExternalWallet);
|
|
@@ -25104,11 +25112,11 @@ function DirectWalletHandler() {
|
|
|
25104
25112
|
}, [address, isConnected, isExternalConnected, externalAddress, chain?.id, connector, setExternalWallet]);
|
|
25105
25113
|
return null;
|
|
25106
25114
|
}
|
|
25107
|
-
var import_react88,
|
|
25115
|
+
var import_react88, import_wagmi7;
|
|
25108
25116
|
var init_DirectWalletHandler = __esm({
|
|
25109
25117
|
"src/internal/components/DirectWalletHandler.tsx"() {
|
|
25110
25118
|
import_react88 = require("react");
|
|
25111
|
-
|
|
25119
|
+
import_wagmi7 = require("wagmi");
|
|
25112
25120
|
init_ProviderContext();
|
|
25113
25121
|
init_useExternalWalletStore();
|
|
25114
25122
|
}
|
|
@@ -27562,13 +27570,13 @@ var init_iframe_manager = __esm({
|
|
|
27562
27570
|
});
|
|
27563
27571
|
|
|
27564
27572
|
// src/config/rainbowkit.ts
|
|
27565
|
-
var import_read18, import_rainbowkit3, import_wallets2,
|
|
27573
|
+
var import_read18, import_rainbowkit3, import_wallets2, import_wagmi8, import_chains12, getProjectId2, WALLET_MAP, getWagmiStorageKey, buildRainbowChains, createRainbowConfig, rainbowTheme;
|
|
27566
27574
|
var init_rainbowkit = __esm({
|
|
27567
27575
|
"src/config/rainbowkit.ts"() {
|
|
27568
27576
|
import_read18 = require("@embarkai/core/read");
|
|
27569
27577
|
import_rainbowkit3 = require("@rainbow-me/rainbowkit");
|
|
27570
27578
|
import_wallets2 = require("@rainbow-me/rainbowkit/wallets");
|
|
27571
|
-
|
|
27579
|
+
import_wagmi8 = require("wagmi");
|
|
27572
27580
|
import_chains12 = require("wagmi/chains");
|
|
27573
27581
|
getProjectId2 = (configProjectId) => {
|
|
27574
27582
|
if (configProjectId) return configProjectId;
|
|
@@ -27617,7 +27625,7 @@ var init_rainbowkit = __esm({
|
|
|
27617
27625
|
appName: "EmbarkAI Wallet",
|
|
27618
27626
|
projectId: getProjectId2(opts.projectId),
|
|
27619
27627
|
chains: buildRainbowChains(opts.supportedChains, opts.preferredChainId),
|
|
27620
|
-
storage: (0,
|
|
27628
|
+
storage: (0, import_wagmi8.createStorage)({ key: getWagmiStorageKey(opts) }),
|
|
27621
27629
|
ssr: false
|
|
27622
27630
|
};
|
|
27623
27631
|
if (opts.allowedWallets && opts.allowedWallets.length > 0) {
|
|
@@ -27847,14 +27855,14 @@ function RainbowKitProvider({ children }) {
|
|
|
27847
27855
|
};
|
|
27848
27856
|
}, [colorMode]);
|
|
27849
27857
|
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)(
|
|
27858
|
+
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
27859
|
}
|
|
27852
|
-
var import_rainbowkit4, import_react90,
|
|
27860
|
+
var import_rainbowkit4, import_react90, import_wagmi9, import_styles, import_jsx_runtime122;
|
|
27853
27861
|
var init_RainbowKitContext = __esm({
|
|
27854
27862
|
"src/context/RainbowKitContext.tsx"() {
|
|
27855
27863
|
import_rainbowkit4 = require("@rainbow-me/rainbowkit");
|
|
27856
27864
|
import_react90 = require("react");
|
|
27857
|
-
|
|
27865
|
+
import_wagmi9 = require("wagmi");
|
|
27858
27866
|
init_rainbowkit();
|
|
27859
27867
|
init_useLayoutStore();
|
|
27860
27868
|
init_ProviderContext();
|
|
@@ -27881,7 +27889,7 @@ var init_utils11 = __esm({
|
|
|
27881
27889
|
// src/config/wagmi.ts
|
|
27882
27890
|
function buildTransport(urls) {
|
|
27883
27891
|
const transports = urls.map(
|
|
27884
|
-
(url) => (0,
|
|
27892
|
+
(url) => (0, import_wagmi10.http)(url, {
|
|
27885
27893
|
timeout: 1e4,
|
|
27886
27894
|
retryCount: 0,
|
|
27887
27895
|
batch: false,
|
|
@@ -27897,35 +27905,35 @@ function buildTransport(urls) {
|
|
|
27897
27905
|
retryCount: 0
|
|
27898
27906
|
});
|
|
27899
27907
|
}
|
|
27900
|
-
var import_read19, import_viem20,
|
|
27908
|
+
var import_read19, import_viem20, import_wagmi10, import_chains13, wagmiConfig;
|
|
27901
27909
|
var init_wagmi = __esm({
|
|
27902
27910
|
"src/config/wagmi.ts"() {
|
|
27903
27911
|
import_read19 = require("@embarkai/core/read");
|
|
27904
27912
|
import_viem20 = require("viem");
|
|
27905
|
-
|
|
27913
|
+
import_wagmi10 = require("wagmi");
|
|
27906
27914
|
import_chains13 = require("wagmi/chains");
|
|
27907
|
-
wagmiConfig = (0,
|
|
27915
|
+
wagmiConfig = (0, import_wagmi10.createConfig)({
|
|
27908
27916
|
chains: [import_read19.lumiaMainnetChain, import_read19.lumiaTestnetChain, import_chains13.bsc, import_chains13.mainnet],
|
|
27909
|
-
storage: (0,
|
|
27917
|
+
storage: (0, import_wagmi10.createStorage)({ key: "embark-wagmi-static-v2" }),
|
|
27910
27918
|
transports: {
|
|
27911
27919
|
[import_read19.lumiaTestnetChain.id]: buildTransport(import_read19.lumiaTestnetChain.rpcUrls.default.http),
|
|
27912
27920
|
[import_read19.lumiaMainnetChain.id]: buildTransport(import_read19.lumiaMainnetChain.rpcUrls.default.http),
|
|
27913
|
-
[import_chains13.bsc.id]: (0,
|
|
27914
|
-
[import_chains13.mainnet.id]: (0,
|
|
27921
|
+
[import_chains13.bsc.id]: (0, import_wagmi10.http)(),
|
|
27922
|
+
[import_chains13.mainnet.id]: (0, import_wagmi10.http)()
|
|
27915
27923
|
}
|
|
27916
27924
|
});
|
|
27917
27925
|
}
|
|
27918
27926
|
});
|
|
27919
27927
|
|
|
27920
27928
|
// src/context/WagmiContext.tsx
|
|
27921
|
-
var
|
|
27929
|
+
var import_wagmi11, import_jsx_runtime123, WagmiProvider2;
|
|
27922
27930
|
var init_WagmiContext = __esm({
|
|
27923
27931
|
"src/context/WagmiContext.tsx"() {
|
|
27924
|
-
|
|
27932
|
+
import_wagmi11 = require("wagmi");
|
|
27925
27933
|
init_wagmi();
|
|
27926
27934
|
import_jsx_runtime123 = require("react/jsx-runtime");
|
|
27927
27935
|
WagmiProvider2 = ({ children }) => {
|
|
27928
|
-
return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
27936
|
+
return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(import_wagmi11.WagmiProvider, { config: wagmiConfig, children });
|
|
27929
27937
|
};
|
|
27930
27938
|
}
|
|
27931
27939
|
});
|
|
@@ -27950,7 +27958,7 @@ function Provider(props) {
|
|
|
27950
27958
|
const { children, projectId, initialConfig = {}, callbacks } = props;
|
|
27951
27959
|
const callbacksRef = (0, import_react91.useRef)(callbacks);
|
|
27952
27960
|
(0, import_react91.useEffect)(() => notifyNoProjetctId(projectId), [projectId]);
|
|
27953
|
-
const config = (0, import_react91.useRef)((0,
|
|
27961
|
+
const config = (0, import_react91.useRef)((0, import_lodash_es9.merge)({}, DEFAULT_PROVIDER_CONFIG, { projectId }, initialConfig));
|
|
27954
27962
|
const updateConfig = (0, import_react91.useCallback)((updates) => {
|
|
27955
27963
|
const prev = config.current;
|
|
27956
27964
|
const next = { ...prev };
|
|
@@ -27992,7 +28000,7 @@ function Provider(props) {
|
|
|
27992
28000
|
}, []);
|
|
27993
28001
|
(0, import_react91.useEffect)(() => {
|
|
27994
28002
|
if (typeof window === "undefined" || !projectId) return;
|
|
27995
|
-
const mergedConfig = (0,
|
|
28003
|
+
const mergedConfig = (0, import_lodash_es9.merge)(DEFAULT_PROVIDER_CONFIG, initialConfig);
|
|
27996
28004
|
updateConfig(mergedConfig);
|
|
27997
28005
|
if (mergedConfig.wallet?.enabled) {
|
|
27998
28006
|
clearLegacyWagmiStorage();
|
|
@@ -28054,11 +28062,11 @@ function Provider(props) {
|
|
|
28054
28062
|
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
28063
|
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
28064
|
}
|
|
28057
|
-
var import_error_tracking4,
|
|
28065
|
+
var import_error_tracking4, import_lodash_es9, import_react91, import_jsx_runtime124, UIContext, useProviderConfig;
|
|
28058
28066
|
var init_ProviderContext = __esm({
|
|
28059
28067
|
"src/context/ProviderContext.tsx"() {
|
|
28060
28068
|
import_error_tracking4 = require("@embarkai/core/internal/error-tracking");
|
|
28061
|
-
|
|
28069
|
+
import_lodash_es9 = require("lodash-es");
|
|
28062
28070
|
import_react91 = require("react");
|
|
28063
28071
|
init_initial();
|
|
28064
28072
|
init_iframe_manager();
|
|
@@ -29396,7 +29404,7 @@ function useWalletMode() {
|
|
|
29396
29404
|
// src/hooks/useDirectWallet.ts
|
|
29397
29405
|
var import_react96 = require("react");
|
|
29398
29406
|
var import_rainbowkit6 = require("@rainbow-me/rainbowkit");
|
|
29399
|
-
var
|
|
29407
|
+
var import_wagmi13 = require("wagmi");
|
|
29400
29408
|
init_useExternalWalletStore();
|
|
29401
29409
|
init_useLayoutDataStore();
|
|
29402
29410
|
function useDirectWallet() {
|
|
@@ -29405,7 +29413,7 @@ function useDirectWallet() {
|
|
|
29405
29413
|
const isConnected = useExternalWalletStore((st) => st.isExternalConnected);
|
|
29406
29414
|
const connectorName = useExternalWalletStore((st) => st.connectorName);
|
|
29407
29415
|
const clearExternalWallet = useExternalWalletStore((st) => st.clearExternalWallet);
|
|
29408
|
-
const { disconnect: wagmiDisconnect } = (0,
|
|
29416
|
+
const { disconnect: wagmiDisconnect } = (0, import_wagmi13.useDisconnect)();
|
|
29409
29417
|
const { openConnectModal } = (0, import_rainbowkit6.useConnectModal)();
|
|
29410
29418
|
const setIsWalletLinking = useLayoutDataStore((st) => st.setIsWalletLinking);
|
|
29411
29419
|
const connect = (0, import_react96.useCallback)(() => {
|
|
@@ -29432,13 +29440,13 @@ function useDirectWallet() {
|
|
|
29432
29440
|
// src/hooks/useSendDirectTransaction.ts
|
|
29433
29441
|
var import_react97 = require("react");
|
|
29434
29442
|
var import_viem21 = require("viem");
|
|
29435
|
-
var
|
|
29443
|
+
var import_wagmi14 = require("wagmi");
|
|
29436
29444
|
init_useExternalWalletStore();
|
|
29437
29445
|
function useSendDirectTransaction() {
|
|
29438
29446
|
const isConnected = useExternalWalletStore((st) => st.isExternalConnected);
|
|
29439
29447
|
const externalChainId = useExternalWalletStore((st) => st.externalChainId);
|
|
29440
|
-
const { sendTransactionAsync } = (0,
|
|
29441
|
-
const { switchChainAsync } = (0,
|
|
29448
|
+
const { sendTransactionAsync } = (0, import_wagmi14.useSendTransaction)();
|
|
29449
|
+
const { switchChainAsync } = (0, import_wagmi14.useSwitchChain)();
|
|
29442
29450
|
const [isPending, setIsPending] = (0, import_react97.useState)(false);
|
|
29443
29451
|
const [error, setError] = (0, import_react97.useState)(null);
|
|
29444
29452
|
const [txHash, setTxHash] = (0, import_react97.useState)(null);
|
|
@@ -29571,11 +29579,11 @@ function useTransferToLinkedWallet() {
|
|
|
29571
29579
|
}
|
|
29572
29580
|
|
|
29573
29581
|
// src/hooks/useNativeWalletSignature.ts
|
|
29574
|
-
var
|
|
29582
|
+
var import_wagmi15 = require("wagmi");
|
|
29575
29583
|
init_providers();
|
|
29576
29584
|
function useNativeWalletSignature() {
|
|
29577
|
-
const signMessage = (0,
|
|
29578
|
-
const signTypedMessage = (0,
|
|
29585
|
+
const signMessage = (0, import_wagmi15.useSignMessage)();
|
|
29586
|
+
const signTypedMessage = (0, import_wagmi15.useSignTypedData)();
|
|
29579
29587
|
return {
|
|
29580
29588
|
signMessage,
|
|
29581
29589
|
/** EIP-712 signature */
|
|
@@ -29640,13 +29648,13 @@ init_useBlockscoutAssets();
|
|
|
29640
29648
|
init_SessionContext();
|
|
29641
29649
|
var import_read22 = require("@embarkai/core/read");
|
|
29642
29650
|
var import_viem23 = require("viem");
|
|
29643
|
-
var
|
|
29651
|
+
var import_wagmi16 = require("wagmi");
|
|
29644
29652
|
function useTransactions() {
|
|
29645
29653
|
const chainId = requireActiveChainId();
|
|
29646
29654
|
const viemChain = (0, import_read22.getViemChain)(chainId);
|
|
29647
|
-
const publicClient = (0,
|
|
29648
|
-
const { data: walletClient } = (0,
|
|
29649
|
-
const { address } = (0,
|
|
29655
|
+
const publicClient = (0, import_wagmi16.usePublicClient)({ chainId });
|
|
29656
|
+
const { data: walletClient } = (0, import_wagmi16.useWalletClient)();
|
|
29657
|
+
const { address } = (0, import_wagmi16.useAccount)();
|
|
29650
29658
|
const sendTransaction = async (params) => {
|
|
29651
29659
|
if (!walletClient) {
|
|
29652
29660
|
throw new Error("Wallet not connected");
|
|
@@ -29706,7 +29714,7 @@ function useTransactions() {
|
|
|
29706
29714
|
init_SessionContext();
|
|
29707
29715
|
var import_react100 = __toESM(require("react"), 1);
|
|
29708
29716
|
var import_viem24 = require("viem");
|
|
29709
|
-
var
|
|
29717
|
+
var import_wagmi17 = require("wagmi");
|
|
29710
29718
|
var COMMON_TOKENS = [
|
|
29711
29719
|
// Add real token addresses here when available
|
|
29712
29720
|
// {
|
|
@@ -29723,7 +29731,7 @@ function useAssets(address) {
|
|
|
29723
29731
|
data: nativeBalance,
|
|
29724
29732
|
isLoading: nativeBalanceLoading,
|
|
29725
29733
|
refetch: refetchNativeBalance
|
|
29726
|
-
} = (0,
|
|
29734
|
+
} = (0, import_wagmi17.useBalance)({
|
|
29727
29735
|
address,
|
|
29728
29736
|
chainId,
|
|
29729
29737
|
query: {
|
|
@@ -29737,7 +29745,7 @@ function useAssets(address) {
|
|
|
29737
29745
|
args: [address],
|
|
29738
29746
|
chainId
|
|
29739
29747
|
}));
|
|
29740
|
-
const readContractsResult = (0,
|
|
29748
|
+
const readContractsResult = (0, import_wagmi17.useReadContracts)({
|
|
29741
29749
|
contracts: tokenContracts,
|
|
29742
29750
|
query: {
|
|
29743
29751
|
enabled: !!address && COMMON_TOKENS.length > 0
|
|
@@ -29818,7 +29826,7 @@ function useAssets(address) {
|
|
|
29818
29826
|
}
|
|
29819
29827
|
function useTokenInfo(tokenAddress) {
|
|
29820
29828
|
const chainId = requireActiveChainId();
|
|
29821
|
-
const readContractsResult = (0,
|
|
29829
|
+
const readContractsResult = (0, import_wagmi17.useReadContracts)({
|
|
29822
29830
|
contracts: [
|
|
29823
29831
|
{ address: tokenAddress, abi: import_viem24.erc20Abi, functionName: "name", chainId },
|
|
29824
29832
|
{ address: tokenAddress, abi: import_viem24.erc20Abi, functionName: "symbol", chainId },
|
|
@@ -29849,7 +29857,7 @@ function useTokenBalance(tokenAddress, userAddress) {
|
|
|
29849
29857
|
data: balance,
|
|
29850
29858
|
isLoading,
|
|
29851
29859
|
refetch
|
|
29852
|
-
} = (0,
|
|
29860
|
+
} = (0, import_wagmi17.useReadContract)({
|
|
29853
29861
|
address: tokenAddress,
|
|
29854
29862
|
abi: import_viem24.erc20Abi,
|
|
29855
29863
|
functionName: "balanceOf",
|