@ngeth/eth
> The `eth` module of web3 rebuild for Angular
Last updated 3 years ago by grandschtroumpf .
MIT · Original npm · Tarball · package.json
$ cnpm install @ngeth/eth 
SYNC missed versions from official npm registry.

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


Current Tags

  • 0.0.5                                ...           latest (3 years ago)

9 Versions

  • 0.0.5                                ...           3 years ago
  • 0.0.4                                ...           3 years ago
  • 0.0.3                                ...           3 years ago
  • 0.0.2-1                                ...           3 years ago
  • 0.0.2                                ...           3 years ago
  • 0.0.1-7                                ...           3 years ago
  • 0.0.1-6                                ...           3 years ago
  • 0.0.1-5                                ...           3 years ago
  • 0.0.1-4                                ...           3 years ago
Downloads
Today 0
This Week 1
This Month 1
Last Day 1
Last Week 4
Last Month 15
Dependencies (1)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |