src/app/_services/web3.service.ts
Properties |
|
Methods |
|
constructor()
|
Defined in src/app/_services/web3.service.ts:9
|
Static getInstance |
getInstance()
|
Defined in src/app/_services/web3.service.ts:13
|
Returns :
Web3
|
Private Static web3 |
Type : Web3
|
Defined in src/app/_services/web3.service.ts:9
|
import { Injectable } from '@angular/core';
import Web3 from 'web3';
import { environment } from '@src/environments/environment';
@Injectable({
providedIn: 'root',
})
export class Web3Service {
private static web3: Web3;
constructor() {}
public static getInstance(): Web3 {
if (!Web3Service.web3) {
Web3Service.web3 = new Web3(environment.web3Provider);
}
return Web3Service.web3;
}
}