Skip to content

Instantly share code, notes, and snippets.

@GrandSchtroumpf
Last active April 12, 2018 10:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GrandSchtroumpf/6e47b5105db65c5e9f1d00c6e32b1c8c to your computer and use it in GitHub Desktop.
Save GrandSchtroumpf/6e47b5105db65c5e9f1d00c6e32b1c8c to your computer and use it in GitHub Desktop.
EthModule with web3 provider
import { NgModule, ModuleWithProviders, Type } from '@angular/core';
import { CommonModule } from '@angular/common';
// Web3
import { WEB3 } from './tokens';
const Web3 = require('web3');
// Services
import { AccountsService } from './eth.services';
@NgModule({
imports: [CommonModule],
declarations: [],
providers: [ AccountsService , {
provide: WEB3,
useFactory: (provider: any) => new Web3(Web3.givenProvider || "ws://localhost:8546"),
}]
})
export class EthereumModule {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment