diff --git a/frontend/src/contracts.ts b/frontend/src/contracts.ts index 0c5f904..c7d06c8 100644 --- a/frontend/src/contracts.ts +++ b/frontend/src/contracts.ts @@ -5,7 +5,7 @@ import { type MessageBox, MessageBox__factory } from '@oasisprotocol/demo-starte export type { MessageBox } from '@oasisprotocol/demo-starter-backend'; import { useEthereumStore } from './stores/ethereum'; -import { VoidSigner } from 'ethers'; +import { type ContractRunner, VoidSigner } from 'ethers'; const addr = import.meta.env.VITE_MESSAGE_BOX_ADDR!; @@ -23,7 +23,7 @@ export function useMessageBox(): ComputedRef { return null; } - return MessageBox__factory.connect(addr, eth.signer); + return MessageBox__factory.connect(addr, eth.signer as ContractRunner); }); } diff --git a/frontend/src/stores/ethereum.ts b/frontend/src/stores/ethereum.ts index 0844dc3..e72e0fc 100644 --- a/frontend/src/stores/ethereum.ts +++ b/frontend/src/stores/ethereum.ts @@ -61,7 +61,7 @@ export function networkName(network?: Network): string { declare global { interface Window { - ethereum?: BrowserProvider & Eip1193Provider & sapphire.SapphireAnnex; + ethereum: BrowserProvider & Eip1193Provider & sapphire.SapphireAnnex; } } @@ -91,7 +91,7 @@ export const useEthereumStore = defineStore('ethereum', () => { throw new MetaMaskNotInstalledError('MetaMask not installed!'); } - return ethProvider; + return ethProvider as unknown as typeof window.ethereum; } async function init(addr: string, eth: Eip1193Provider) {