Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@ngeth/eth

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ngeth/eth

> The `eth` module of web3 rebuild for Angular

latest
npmnpm
Version
0.0.5
Version published
Maintainers
1
Created
Source

@ngeth/eth

The eth module of web3 rebuild for Angular

Setup

npm install @ngeth/eth --save

Import EthModule

import { AppComponent } from './app.component';
import { EthModule } from '@ngeth/eth';

@NgModule({
  declarations: [AppComponent],
  imports: [
    BrowserModule,
    EthModule.forRoot(/* Provider */),  // You can add a custom Provider here
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

EthService

The EthService map the web3-eth methods into Observable.

import { Component, OnInit } from '@angular/core';
import { EthService } from '@ngeth/eth';
import { Observable } from 'rxjs';

@Component({
  selector: 'app-root',
  template: `
    <p>Current Block: {{ block$ | async }}</p>
    <ul>
        <li *ngFor="let account of accounts$ | async">
            {{ account }}
        </li>
    </ul>
    `,
  styles: []
})
export class AppComponent implements OnInit {
  public assets$: Observable<number>;
  public accounts$: Observable<string>;

  constructor(private eth: EthService) {}

  ngOnInit() {
    this.block$ = this.eth.getBlockNumber();
    this.accounts$ = this.eth.getAccounts();
  }

}

Contracts

The main strength of @ngeth/eth is the way it instanciate contract :

Keywords

Ethereum

FAQs

Package last updated on 24 Apr 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts