import { Message , SignedMessage , Signature , KeyInfo } from "../Types" ; import { MetamaskSigner } from "../../signers/MetamaskSigner" ; import { BaseWalletProvider } from "./BaseWalletProvider" ; import { FilecoinSnapApi } from "@nodefactory/filsnap-types" ; import { LotusClient } from "../.." ; import { WalletProviderInterface } from "../ProviderInterfaces" ; export class MetamaskWalletProvider extends BaseWalletProvider implements WalletProviderInterface { private signer : MetamaskSigner ; constructor ( client , filecoinApi ) { super ( client ) ; this . signer = new MetamaskSigner ( filecoinApi ) ; } public async newAddress ( ) { return undefined as any ; } public async deleteAddress ( address ) { return undefined as any ; } public async hasAddress ( address ) { return undefined as any ; } public async exportPrivateKey ( address ) { return undefined as any ; } public async getAddresses ( ) { return [ await this . getDefaultAddress ( ) ] ; } public async getDefaultAddress ( ) { return await this . signer . getDefaultAccount ( ) ; } public async setDefaultAddress ( address ) { return undefined ; } public async sendMessage ( msg ) { const signedMessage = await this . signMessage ( msg ) ; await this . sendSignedMessage ( signedMessage ) ; return signedMessage as SignedMessage ; } public async signMessage ( msg ) { return await this . signer . sign ( msg ) ; } public async sign ( data ) { return undefined as any ; } public async verify ( address , data , sign ) { return undefined as any ; } public getSigner ( ) { return this . signer ; } }