From 18af8d1ccc0f9945100d8e9594bb8f4dd3f5d760 Mon Sep 17 00:00:00 2001 From: Hemanth Sai Date: Tue, 31 Oct 2023 16:33:43 +0530 Subject: [PATCH] fix: fix build issue with window object (#841) --- frontend/src/store/features/wallet/walletService.ts | 2 ++ frontend/src/store/features/wallet/walletSlice.ts | 2 ++ frontend/src/txns/execute.ts | 2 ++ frontend/src/types/window.d.ts | 9 +++++++++ 4 files changed, 15 insertions(+) create mode 100644 frontend/src/types/window.d.ts diff --git a/frontend/src/store/features/wallet/walletService.ts b/frontend/src/store/features/wallet/walletService.ts index 01b725988..a9558e4b3 100644 --- a/frontend/src/store/features/wallet/walletService.ts +++ b/frontend/src/store/features/wallet/walletService.ts @@ -1,3 +1,5 @@ +declare let window: WalletWindow; + export const isWalletInstalled = (walletName: string): boolean => { switch (walletName) { case "keplr": diff --git a/frontend/src/store/features/wallet/walletSlice.ts b/frontend/src/store/features/wallet/walletSlice.ts index ff1eafc98..d6bf78de6 100644 --- a/frontend/src/store/features/wallet/walletSlice.ts +++ b/frontend/src/store/features/wallet/walletSlice.ts @@ -4,6 +4,8 @@ import { getWalletAmino } from "../../../txns/execute"; import { isWalletInstalled } from "./walletService"; import { isConnected, setConnected, setWalletName } from "../../../utils/localStorage"; +declare let window: WalletWindow; + interface ChainInfo { walletInfo: { name: string; diff --git a/frontend/src/txns/execute.ts b/frontend/src/txns/execute.ts index ce942f8ce..3e90b46ce 100644 --- a/frontend/src/txns/execute.ts +++ b/frontend/src/txns/execute.ts @@ -1,3 +1,5 @@ +declare let window: WalletWindow; + export async function getWalletAmino(chainID: string): Promise<[any, string]> { await window.wallet.enable(chainID); const offlineSigner = window.wallet.getOfflineSignerOnlyAmino(chainID); diff --git a/frontend/src/types/window.d.ts b/frontend/src/types/window.d.ts new file mode 100644 index 000000000..e712c1811 --- /dev/null +++ b/frontend/src/types/window.d.ts @@ -0,0 +1,9 @@ +import { KeplrWindow } from "@keplr-wallet/types"; +declare global { + interface WalletWindow extends Window { + keplr: KeplrWindow; + leap: any; + wallet: any; + cosmostation: any; + } +} \ No newline at end of file