walletlink-e
Version:
WalletLink JavaScript SDK
58 lines (57 loc) • 2.71 kB
TypeScript
/// <reference types="node" />
import BN from "bn.js";
import { AddressString, IntNumber, RegExpString } from "../types";
import { Web3Request } from "./Web3Request";
import { ArbitraryResponse, EthereumAddressFromSignedMessageResponse, RequestEthereumAccountsResponse, ScanQRCodeResponse, SignEthereumMessageResponse, SignEthereumTransactionResponse, SubmitEthereumTransactionResponse, Web3Response } from "./Web3Response";
export interface EthereumTransactionParams {
fromAddress: AddressString;
toAddress: AddressString | null;
weiValue: BN;
data: Buffer;
nonce: IntNumber | null;
gasPriceInWei: BN | null;
gasLimit: BN | null;
chainId: IntNumber;
}
export interface WalletLinkRelayOptions {
walletLinkUrl: string;
version: string;
darkMode: boolean;
onDisconnected: any | null;
}
export declare class WalletLinkRelay {
private static callbacks;
private static accountRequestCallbackIds;
private readonly walletLinkUrl;
private readonly walletLinkOrigin;
private readonly storage;
private readonly session;
private readonly connection;
private readonly linkFlow;
private readonly snackbar;
private appName;
private appLogoUrl;
private attached;
private readonly onDisconnected;
constructor(options: Readonly<WalletLinkRelayOptions>);
resetAndReload(): void;
setAppInfo(appName: string, appLogoUrl: string | null): void;
attach(el: Element): void;
getStorageItem(key: string): string | null;
setStorageItem(key: string, value: string): void;
requestEthereumAccounts(): Promise<RequestEthereumAccountsResponse>;
signEthereumMessage(message: Buffer, address: AddressString, addPrefix: boolean, typedDataJson?: string | null): Promise<SignEthereumMessageResponse>;
ethereumAddressFromSignedMessage(message: Buffer, signature: Buffer, addPrefix: boolean): Promise<EthereumAddressFromSignedMessageResponse>;
signEthereumTransaction(params: EthereumTransactionParams): Promise<SignEthereumTransactionResponse>;
signAndSubmitEthereumTransaction(params: EthereumTransactionParams): Promise<SubmitEthereumTransactionResponse>;
submitEthereumTransaction(signedTransaction: Buffer, chainId: IntNumber): Promise<SubmitEthereumTransactionResponse>;
scanQRCode(regExp: RegExpString): Promise<ScanQRCodeResponse>;
arbitraryRequest(data: string): Promise<ArbitraryResponse>;
sendRequest<T extends Web3Request, U extends Web3Response>(request: T): Promise<U>;
private publishWeb3RequestEvent;
private publishWeb3RequestCanceledEvent;
private publishEvent;
private handleIncomingEvent;
private handleWeb3ResponseMessage;
private invokeCallback;
}