UNPKG

@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:

151 lines (150 loc) 5.56 kB
import { SingletonService } from '../singleton-service'; import { EvanCoreService } from './core'; import { EvanBCCService } from './bcc'; import { EvanQueue } from './queue'; import { QueueId } from './queue-utilities'; import { EvanTranslationService } from '../ui/translate'; import { EvanDescriptionService } from './description'; import { EvanUtilService } from '../utils'; /**************************************************************************************************/ /** * BCC addressbook wrapper * * @class Injectable EvanAddressBookService */ export declare class EvanAddressBookService { private bcc; private core; private description; private queue; private singleton; private translate; private utils; /** * Address book sync queue id */ queueId: QueueId; /** * latest loaded address book data */ current: any; /** * create singleton instance and create queue id */ constructor(bcc: EvanBCCService, core: EvanCoreService, description: EvanDescriptionService, queue: EvanQueue, singleton: SingletonService, translate: EvanTranslationService, utils: EvanUtilService); /** * Load the accounts from the address book from the blockchain and from the * queue. * * Sample: * { * // sharing keys * "keys": { * "0xd1fa932fa69a55fde0d943b1bff79a31e6dc943263697068711570adb652c409": { * "dataKey": "f5510ce31283edef95aeeccae3589cf60b35882e71c741636d5d64c4953b7e89" * }, * "0x1d84ab8f4f7b90d837bd2dea56ac559706d1e918f9fe0e85e7b2042a6a7e8ece": { * "commKey": "de6aa299ecabb7508cc6a64f295a1c493200f5cd22bbac10efed409188a616ec" * } * }, * "profile": { * "0x1813587e095cDdfd174DdB595372Cb738AA2753A": { * "alias": "My Account Alias" * }, * "0x1637Fa43D44a1Fb415D858a3cf4F7F8596A4048F": { * "alias": "My buddy" * } * }, * "0x1813587e095cDdfd174DdB595372Cb738AA2753A": { * "alias": "My account Alias" * }, * "0x1637Fa43D44a1Fb415D858a3cf4F7F8596A4048F": { * "alias": "My buddy" * } * } * * @return {Promise<any>} addressbok data */ loadAccounts(): Promise<any>; /** * Loads an account ids address book entry * * Sample: * { * "alias": "My buddy" * } * * @param {string} accountId account id to get the entry for * @return {Promise<string>} addressbook data */ loadAccount(accountId: string): Promise<string>; /** * Save an contact to the address book queue and sets a locally saved contact * type 'add' property, so the ui can display it as "adding" * * Usage: * this.addressBookService.addContactToQueue('0x00...', { * "isCreate": true, * "profile": { * "alias": "Test account", * "accountId": "0xf2009Fc431B326469005bB13370F1df67Ad852e9" * }, * "mail": { * "fromAlias": "My Account Alias", * "title": "Contact request", * "body": "Hi,\n\nI'd like to add you as a contact. Do you accept my invitation?\n\nWith kind regards,\n\nMy Account Alias" * }, * }); * * @param {string} accountId account id to add * @param {any} contact Contact object (accountId, alias, email * address) */ addContactToQueue(accountId: string, contact: any): void; /** * Remove an contact from the address book queue and sets a locally saved * contact type 'remove' property, so the ui can display it as "removing" * * Usage: * this.addressBookService.addRemoveContactToQueue(this.accountId, { * email: "..." * }); * * @param {string} accountId account id to remove * @param {any} contact Contact object (accountId, alias, email * address) */ addRemoveContactToQueue(accountId: string, contact: any): void; /** * Add an contact including type property to the queue. * * For usage have a look at "addContactToQueue" * * @param {any} contact Contact object (accountId, alias, email address) including type * property */ private saveContactToQueue; /** * Get the current configured user name. * * @param {boolean} disableNoAlias disable empty alis filling * @return {Promise<string>} users alias */ activeUserName(disableNoAlias?: boolean): Promise<string>; /** * Gets the name for a account from the addressbook. * * @param {string} accountId account id to load the alias for * @return {string} The name / email for account. Default is the account id. */ getNameForAccount(accountId: string): Promise<any>; /** * Gets the name for a account from the addressbook synchroniously by providing an already loaded * addressbook. * * @param {any} addressbook already loaded addressbook instance * @param {string} accountId account id to load the alias for * @return {string} The name / email for account. Default is the account id. */ getNameForAccountSync(addressbook: any, accountId: string): any; }