0.0.5 • Published 6 years ago

@ngeth/eth v0.0.5

Weekly downloads
1
License
MIT
Repository
-
Last release
6 years ago

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

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2-1

6 years ago

0.0.2

6 years ago

0.0.1-7

6 years ago

0.0.1-6

6 years ago

0.0.1-5

6 years ago

0.0.1-4

6 years ago