mirror of
https://github.com/logos-messaging/logos-messaging-js.git
synced 2026-01-16 06:53:08 +00:00
* chore: setup rln as a new package * chore: migrate src * fix: wasm loading, tests, config * chore: fix Karma CI * fix: bundler * chore: copy dist resources * chore(rln): enable all tests * chore: increase karma timeouts
18 lines
528 B
TypeScript
18 lines
528 B
TypeScript
import { ethers } from "ethers";
|
|
|
|
export const extractMetaMaskSigner = async (): Promise<ethers.Signer> => {
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
const ethereum = (window as any).ethereum;
|
|
|
|
if (!ethereum) {
|
|
throw Error(
|
|
"Missing or invalid Ethereum provider. Please install a Web3 wallet such as MetaMask."
|
|
);
|
|
}
|
|
|
|
await ethereum.request({ method: "eth_requestAccounts" });
|
|
const provider = new ethers.providers.Web3Provider(ethereum, "any");
|
|
|
|
return provider.getSigner();
|
|
};
|