mirror of
https://github.com/oceanprotocol/commons.git
synced 2023-03-15 18:03:00 +01:00
another web3 fix, add @types-web3, config options destructuring
This commit is contained in:
parent
fb7914478d
commit
3b5e3b30c0
25
server/package-lock.json
generated
25
server/package-lock.json
generated
@ -419,6 +419,15 @@
|
||||
"@babel/types": "^7.3.0"
|
||||
}
|
||||
},
|
||||
"@types/bn.js": {
|
||||
"version": "4.11.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-4.11.5.tgz",
|
||||
"integrity": "sha512-AEAZcIZga0JgVMHNtl1CprA/hXX7/wPt79AgR4XqaDt7jyj3QWYw6LPoOiznPtugDmlubUnAahMs2PFxGcQrng==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"@types/body-parser": {
|
||||
"version": "1.17.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.17.0.tgz",
|
||||
@ -586,6 +595,22 @@
|
||||
"integrity": "sha512-SCcK7mvGi3+ZNz833RRjFIxrn4gI1PPR3NtuIS+6vMkvmsGjosqTJwRt5bAEFLRz+wtJMWv8+uOnZf2hi2QXTg==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/underscore": {
|
||||
"version": "1.8.14",
|
||||
"resolved": "https://registry.npmjs.org/@types/underscore/-/underscore-1.8.14.tgz",
|
||||
"integrity": "sha512-xbzi6UaATVKupInG3D65/EPQ3qkJCvG2ZAzmlIYt6x93ACOEX2Y0fHW4/e8TF3G7q5KB2l7wTZgzfNjyYDMuZw==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/web3": {
|
||||
"version": "1.0.18",
|
||||
"resolved": "https://registry.npmjs.org/@types/web3/-/web3-1.0.18.tgz",
|
||||
"integrity": "sha512-uXQL0LDszt2f476LEmYM6AvSv9F4vU4hWQvlUhwfLHNlIB6OyBXoYsCzWAIhhnc5U0HA7ZBcPybxRJ/yfA6THg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/bn.js": "*",
|
||||
"@types/underscore": "*"
|
||||
}
|
||||
},
|
||||
"@types/yargs": {
|
||||
"version": "12.0.12",
|
||||
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-12.0.12.tgz",
|
||||
|
@ -36,6 +36,7 @@
|
||||
"@types/morgan": "^1.7.35",
|
||||
"@types/node": "^11.13.4",
|
||||
"@types/request": "^2.48.1",
|
||||
"@types/web3": "^1.0.18",
|
||||
"jasmine": "^3.4.0",
|
||||
"jest": "^24.7.1",
|
||||
"nodemon": "^1.18.11",
|
||||
|
@ -2,38 +2,45 @@ import Web3 from 'web3'
|
||||
import { Ocean } from '@oceanprotocol/squid'
|
||||
import config from './config/config'
|
||||
|
||||
const {
|
||||
nodeScheme,
|
||||
nodeHost,
|
||||
nodePort,
|
||||
aquariusScheme,
|
||||
aquariusHost,
|
||||
aquariusPort,
|
||||
brizoScheme,
|
||||
brizoHost,
|
||||
brizoPort,
|
||||
parityScheme,
|
||||
parityHost,
|
||||
parityPort,
|
||||
secretStoreScheme,
|
||||
secretStoreHost,
|
||||
secretStorePort,
|
||||
brizoAddress,
|
||||
verbose
|
||||
} = config.app
|
||||
|
||||
export function getProviders() {
|
||||
return new Promise<any>(async (resolve, reject) => {
|
||||
const nodeUri = `${config.app.nodeScheme}://${config.app.nodeHost}:${
|
||||
config.app.nodePort
|
||||
}`
|
||||
const aquariusUri = `${config.app.aquariusScheme}://${
|
||||
config.app.aquariusHost
|
||||
}:${config.app.aquariusPort}`
|
||||
const brizoUri = `${config.app.brizoScheme}://${config.app.brizoHost}:${
|
||||
config.app.brizoPort
|
||||
}`
|
||||
const parityUri = `${config.app.parityScheme}://${
|
||||
config.app.parityHost
|
||||
}:${config.app.parityPort}`
|
||||
const secretStoreUri = `${config.app.secretStoreScheme}://${
|
||||
config.app.secretStoreHost
|
||||
}:${config.app.secretStorePort}`
|
||||
const nodeUri = `${nodeScheme}://${nodeHost}:${nodePort}`
|
||||
const aquariusUri = `${aquariusScheme}://${aquariusHost}:${aquariusPort}`
|
||||
const brizoUri = `${brizoScheme}://${brizoHost}:${brizoPort}`
|
||||
const parityUri = `${parityScheme}://${parityHost}:${parityPort}`
|
||||
const secretStoreUri = `${secretStoreScheme}://${secretStoreHost}:${secretStorePort}`
|
||||
const web3 = new Web3(nodeUri)
|
||||
const oceanConfig = {
|
||||
web3Provider: web3,
|
||||
nodeUri,
|
||||
aquariusUri,
|
||||
brizoUri,
|
||||
brizoAddress: config.app.brizoAddress,
|
||||
brizoAddress,
|
||||
parityUri,
|
||||
secretStoreUri,
|
||||
verbose: config.app.verbose
|
||||
verbose
|
||||
}
|
||||
const ocean = await Ocean.getInstance(oceanConfig)
|
||||
resolve({
|
||||
ocean,
|
||||
web3
|
||||
})
|
||||
resolve({ ocean, web3 })
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user