Created
July 31, 2018 18:59
-
-
Save GrandSchtroumpf/9c1191d26cc6f761bb66faaae2a92d4d to your computer and use it in GitHub Desktop.
The classic way to import web3 in Angular
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 { environment } from '../environments/environment'; | |
import { bindNodeCallback, Observable } from 'rxjs'; | |
@Injectable({ providedIn: 'root' }) | |
export class Web3Service { | |
public web3: Web3; | |
constructor() { | |
this.web3 = new Web3(environment.web3Provider); | |
} | |
public getAccounts(): Observable<string[]> { | |
return bindNodeCallback(this.web3.eth.getAccounts)(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment