mirror of
https://github.com/embarklabs/embark.git
synced 2025-01-11 14:24:24 +00:00
fix(blockchain): fix metamask using the old web3
This commit is contained in:
parent
919d271996
commit
749c32cf07
@ -3,8 +3,14 @@
|
||||
const __embarkWeb3 = {};
|
||||
|
||||
__embarkWeb3.init = function(_config) {
|
||||
this.web3 = global.web3 || new Web3();
|
||||
global.web3 = global.web3 || this.web3;
|
||||
// Check if the global web3 object uses the old web3 (0.x)
|
||||
if (global.web3 && typeof global.web3.version !== 'string') {
|
||||
// If so, use a new instance using 1.0, but use its provider
|
||||
this.web3 = new Web3(global.web3.currentProvider);
|
||||
} else {
|
||||
this.web3 = global.web3 || new Web3();
|
||||
}
|
||||
global.web3 = this.web3;
|
||||
};
|
||||
|
||||
__embarkWeb3.getInstance = function () {
|
||||
|
Loading…
x
Reference in New Issue
Block a user