UNPKG

@web3-react/coinbase-wallet

Version:
45 lines (44 loc) 2.1 kB
import type { CoinbaseWalletProvider, CoinbaseWalletSDK } from '@coinbase/wallet-sdk'; import type { Actions, AddEthereumChainParameter, WatchAssetParameters } from '@web3-react/types'; import { Connector } from '@web3-react/types'; type CoinbaseWalletSDKOptions = ConstructorParameters<typeof CoinbaseWalletSDK>[0] & { url: string; }; /** * @param options - Options to pass to `@coinbase/wallet-sdk`. * @param onError - Handler to report errors thrown from eventListeners. */ export interface CoinbaseWalletConstructorArgs { actions: Actions; options: CoinbaseWalletSDKOptions; onError?: (error: Error) => void; } export declare class CoinbaseWallet extends Connector { /** {@inheritdoc Connector.provider} */ provider: CoinbaseWalletProvider | undefined; private readonly options; private eagerConnection?; /** * A `CoinbaseWalletSDK` instance. */ coinbaseWallet: CoinbaseWalletSDK | undefined; constructor({ actions, options, onError }: CoinbaseWalletConstructorArgs); private get connected(); private isomorphicInitialize; /** {@inheritdoc Connector.connectEagerly} */ connectEagerly(): Promise<void>; /** * Initiates a connection. * * @param desiredChainIdOrChainParameters - If defined, indicates the desired chain to connect to. If the user is * already connected to this chain, no additional steps will be taken. Otherwise, the user will be prompted to switch * to the chain, if one of two conditions is met: either they already have it added, or the argument is of type * AddEthereumChainParameter, in which case the user will be prompted to add the chain with the specified parameters * first, before being prompted to switch. */ activate(desiredChainIdOrChainParameters?: number | AddEthereumChainParameter): Promise<void>; /** {@inheritdoc Connector.deactivate} */ deactivate(): void; watchAsset({ address, symbol, decimals, image, }: Pick<WatchAssetParameters, 'address'> & Partial<Omit<WatchAssetParameters, 'address'>>): Promise<true>; } export {};