Interface IBrowserWalletAlpha

Interface to implement communication between this library, and a Browser Wallet. In order to request the signature from the User.

interface IBrowserWallet {
    signTypedData<T>(from, request): Promise<unknown>;
}

Methods

  • Sign data using the secret key stored on Browser Wallet It creates a popup window, presenting the human readable form of request

    Type Parameters

    • T

    Parameters

    • from: string

      the address used to sign the request

    • request: TypedData<T>

      the request to sign by the User in the form of EIP712 typed data.

    Returns Promise<unknown>

    Throws

    Throws an error if User rejected signature

    Example: The example implementation:

    async signTypedData<T>(from: string, request: TypedData<T>): Promise<unknown> {
    return await browserWallet.request({
    method: 'eth_signTypedData_v4',
    params: [from, JSON.stringify(request)],
    });
    }