Last active
April 12, 2018 10:57
-
-
Save GrandSchtroumpf/6e47b5105db65c5e9f1d00c6e32b1c8c to your computer and use it in GitHub Desktop.
EthModule with web3 provider
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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