import type { BrowserProvider, Eip1193Provider, JsonRpcSigner } from 'ethers/providers'; import type { Listener } from 'ethers/utils'; import { LRUCache } from 'lru-cache'; import type { EIP6963ProviderInfo, SupportedEventProposals } from '../eip/index.ts'; import type { TypedDataDomain, TypedDataTypes, TypedDataValues } from '../types/index.ts'; import { EIP1193Events } from './EIP1193Events.ts'; /** * Base class for connecting to an ethereum compatible wallet */ export declare abstract class EthWalletConnectorBase extends EIP1193Events { allowedAccounts: string[]; provider: BrowserProvider | undefined; providerErrorLog: LRUCache; providerInfo: EIP6963ProviderInfo | undefined; rawProvider: Eip1193Provider | undefined; protected accountChangeNotifiers: Listener[]; protected chainChangedNotifiers: Listener[]; protected chainIdHex: string | undefined; abstract providerName: string; constructor(supportedEvents?: SupportedEventProposals[], rawProvider?: Eip1193Provider, providerName?: string); get chainId(): number | undefined; get chainName(): string | undefined; abstract get installed(): boolean; /** * Request to enable accounts in the wallet * This call is not wrapped in a try/catch by design. Errors from connecting to a wallet can be intentional behavior * (i.e. the user rejected the request to connect). Handle errors in the calling code. */ connectWallet(): Promise; /** * Request the current active allowed from the wallet */ currentAccounts(): Promise; /** * Request the current chain id selection on the wallet */ currentChainId(): Promise; /** * Sign a string with a specific account enabled in the wallet * * @param message Message to sign with the signer * @param allowedAccount Account being used to sign the message */ signMessage(message: string, allowedAccount?: string): Promise; /** * Sign a typed message with a specific account enabled in the wallet according to EIP-712 * @param domain eip712Domain * @param types A specific field of a structured eip-712 type. * @param value The contents of the message to sign * @param allowedAccount Account being used to sign the message * @returns * * see - https://eips.ethereum.org/EIPS/eip-712 */ signTypedMessage(domain: TypedDataDomain, types: TypedDataTypes, value: TypedDataValues, allowedAccount?: string): Promise; /** * Get a signer from a given address * * @param address Fetch a signer for a given address */ signerFromAddress(address?: string): Promise; /** * Pass a callback to be notified when accounts are changed * This is a notifier so it does not return updated values so check the allowed accounts * after the passed listener is invoked * * @param listener A notify function that will be called when allowed accounts change */ subscribeToAccountsChanges(listener: () => void): () => void; /** * Pass a callback to be notified when chainId is changed * This is a notifier so it does not return updated values so check the chainId * after the passed listener is invoked * * @param listener A notify function that will be called when chainId changes */ subscribeToChainChanges(listener: () => void): () => void; /** * Verify a typed data signature according to EIP-712 * @param domain eip712Domain * @param types A specific field of a structured eip-712 type. * @param value The contents of the message to sign * @param signature Signature produced by signTypedMessage * @param expectedSignerAddress Expected signer address to verify against * @returns boolean indicating if the signature is valid */ verifyTypedDataSignature(domain: TypedDataDomain, types: TypedDataTypes, value: TypedDataValues, signature: string, expectedSignerAddress: string): boolean; /** * Keep class state internally consistent */ protected onAccountsChangedListener(): Promise; /** * Keep class state internally consistent */ protected onChainChangedListener(): Promise; private logProviderErrors; private logProviderMissing; private notifySubscribers; private tryRpcSendCall; abstract init(provider?: BrowserProvider, info?: EIP6963ProviderInfo): void; } //# sourceMappingURL=EthWalletConnectorBase.d.ts.map