Options
All
  • Public
  • Public/Protected
  • All
Menu

Class MetamaskWallet

Hierarchy

  • MetamaskWallet

Implements

Index

Constructors

constructor

  • new MetamaskWallet(__namedParameters: { address: string }): MetamaskWallet

Properties

address

address: string

chainId

chainId: number

Private internalPublicKey

internalPublicKey: string

Private mmProvider

mmProvider: Web3Provider

subtype

subtype: WalletSubType = WalletSubType.MetaMask

type

type: WalletType = WalletType.Software

Methods

getPublicKey

  • getPublicKey(): Promise<string>

recoverPublicKey

  • recoverPublicKey(currentAddress: string): Promise<string>
  • Recover the public key from a signed message. Sign a message, and use that signature to recover the (R), (S) signature components, along with the reco(V)ery param. We then use those values to recover, set internally, and return the public key.

    Parameters

    • currentAddress: string

      The current selected address. Note the we don't need to validate this here since it comes from a trusted source: the class constructor.

    Returns Promise<string>

    The recovered public key (for the currently selected addresss)

sign

signMessage

  • signMessage(messageObject: SignMessageObject): Promise<string>
  • Sign a message and return the signature. Useful for verifying identities.

    Parameters

    • messageObject: SignMessageObject

      the message you want to sign

    Returns Promise<string>

    The signed message hex string (wrapped inside a Promise)

verifyMessage

  • Verify a signed message. Useful for verifying identity. (In conjunction with signMessage)

    Parameters

    Returns Promise<boolean>

    A boolean to indicate if the message/signature pair are valid (wrapped inside a Promise)

Generated using TypeDoc