@evan.network/ui-angular-core
Version:
The angular-core operates as an global and central library for the evan.network Angular 5 frontend development. Using this project you will be able to to the following things:
116 lines (115 loc) • 3.9 kB
TypeScript
import { SingletonService } from '../singleton-service';
import { EvanTranslationService } from '../ui/translate';
import { EvanToastService } from '../ui/toast';
import { EvanUtilService } from '../utils';
import { EvanRoutingService } from '../ui/routing';
import { EvanAlertService } from '../ui/alert';
/**************************************************************************************************/
/**
* Core service for angular-core that handles dapp-browser connections, active
* accounts, current provider and more
*
* @class Injectable EvanCoreService
*/
export declare class EvanCoreService {
singleton: SingletonService;
translate: EvanTranslationService;
utils: EvanUtilService;
toast: EvanToastService;
routingService: EvanRoutingService;
alertService: EvanAlertService;
/**
* providers that can used
*/
private validProviders;
/**
* current web3 instance
*/
private web3;
/**
* base url of the evan.network smart agents server
*/
agentUrl: string;
/**
* load dependency services
*/
constructor(singleton: SingletonService, translate: EvanTranslationService, utils: EvanUtilService, toast: EvanToastService, routingService: EvanRoutingService, alertService: EvanAlertService);
/**
* Hides the initial loading that is embedded to the root dapp html page. =>
* It will disappear smooth and will be removed when animation is over
*/
finishDAppLoading(): void;
/**
* Get the current configured current provider
*
* @return {string} The current provider.
*/
getCurrentProvider(): string;
/**
* Check if we should use internal provider.
*
* @return {boolean} True if internal provider, False otherwise.
*/
isInternalProvider(): boolean;
/**
* Checks if a injected web3 provider exists an returns it's name
*/
getExternalProvider(): any;
/**
* Sets the current provider that should be used.
*
* @param {string} provider provider to switch to
*/
setCurrentProvider(provider: string): void;
/**
* Get the current selected account included the check of the current
* provider.
*
* @return {string} active account
*/
activeAccount(): string;
/**
* Returns the current saved account id
*
* @return {string} get account id from local storage
*/
getAccountId(): string;
/**
* Sets an account id as active one to the local storage.
*
* @param {string} accountId account id to set
*/
setAccountId(accountId: string): void;
/**
* Checks if an external provider is activated and returns it's active account
* id
*
* @return {string} The external account.
*/
getExternalAccount(): string;
/**
* Return the name of the current used browser =>
* https://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser
*
* @return {string} opera / firefox / safari / ie / edge / chrome
*/
currentBrowser(): any;
/**
* Get the balance of the current active or given account
*
* @param {string} accountId account id to get the balance for
* @return {Promise<number>} The balance.
*/
getBalance(accountId?: string): Promise<number>;
/**
* Logout the current user. Removes the active account, provider and terms of use acceptance.
*/
logout(): void;
/**
* Copes a string into the users clipboard and shows an toast, including the copied text
*
* @param {string} stringToCopy text that should be copied
* @param {string} toastMessage Provide a custom toast message
*/
copyString(stringToCopy: string, toastMessage?: string): void;
}