Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
446 B
3
Indexable
Never
import { BrowserProvider, JsonRpcSigner } from "ethers";

const getSigner = async (accountAddress: string, transport: any, chain: Chain | undefined) => {
    const network = {
        chainId: chain?.id,
        name: chain?.name,
        ensAddress: chain?.contracts?.ensRegistry?.address
    };

    const provider = new BrowserProvider(transport, network);
    const signer = new JsonRpcSigner(provider, accountAddress);

    return signer;
};