This project was generated with Angular CLI version 6.0.8.
The project requires NodeJS to be installed:
- Install webpack globally
npm -g webpack. - Move to project folder and run
npm i. - Run
sh build-dev.shorsh build-prod.shto build the project. The build artifacts will be stored in thedist/directory.
Run ng serve for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.
Run ng generate component component-name to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module.
The project requires NodeJS to be installed.
- Install webpack globally
npm -g webpack. - Move to project folder and run
npm i. - Run
sh build-dev.shorsh build-prod.shto build the project. The build artifacts will be stored in thedist/directory.
Run ng test to execute the unit tests via Karma.
Run ng e2e to execute the end-to-end tests via Protractor.
To get more help on the Angular CLI use ng help or go check out the Angular CLI README.
To integrate EOS Plugin into your project:
-
Install
eosjslibrary vianpmand retrieveEosinstance from it. -
Get plugin instance by
eosPluginLoadedevent, like:
document.addEventListener('eosPluginLoaded', () => {})- Request and cache identity like:
window.eosPlugin.requestIdentity({ host: 'jungle.eos.smartz.io', port: 443 })This call opens the prompt window where user can select predifined network account. Returns an identity with publicKey and accounts information. The plugin caches user selection for future operations.
- Get cached or request identity like:
window.eosPlugin.getIdentity({ host: 'jungle.eos.smartz.io', port: 443 })- Use EOS instance like:
window.eosPlugin.eos({ host: 'jungle.eos.smartz.io', port: 443 }, Eos, eosInstanceOptions)Usage example:
import * as Eos from 'eosjs';
const network = {
host: 'jungle.eos.smartz.io',
port: 443
};
document.addEventListener('eosPluginLoaded', () => {
const identity = window.eosPlugin.getIdentity(network);
if (identity) {
const { publicKey, accounts } = identity;
const eos = window.eosPlugin.eos(network, Eos);
eos.transaction(tr => {
// transaction code here
});
}
});