@iandjx/wallet
Version:
Implmentation of web3react-v8 for RT widgets
71 lines (64 loc) • 2.7 kB
TypeScript
import { Web3ReactHooks } from '@web3-react/core';
export * from '@web3-react/core';
import React, { ReactNode } from 'react';
import { Connector, AddEthereumChainParameter } from '@web3-react/types';
declare enum ConnectionType {
INJECTED = "INJECTED",
COINBASE_WALLET = "COINBASE_WALLET",
WALLET_CONNECT = "WALLET_CONNECT",
NETWORK = "NETWORK",
GNOSIS_SAFE = "GNOSIS_SAFE"
}
interface Connection {
connector: Connector;
hooks: Web3ReactHooks;
type: ConnectionType;
}
declare const networkConnection: Connection;
declare const injectedConnection: Connection;
declare const walletConnectConnection: Connection;
declare const coinbaseWalletConnection: Connection;
declare const ConnectionList: Connection[];
interface IWalletContext {
setSelectedWallet: (ConnectionType: undefined) => void;
selectedWallet: ConnectionType | undefined;
handleConnect: (connection: Connection, chainParams?: AddEthereumChainParameter) => Promise<void>;
loading: boolean;
}
declare const WalletContext: React.Context<IWalletContext>;
declare const WalletProvider: ({ children, connectToNetwork }: {
children: ReactNode;
connectToNetwork?: boolean | undefined;
}) => JSX.Element;
declare function useWallets(): IWalletContext;
interface BasicChainInformation {
urls: (string | undefined)[];
name: string;
}
declare enum NetworkName {
ETHEREUM = "ethereum",
AVALANCHE = "avalanche",
BINANCE = "bsc",
MOONBEAM = "moonbeam",
MOONRIVER = "moonriver",
METIS = "metis",
OPTIMISM = "optimism",
POLYGON = "polygon",
DFK = "dfk",
KLAYTN = "klaytn"
}
interface ExtendedChainInformation extends BasicChainInformation {
nativeCurrency: AddEthereumChainParameter['nativeCurrency'];
blockExplorerUrls: AddEthereumChainParameter['blockExplorerUrls'];
}
declare function getAddChainParameters(chainId: number): AddEthereumChainParameter;
declare const CHAINS: {
[chainId: number]: ExtendedChainInformation;
};
declare const URLS: {
[chainId: number]: string[];
};
declare const getAddChainParametersfromNetworkName: (network: NetworkName) => AddEthereumChainParameter | number;
declare function getConnection(connector: Connector | ConnectionType): Connection;
declare function getConnectionName(connectionType: ConnectionType, isMetaMask?: boolean, connectionName?: string): string;
export { CHAINS, Connection, ConnectionList, ConnectionType, IWalletContext, NetworkName, URLS, WalletContext, WalletProvider, coinbaseWalletConnection, getAddChainParameters, getAddChainParametersfromNetworkName, getConnection, getConnectionName, injectedConnection, networkConnection, useWallets, walletConnectConnection };