mirror of
https://github.com/oceanprotocol/commons.git
synced 2023-03-15 18:03:00 +01:00
Merge pull request #122 from oceanprotocol/fix/network-detection
Network detection tweaks
This commit is contained in:
commit
2729a5df8d
@ -2,7 +2,7 @@ const userMock = {
|
||||
isLogged: false,
|
||||
isLoading: false,
|
||||
isWeb3: false,
|
||||
isCorrectNetwork: false,
|
||||
isOceanNetwork: false,
|
||||
account: '',
|
||||
web3: {},
|
||||
ocean: {},
|
||||
@ -17,7 +17,7 @@ const userMockConnected = {
|
||||
isLogged: true,
|
||||
isLoading: false,
|
||||
isWeb3: true,
|
||||
isCorrectNetwork: true,
|
||||
isOceanNetwork: true,
|
||||
account: '0xxxxxx',
|
||||
web3: {},
|
||||
ocean: {},
|
||||
|
371
client/package-lock.json
generated
371
client/package-lock.json
generated
@ -1247,9 +1247,9 @@
|
||||
"integrity": "sha512-nOpbSE/BG+tQBfLXZ/EqSOvUPzOuot84vHxjAfEU8K3v4eOnqFJVo+oyB7KlcF87wBJXDmi/Ir9qHY4c0Saipg=="
|
||||
},
|
||||
"@oceanprotocol/squid": {
|
||||
"version": "0.5.8",
|
||||
"resolved": "https://registry.npmjs.org/@oceanprotocol/squid/-/squid-0.5.8.tgz",
|
||||
"integrity": "sha512-1hEOA5rF8qsLF6uSMVBAN4c6Licn2FCGdWLCHpZ6ePzyA2/3RXxhreUE/0mcTkmdITwlx1rCFFO+rYhDqgyPVQ==",
|
||||
"version": "0.5.10",
|
||||
"resolved": "https://registry.npmjs.org/@oceanprotocol/squid/-/squid-0.5.10.tgz",
|
||||
"integrity": "sha512-ApwrlixdMpGxf7EM/Vpy27UAGYHCTAw7XiRjpuLeK7o1dHBXMdBAcfb1esypFob+ZOeq9UseVZ1rWQaPf+ROmA==",
|
||||
"requires": {
|
||||
"@oceanprotocol/keeper-contracts": "^0.9.1",
|
||||
"bignumber.js": "^8.1.1",
|
||||
@ -1260,345 +1260,6 @@
|
||||
"uuid": "^3.3.2",
|
||||
"web3": "1.0.0-beta.37",
|
||||
"whatwg-url": "^7.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"bn.js": {
|
||||
"version": "4.11.6",
|
||||
"resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz",
|
||||
"integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU="
|
||||
},
|
||||
"elliptic": {
|
||||
"version": "6.3.3",
|
||||
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.3.3.tgz",
|
||||
"integrity": "sha1-VILZZG1UvLif19mU/J4ulWiHbj8=",
|
||||
"requires": {
|
||||
"bn.js": "^4.4.0",
|
||||
"brorand": "^1.0.1",
|
||||
"hash.js": "^1.0.0",
|
||||
"inherits": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"ethers": {
|
||||
"version": "4.0.0-beta.1",
|
||||
"resolved": "https://registry.npmjs.org/ethers/-/ethers-4.0.0-beta.1.tgz",
|
||||
"integrity": "sha512-SoYhktEbLxf+fiux5SfCEwdzWENMvgIbMZD90I62s4GZD9nEjgEWy8ZboI3hck193Vs0bDoTohDISx84f2H2tw==",
|
||||
"requires": {
|
||||
"@types/node": "^10.3.2",
|
||||
"aes-js": "3.0.0",
|
||||
"bn.js": "^4.4.0",
|
||||
"elliptic": "6.3.3",
|
||||
"hash.js": "1.1.3",
|
||||
"js-sha3": "0.5.7",
|
||||
"scrypt-js": "2.0.3",
|
||||
"setimmediate": "1.0.4",
|
||||
"uuid": "2.0.1",
|
||||
"xmlhttprequest": "1.8.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"setimmediate": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.4.tgz",
|
||||
"integrity": "sha1-IOgd5iLUoCWIzgyNqJc8vPHTE48="
|
||||
},
|
||||
"uuid": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-2.0.1.tgz",
|
||||
"integrity": "sha1-wqMN7bPlNdcsz4LjQ5QaULqFM6w="
|
||||
}
|
||||
}
|
||||
},
|
||||
"eventemitter3": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-1.1.1.tgz",
|
||||
"integrity": "sha1-R3hr2qCHyvext15zq8XH1UAVjNA="
|
||||
},
|
||||
"fs-extra": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-2.1.2.tgz",
|
||||
"integrity": "sha1-BGxwFjzvmq1GsOSn+kZ/si1x3jU=",
|
||||
"requires": {
|
||||
"graceful-fs": "^4.1.2",
|
||||
"jsonfile": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"hash.js": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.3.tgz",
|
||||
"integrity": "sha512-/UETyP0W22QILqS+6HowevwhEFJ3MBJnwTf75Qob9Wz9t0DPuisL8kW8YZMK62dHAKE1c1p+gY1TtOLY+USEHA==",
|
||||
"requires": {
|
||||
"inherits": "^2.0.3",
|
||||
"minimalistic-assert": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"js-sha3": {
|
||||
"version": "0.5.7",
|
||||
"resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.5.7.tgz",
|
||||
"integrity": "sha1-DU/9gALVMzqrr0oj7tL2N0yfKOc="
|
||||
},
|
||||
"jsonfile": {
|
||||
"version": "2.4.0",
|
||||
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz",
|
||||
"integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=",
|
||||
"requires": {
|
||||
"graceful-fs": "^4.1.6"
|
||||
}
|
||||
},
|
||||
"scrypt-js": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-2.0.3.tgz",
|
||||
"integrity": "sha1-uwBAvgMEPamgEqLOqfyfhSz8h9Q="
|
||||
},
|
||||
"swarm-js": {
|
||||
"version": "0.1.37",
|
||||
"resolved": "https://registry.npmjs.org/swarm-js/-/swarm-js-0.1.37.tgz",
|
||||
"integrity": "sha512-G8gi5fcXP/2upwiuOShJ258sIufBVztekgobr3cVgYXObZwJ5AXLqZn52AI+/ffft29pJexF9WNdUxjlkVehoQ==",
|
||||
"requires": {
|
||||
"bluebird": "^3.5.0",
|
||||
"buffer": "^5.0.5",
|
||||
"decompress": "^4.0.0",
|
||||
"eth-lib": "^0.1.26",
|
||||
"fs-extra": "^2.1.2",
|
||||
"fs-promise": "^2.0.0",
|
||||
"got": "^7.1.0",
|
||||
"mime-types": "^2.1.16",
|
||||
"mkdirp-promise": "^5.0.1",
|
||||
"mock-fs": "^4.1.0",
|
||||
"setimmediate": "^1.0.5",
|
||||
"tar.gz": "^1.0.5",
|
||||
"xhr-request-promise": "^0.1.2"
|
||||
}
|
||||
},
|
||||
"web3": {
|
||||
"version": "1.0.0-beta.37",
|
||||
"resolved": "https://registry.npmjs.org/web3/-/web3-1.0.0-beta.37.tgz",
|
||||
"integrity": "sha512-8XLgUspdzicC/xHG82TLrcF/Fxzj2XYNJ1KTYnepOI77bj5rvpsxxwHYBWQ6/JOjk0HkZqoBfnXWgcIHCDhZhQ==",
|
||||
"requires": {
|
||||
"web3-bzz": "1.0.0-beta.37",
|
||||
"web3-core": "1.0.0-beta.37",
|
||||
"web3-eth": "1.0.0-beta.37",
|
||||
"web3-eth-personal": "1.0.0-beta.37",
|
||||
"web3-net": "1.0.0-beta.37",
|
||||
"web3-shh": "1.0.0-beta.37",
|
||||
"web3-utils": "1.0.0-beta.37"
|
||||
}
|
||||
},
|
||||
"web3-bzz": {
|
||||
"version": "1.0.0-beta.37",
|
||||
"resolved": "https://registry.npmjs.org/web3-bzz/-/web3-bzz-1.0.0-beta.37.tgz",
|
||||
"integrity": "sha512-E+dho49Nsm/QpQvYWOF35YDsQrMvLB19AApENxhlQsu6HpWQt534DQul0t3Y/aAh8rlKD6Kanxt8LhHDG3vejQ==",
|
||||
"requires": {
|
||||
"got": "7.1.0",
|
||||
"swarm-js": "0.1.37",
|
||||
"underscore": "1.8.3"
|
||||
}
|
||||
},
|
||||
"web3-core": {
|
||||
"version": "1.0.0-beta.37",
|
||||
"resolved": "https://registry.npmjs.org/web3-core/-/web3-core-1.0.0-beta.37.tgz",
|
||||
"integrity": "sha512-cIwEqCj7OJyefQNauI0HOgW4sSaOQ98V99H2/HEIlnCZylsDzfw7gtQUdwnRFiIyIxjbWy3iWsjwDPoXNPZBYg==",
|
||||
"requires": {
|
||||
"web3-core-helpers": "1.0.0-beta.37",
|
||||
"web3-core-method": "1.0.0-beta.37",
|
||||
"web3-core-requestmanager": "1.0.0-beta.37",
|
||||
"web3-utils": "1.0.0-beta.37"
|
||||
}
|
||||
},
|
||||
"web3-core-helpers": {
|
||||
"version": "1.0.0-beta.37",
|
||||
"resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.0.0-beta.37.tgz",
|
||||
"integrity": "sha512-efaLOzN28RMnbugnyelgLwPWWaSwElQzcAJ/x3PZu+uPloM/lE5x0YuBKvIh7/PoSMlHqtRWj1B8CpuQOUQ5Ew==",
|
||||
"requires": {
|
||||
"underscore": "1.8.3",
|
||||
"web3-eth-iban": "1.0.0-beta.37",
|
||||
"web3-utils": "1.0.0-beta.37"
|
||||
}
|
||||
},
|
||||
"web3-core-method": {
|
||||
"version": "1.0.0-beta.37",
|
||||
"resolved": "https://registry.npmjs.org/web3-core-method/-/web3-core-method-1.0.0-beta.37.tgz",
|
||||
"integrity": "sha512-pKWFUeqnVmzx3VrZg+CseSdrl/Yrk2ioid/HzolNXZE6zdoITZL0uRjnsbqXGEzgRRd1Oe/pFndpTlRsnxXloA==",
|
||||
"requires": {
|
||||
"underscore": "1.8.3",
|
||||
"web3-core-helpers": "1.0.0-beta.37",
|
||||
"web3-core-promievent": "1.0.0-beta.37",
|
||||
"web3-core-subscriptions": "1.0.0-beta.37",
|
||||
"web3-utils": "1.0.0-beta.37"
|
||||
}
|
||||
},
|
||||
"web3-core-subscriptions": {
|
||||
"version": "1.0.0-beta.37",
|
||||
"resolved": "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-1.0.0-beta.37.tgz",
|
||||
"integrity": "sha512-FdXl8so9kwkRRWziuCSpFsAuAdg9KvpXa1fQlT16uoGcYYfxwFO/nkwyBGQzkZt7emShI2IRugcazyPCZDwkOA==",
|
||||
"requires": {
|
||||
"eventemitter3": "1.1.1",
|
||||
"underscore": "1.8.3",
|
||||
"web3-core-helpers": "1.0.0-beta.37"
|
||||
}
|
||||
},
|
||||
"web3-eth": {
|
||||
"version": "1.0.0-beta.37",
|
||||
"resolved": "https://registry.npmjs.org/web3-eth/-/web3-eth-1.0.0-beta.37.tgz",
|
||||
"integrity": "sha512-Eb3aGtkz3G9q+Z9DKgSQNbn/u8RtcZQQ0R4sW9hy5KK47GoT6vab5c6DiD3QWzI0BzitHzR5Ji+3VHf/hPUGgw==",
|
||||
"requires": {
|
||||
"underscore": "1.8.3",
|
||||
"web3-core": "1.0.0-beta.37",
|
||||
"web3-core-helpers": "1.0.0-beta.37",
|
||||
"web3-core-method": "1.0.0-beta.37",
|
||||
"web3-core-subscriptions": "1.0.0-beta.37",
|
||||
"web3-eth-abi": "1.0.0-beta.37",
|
||||
"web3-eth-accounts": "1.0.0-beta.37",
|
||||
"web3-eth-contract": "1.0.0-beta.37",
|
||||
"web3-eth-ens": "1.0.0-beta.37",
|
||||
"web3-eth-iban": "1.0.0-beta.37",
|
||||
"web3-eth-personal": "1.0.0-beta.37",
|
||||
"web3-net": "1.0.0-beta.37",
|
||||
"web3-utils": "1.0.0-beta.37"
|
||||
}
|
||||
},
|
||||
"web3-eth-abi": {
|
||||
"version": "1.0.0-beta.37",
|
||||
"resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.0.0-beta.37.tgz",
|
||||
"integrity": "sha512-g9DKZGM2OqwKp/tX3W/yihcj7mQCtJ6CXyZXEIZfuDyRBED/iSEIFfieDOd+yo16sokLMig6FG7ADhhu+19hdA==",
|
||||
"requires": {
|
||||
"ethers": "4.0.0-beta.1",
|
||||
"underscore": "1.8.3",
|
||||
"web3-utils": "1.0.0-beta.37"
|
||||
}
|
||||
},
|
||||
"web3-eth-accounts": {
|
||||
"version": "1.0.0-beta.37",
|
||||
"resolved": "https://registry.npmjs.org/web3-eth-accounts/-/web3-eth-accounts-1.0.0-beta.37.tgz",
|
||||
"integrity": "sha512-uvbHL62/zwo4GDmwKdqH9c/EgYd8QVnAfpVw8D3epSISpgbONNY7Hr4MRMSd/CqAP12l2Ls9JVQGLhhC83bW6g==",
|
||||
"requires": {
|
||||
"any-promise": "1.3.0",
|
||||
"crypto-browserify": "3.12.0",
|
||||
"eth-lib": "0.2.7",
|
||||
"scrypt.js": "0.2.0",
|
||||
"underscore": "1.8.3",
|
||||
"uuid": "2.0.1",
|
||||
"web3-core": "1.0.0-beta.37",
|
||||
"web3-core-helpers": "1.0.0-beta.37",
|
||||
"web3-core-method": "1.0.0-beta.37",
|
||||
"web3-utils": "1.0.0-beta.37"
|
||||
},
|
||||
"dependencies": {
|
||||
"elliptic": {
|
||||
"version": "6.4.1",
|
||||
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.1.tgz",
|
||||
"integrity": "sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ==",
|
||||
"requires": {
|
||||
"bn.js": "^4.4.0",
|
||||
"brorand": "^1.0.1",
|
||||
"hash.js": "^1.0.0",
|
||||
"hmac-drbg": "^1.0.0",
|
||||
"inherits": "^2.0.1",
|
||||
"minimalistic-assert": "^1.0.0",
|
||||
"minimalistic-crypto-utils": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"eth-lib": {
|
||||
"version": "0.2.7",
|
||||
"resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.7.tgz",
|
||||
"integrity": "sha1-L5Pxex4jrsN1nNSj/iDBKGo/wco=",
|
||||
"requires": {
|
||||
"bn.js": "^4.11.6",
|
||||
"elliptic": "^6.4.0",
|
||||
"xhr-request-promise": "^0.1.2"
|
||||
}
|
||||
},
|
||||
"uuid": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-2.0.1.tgz",
|
||||
"integrity": "sha1-wqMN7bPlNdcsz4LjQ5QaULqFM6w="
|
||||
}
|
||||
}
|
||||
},
|
||||
"web3-eth-contract": {
|
||||
"version": "1.0.0-beta.37",
|
||||
"resolved": "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-1.0.0-beta.37.tgz",
|
||||
"integrity": "sha512-h1B3A8Z/C7BlnTCHkrWbXZQTViDxfR12lKMeTkT8Sqj5phFmxrBlPE4ORy4lf1Dk5b23mZYE0r/IRACx4ThCrQ==",
|
||||
"requires": {
|
||||
"underscore": "1.8.3",
|
||||
"web3-core": "1.0.0-beta.37",
|
||||
"web3-core-helpers": "1.0.0-beta.37",
|
||||
"web3-core-method": "1.0.0-beta.37",
|
||||
"web3-core-promievent": "1.0.0-beta.37",
|
||||
"web3-core-subscriptions": "1.0.0-beta.37",
|
||||
"web3-eth-abi": "1.0.0-beta.37",
|
||||
"web3-utils": "1.0.0-beta.37"
|
||||
}
|
||||
},
|
||||
"web3-eth-ens": {
|
||||
"version": "1.0.0-beta.37",
|
||||
"resolved": "https://registry.npmjs.org/web3-eth-ens/-/web3-eth-ens-1.0.0-beta.37.tgz",
|
||||
"integrity": "sha512-dR3UkrVzdRrJhfP57xBPx0CMiVnCcYFvh+u2XMkGydrhHgupSUkjqGr89xry/j1T0BkuN9mikpbyhdCVMXqMbg==",
|
||||
"requires": {
|
||||
"eth-ens-namehash": "2.0.8",
|
||||
"underscore": "1.8.3",
|
||||
"web3-core": "1.0.0-beta.37",
|
||||
"web3-core-helpers": "1.0.0-beta.37",
|
||||
"web3-core-promievent": "1.0.0-beta.37",
|
||||
"web3-eth-abi": "1.0.0-beta.37",
|
||||
"web3-eth-contract": "1.0.0-beta.37",
|
||||
"web3-utils": "1.0.0-beta.37"
|
||||
}
|
||||
},
|
||||
"web3-eth-iban": {
|
||||
"version": "1.0.0-beta.37",
|
||||
"resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.0.0-beta.37.tgz",
|
||||
"integrity": "sha512-WQRniGJFxH/XCbd7miO6+jnUG+6bvuzfeufPIiOtCbeIC1ypp1kSqER8YVBDrTyinU1xnf1U5v0KBZ2yiWBJxQ==",
|
||||
"requires": {
|
||||
"bn.js": "4.11.6",
|
||||
"web3-utils": "1.0.0-beta.37"
|
||||
}
|
||||
},
|
||||
"web3-eth-personal": {
|
||||
"version": "1.0.0-beta.37",
|
||||
"resolved": "https://registry.npmjs.org/web3-eth-personal/-/web3-eth-personal-1.0.0-beta.37.tgz",
|
||||
"integrity": "sha512-B4dZpGbD+nGnn48i6nJBqrQ+HB7oDmd+Q3wGRKOsHSK5HRWO/KwYeA7wgwamMAElkut50lIsT9EJl4Apfk3G5Q==",
|
||||
"requires": {
|
||||
"web3-core": "1.0.0-beta.37",
|
||||
"web3-core-helpers": "1.0.0-beta.37",
|
||||
"web3-core-method": "1.0.0-beta.37",
|
||||
"web3-net": "1.0.0-beta.37",
|
||||
"web3-utils": "1.0.0-beta.37"
|
||||
}
|
||||
},
|
||||
"web3-net": {
|
||||
"version": "1.0.0-beta.37",
|
||||
"resolved": "https://registry.npmjs.org/web3-net/-/web3-net-1.0.0-beta.37.tgz",
|
||||
"integrity": "sha512-xG/uBtMdDa1UMXw9KjDUgf3fXA/fDEJUYUS0TDn+U9PMgngA+UVECHNNvQTrVVDxEky38V3sahwIDiopNsQdsw==",
|
||||
"requires": {
|
||||
"web3-core": "1.0.0-beta.37",
|
||||
"web3-core-method": "1.0.0-beta.37",
|
||||
"web3-utils": "1.0.0-beta.37"
|
||||
}
|
||||
},
|
||||
"web3-shh": {
|
||||
"version": "1.0.0-beta.37",
|
||||
"resolved": "https://registry.npmjs.org/web3-shh/-/web3-shh-1.0.0-beta.37.tgz",
|
||||
"integrity": "sha512-h5STG/xqZNQWtCLYOu7NiMqwqPea8SfkKQUPUFxXKIPVCFVKpHuQEwW1qcPQRJMLhlQIv17xuoUe1A+RzDNbrw==",
|
||||
"requires": {
|
||||
"web3-core": "1.0.0-beta.37",
|
||||
"web3-core-method": "1.0.0-beta.37",
|
||||
"web3-core-subscriptions": "1.0.0-beta.37",
|
||||
"web3-net": "1.0.0-beta.37"
|
||||
}
|
||||
},
|
||||
"web3-utils": {
|
||||
"version": "1.0.0-beta.37",
|
||||
"resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.37.tgz",
|
||||
"integrity": "sha512-kA1fyhO8nKgU21wi30oJQ/ssvu+9srMdjOTKbHYbQe4ATPcr5YNwwrxG3Bcpbu1bEwRUVKHCkqi+wTvcAWBdlQ==",
|
||||
"requires": {
|
||||
"bn.js": "4.11.6",
|
||||
"eth-lib": "0.1.27",
|
||||
"ethjs-unit": "0.1.6",
|
||||
"number-to-bn": "1.7.0",
|
||||
"randomhex": "0.1.5",
|
||||
"underscore": "1.8.3",
|
||||
"utf8": "2.1.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@oceanprotocol/typographies": {
|
||||
@ -6716,9 +6377,9 @@
|
||||
}
|
||||
},
|
||||
"file-saver": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/file-saver/-/file-saver-2.0.1.tgz",
|
||||
"integrity": "sha512-dCB3K7/BvAcUmtmh1DzFdv0eXSVJ9IAFt1mw3XZfAexodNRoE29l3xB2EX4wH2q8m/UTzwzEPq/ArYk98kUkBQ=="
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/file-saver/-/file-saver-2.0.2.tgz",
|
||||
"integrity": "sha512-Wz3c3XQ5xroCxd1G8b7yL0Ehkf0TC9oYC6buPFkNnU9EnaPlifeAFCyCh+iewXTyFRcg0a6j3J7FmJsIhlhBdw=="
|
||||
},
|
||||
"file-type": {
|
||||
"version": "5.2.0",
|
||||
@ -14295,18 +13956,18 @@
|
||||
}
|
||||
},
|
||||
"secp256k1": {
|
||||
"version": "3.6.2",
|
||||
"resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-3.6.2.tgz",
|
||||
"integrity": "sha512-90nYt7yb0LmI4A2jJs1grglkTAXrBwxYAjP9bpeKjvJKOjG2fOeH/YI/lchDMIvjrOasd5QXwvV2jwN168xNng==",
|
||||
"version": "3.7.0",
|
||||
"resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-3.7.0.tgz",
|
||||
"integrity": "sha512-YlUIghD6ilkMkzmFJpIdVjiamv2S8lNZ9YMwm1XII9JC0NcR5qQiv2DOp/G37sExBtaMStzba4VDJtvBXEbmMQ==",
|
||||
"requires": {
|
||||
"bindings": "^1.2.1",
|
||||
"bip66": "^1.1.3",
|
||||
"bn.js": "^4.11.3",
|
||||
"create-hash": "^1.1.2",
|
||||
"bindings": "^1.5.0",
|
||||
"bip66": "^1.1.5",
|
||||
"bn.js": "^4.11.8",
|
||||
"create-hash": "^1.2.0",
|
||||
"drbg.js": "^1.0.1",
|
||||
"elliptic": "^6.2.3",
|
||||
"nan": "^2.2.1",
|
||||
"safe-buffer": "^5.1.0"
|
||||
"elliptic": "^6.4.1",
|
||||
"nan": "^2.13.2",
|
||||
"safe-buffer": "^5.1.2"
|
||||
}
|
||||
},
|
||||
"seek-bzip": {
|
||||
|
@ -13,7 +13,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@oceanprotocol/art": "^2.2.0",
|
||||
"@oceanprotocol/squid": "^0.5.8",
|
||||
"@oceanprotocol/squid": "^0.5.10",
|
||||
"@oceanprotocol/typographies": "^0.1.0",
|
||||
"classnames": "^2.2.6",
|
||||
"ethereum-blockies": "MyEtherWallet/blockies",
|
||||
|
@ -22,7 +22,7 @@ const Indicator = ({
|
||||
{states =>
|
||||
!states.isWeb3 ? (
|
||||
<span className={styles.statusIndicator} />
|
||||
) : !states.isLogged || !states.isCorrectNetwork ? (
|
||||
) : !states.isLogged || !states.isOceanNetwork ? (
|
||||
<span className={styles.statusIndicatorCloseEnough} />
|
||||
) : states.isLogged ? (
|
||||
<span className={styles.statusIndicatorActive} />
|
||||
|
@ -38,7 +38,7 @@ describe('Popover', () => {
|
||||
<User.Provider
|
||||
value={{
|
||||
...userMockConnected,
|
||||
isCorrectNetwork: false,
|
||||
isOceanNetwork: false,
|
||||
network: '1'
|
||||
}}
|
||||
>
|
||||
|
@ -13,7 +13,7 @@ export default class Popover extends PureComponent<{
|
||||
balance,
|
||||
network,
|
||||
isWeb3,
|
||||
isCorrectNetwork
|
||||
isOceanNetwork
|
||||
} = this.context
|
||||
|
||||
return (
|
||||
@ -53,7 +53,7 @@ export default class Popover extends PureComponent<{
|
||||
)}
|
||||
|
||||
<div className={styles.popoverInfoline}>
|
||||
{network && !isCorrectNetwork
|
||||
{network && !isOceanNetwork
|
||||
? 'Please connect to Custom RPC\n https://nile.dev-ocean.com'
|
||||
: network && `Connected to ${network} network`}
|
||||
</div>
|
||||
|
@ -57,10 +57,10 @@ export default class AssetsUser extends PureComponent<
|
||||
}
|
||||
|
||||
public render() {
|
||||
const { account, isCorrectNetwork } = this.context
|
||||
const { account, isOceanNetwork } = this.context
|
||||
|
||||
return (
|
||||
isCorrectNetwork &&
|
||||
isOceanNetwork &&
|
||||
account && (
|
||||
<div className={styles.assetsUser}>
|
||||
{this.props.recent && (
|
||||
|
@ -28,7 +28,7 @@ describe('Web3message', () => {
|
||||
it('renders with noAccount message', () => {
|
||||
const { container } = render(
|
||||
<User.Provider
|
||||
value={{ ...userMock, isWeb3: true, isCorrectNetwork: true }}
|
||||
value={{ ...userMock, isWeb3: true, isOceanNetwork: true }}
|
||||
>
|
||||
<Web3message />
|
||||
</User.Provider>
|
||||
@ -51,7 +51,7 @@ describe('Web3message', () => {
|
||||
value={{
|
||||
...userMock,
|
||||
isWeb3: true,
|
||||
isCorrectNetwork: true
|
||||
isOceanNetwork: true
|
||||
}}
|
||||
>
|
||||
<Web3message />
|
||||
|
@ -32,7 +32,7 @@ export default class Web3message extends PureComponent {
|
||||
public render() {
|
||||
const {
|
||||
isWeb3,
|
||||
isCorrectNetwork,
|
||||
isOceanNetwork,
|
||||
isLogged,
|
||||
account,
|
||||
unlockAccounts
|
||||
@ -40,7 +40,7 @@ export default class Web3message extends PureComponent {
|
||||
|
||||
return !isWeb3
|
||||
? this.message(content.noweb3)
|
||||
: !isCorrectNetwork
|
||||
: !isOceanNetwork
|
||||
? this.message(content.wrongNetwork)
|
||||
: !isLogged
|
||||
? this.message(content.noAccount, '', unlockAccounts)
|
||||
|
@ -46,7 +46,7 @@ interface UserProviderState {
|
||||
isLogged: boolean
|
||||
isLoading: boolean
|
||||
isWeb3: boolean
|
||||
isCorrectNetwork: boolean
|
||||
isOceanNetwork: boolean
|
||||
account: string
|
||||
balance: {
|
||||
eth: number
|
||||
@ -74,7 +74,7 @@ export default class UserProvider extends PureComponent<{}, UserProviderState> {
|
||||
isLogged: false,
|
||||
isLoading: true,
|
||||
isWeb3: false,
|
||||
isCorrectNetwork: false,
|
||||
isOceanNetwork: false,
|
||||
balance: {
|
||||
eth: 0,
|
||||
ocn: 0
|
||||
@ -151,15 +151,16 @@ export default class UserProvider extends PureComponent<{}, UserProviderState> {
|
||||
//
|
||||
// Detecting network with window.web3
|
||||
//
|
||||
let isCorrectNetwork
|
||||
let isOceanNetwork
|
||||
|
||||
await window.web3.eth.net.getId((err, netId) => {
|
||||
if (err) return
|
||||
|
||||
const isNile = netId === 8995
|
||||
const isDuero = netId === 2199
|
||||
const isSpree = netId === 8996
|
||||
|
||||
isCorrectNetwork = isNile || isDuero
|
||||
isOceanNetwork = isNile || isDuero || isSpree
|
||||
|
||||
const network = isNile
|
||||
? 'Nile'
|
||||
@ -168,14 +169,14 @@ export default class UserProvider extends PureComponent<{}, UserProviderState> {
|
||||
: netId.toString()
|
||||
|
||||
if (
|
||||
isCorrectNetwork !== this.state.isCorrectNetwork ||
|
||||
isOceanNetwork !== this.state.isOceanNetwork ||
|
||||
network !== this.state.network
|
||||
) {
|
||||
this.setState({ isCorrectNetwork, network })
|
||||
this.setState({ isOceanNetwork, network })
|
||||
}
|
||||
})
|
||||
|
||||
if (!isCorrectNetwork) {
|
||||
if (!isOceanNetwork) {
|
||||
web3 = this.state.web3 // eslint-disable-line
|
||||
}
|
||||
|
||||
@ -203,19 +204,19 @@ export default class UserProvider extends PureComponent<{}, UserProviderState> {
|
||||
} catch (e) {
|
||||
// error in bootstrap process
|
||||
// show error connecting to ocean
|
||||
Logger.log('web3 error', e)
|
||||
Logger.error('web3 error', e.message)
|
||||
this.setState({ isLoading: false })
|
||||
}
|
||||
}
|
||||
|
||||
private fetchAccounts = async () => {
|
||||
const { ocean, isWeb3, isLogged, isCorrectNetwork } = this.state
|
||||
const { ocean, isWeb3, isLogged, isOceanNetwork } = this.state
|
||||
|
||||
if (isWeb3) {
|
||||
let accounts
|
||||
|
||||
// Modern dapp browsers
|
||||
if (window.ethereum && !isLogged && isCorrectNetwork) {
|
||||
if (window.ethereum && !isLogged && isOceanNetwork) {
|
||||
// simply set to empty, and have user click a button somewhere
|
||||
// to initiate account unlocking
|
||||
accounts = []
|
||||
@ -258,11 +259,12 @@ export default class UserProvider extends PureComponent<{}, UserProviderState> {
|
||||
if (isWeb3) {
|
||||
const network = await ocean.keeper.getNetworkName()
|
||||
const isNile = network === 'Nile'
|
||||
const isDuero = network === 'Development'
|
||||
const isCorrectNetwork = isNile || isDuero
|
||||
const isDuero = network === 'Duero'
|
||||
const isSpree = network === 'Spree'
|
||||
const isOceanNetwork = isNile || isDuero || isSpree
|
||||
|
||||
network !== this.state.network &&
|
||||
this.setState({ isCorrectNetwork, network })
|
||||
this.setState({ isOceanNetwork, network })
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ export const User = React.createContext({
|
||||
isLogged: false,
|
||||
isLoading: false,
|
||||
isWeb3: false,
|
||||
isCorrectNetwork: false,
|
||||
isOceanNetwork: false,
|
||||
account: '',
|
||||
web3: {},
|
||||
ocean: {},
|
||||
|
@ -72,6 +72,6 @@ export async function requestFromFaucet(account: string) {
|
||||
})
|
||||
return response.json()
|
||||
} catch (error) {
|
||||
Logger.error('requestFromFaucet', error)
|
||||
Logger.error('requestFromFaucet', error.message)
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ const contextConnectedMock = {
|
||||
isLogged: true,
|
||||
isLoading: false,
|
||||
isWeb3: true,
|
||||
isCorrectNetwork: true,
|
||||
isOceanNetwork: true,
|
||||
account: '',
|
||||
web3: {},
|
||||
ocean: {},
|
||||
|
@ -76,7 +76,7 @@ export default class AssetFile extends PureComponent<
|
||||
public render() {
|
||||
const { ddo, file } = this.props
|
||||
const { isLoading, message, error } = this.state
|
||||
const { isLogged, isCorrectNetwork } = this.context
|
||||
const { isLogged, isOceanNetwork } = this.context
|
||||
const { index } = file
|
||||
|
||||
return (
|
||||
@ -102,7 +102,7 @@ export default class AssetFile extends PureComponent<
|
||||
// https://github.com/oceanprotocol/squid-js/pull/221
|
||||
// is released
|
||||
onClick={() => this.purchaseAsset(ddo, index || 0)}
|
||||
disabled={!isLogged || !isCorrectNetwork}
|
||||
disabled={!isLogged || !isOceanNetwork}
|
||||
>
|
||||
Get file
|
||||
</Button>
|
||||
|
@ -19,7 +19,7 @@ export default class AssetFilesDetails extends PureComponent<{
|
||||
<AssetFile key={file.index} ddo={ddo} file={file} />
|
||||
))}
|
||||
</div>
|
||||
{(!this.context.isCorrectNetwork || !this.context.isLogged) && (
|
||||
{(!this.context.isOceanNetwork || !this.context.isLogged) && (
|
||||
<Web3message />
|
||||
)}
|
||||
</>
|
||||
|
@ -81,7 +81,7 @@ export default class Faucet extends PureComponent<{}, FaucetState> {
|
||||
primary
|
||||
onClick={() => this.getTokens(this.context.requestFromFaucet)}
|
||||
disabled={
|
||||
!this.context.isLogged || !this.context.isCorrectNetwork
|
||||
!this.context.isLogged || !this.context.isOceanNetwork
|
||||
}
|
||||
>
|
||||
Request Ether
|
||||
|
@ -14,7 +14,7 @@ describe('History', () => {
|
||||
isLogged: false,
|
||||
isLoading: false,
|
||||
isWeb3: false,
|
||||
isCorrectNetwork: false,
|
||||
isOceanNetwork: false,
|
||||
account: '',
|
||||
web3: {},
|
||||
ocean: {},
|
||||
|
@ -8,7 +8,7 @@ export default class History extends Component {
|
||||
public render() {
|
||||
return (
|
||||
<Route title="History">
|
||||
{(!this.context.isLogged || !this.context.isCorrectNetwork) && (
|
||||
{(!this.context.isLogged || !this.context.isOceanNetwork) && (
|
||||
<Web3message />
|
||||
)}
|
||||
|
||||
|
@ -319,7 +319,7 @@ class Publish extends Component<{}, PublishState> {
|
||||
title="Publish"
|
||||
description="Publish a new data set into the Ocean Protocol Network."
|
||||
>
|
||||
{(!this.context.isLogged || !this.context.isCorrectNetwork) && (
|
||||
{(!this.context.isLogged || !this.context.isOceanNetwork) && (
|
||||
<Web3message />
|
||||
)}
|
||||
|
||||
|
@ -14,7 +14,7 @@ describe('Search', () => {
|
||||
isLogged: false,
|
||||
isLoading: false,
|
||||
isWeb3: false,
|
||||
isCorrectNetwork: false,
|
||||
isOceanNetwork: false,
|
||||
account: '',
|
||||
web3: {},
|
||||
ocean: {
|
||||
|
@ -19,7 +19,7 @@
|
||||
},
|
||||
{
|
||||
"name": "squid-js",
|
||||
"version": "~0.5.4"
|
||||
"version": "~0.5.10"
|
||||
},
|
||||
{
|
||||
"name": "faucet",
|
||||
|
Loading…
Reference in New Issue
Block a user