Skip to main content

Class: MetaMaskSigner

The MetaMaskSigner is a class that allows for signing data using MetaMask. This signer can only be used inside a browser.

Example​

import { MetaMaskSigner } from '@nilfoundation/niljs';

const signer = new MetaMaskSigner();

Implements​

Constructors​

new MetaMaskSigner()​

new MetaMaskSigner(): MetaMaskSigner

Creates an instance of MetaMaskSigner.

Returns​

MetaMaskSigner

Defined​

@nilfoundation/niljs/src/signers/MetmaskSigner.ts:25

Methods​

connect()​

connect(): Promise<void>

Connects the signer to an existing MetaMask wallet.

Returns​

Promise<void>

Async​

Defined​

@nilfoundation/niljs/src/signers/MetmaskSigner.ts:83


getAddress()​

getAddress(): Promise<Uint8Array>

Retrieves the wallet address.

Returns​

Promise<Uint8Array>

Async​

Implementation of​

ISigner.getAddress

Defined​

@nilfoundation/niljs/src/signers/MetmaskSigner.ts:59


getPublicKey()​

getPublicKey(): Promise<Uint8Array>

Retreieves the public key.

Returns​

Promise<Uint8Array>

Async​

Implementation of​

ISigner.getPublicKey

Defined​

@nilfoundation/niljs/src/signers/MetmaskSigner.ts:71


sign()​

sign(data): Promise<Uint8Array>

Signs the data.

Parameters​

ParameterTypeDescription

data

Uint8Array

The input data.

Returns​

Promise<Uint8Array>

The signed data.

Async​

Implementation of​

ISigner.sign

Defined​

@nilfoundation/niljs/src/signers/MetmaskSigner.ts:47