2019-02-14 15:56:55 +01:00
|
|
|
import { Ocean } from '@oceanprotocol/squid'
|
2019-04-06 17:55:24 +02:00
|
|
|
import Web3 from 'web3'
|
2019-01-23 12:15:16 +01:00
|
|
|
|
|
|
|
import {
|
|
|
|
aquariusHost,
|
|
|
|
aquariusPort,
|
2019-01-23 14:43:41 +01:00
|
|
|
aquariusScheme,
|
2019-01-23 12:15:16 +01:00
|
|
|
brizoHost,
|
|
|
|
brizoPort,
|
2019-01-23 14:43:41 +01:00
|
|
|
brizoScheme,
|
2019-04-02 13:59:07 +02:00
|
|
|
brizoAddress,
|
2019-01-23 14:43:41 +01:00
|
|
|
nodeHost,
|
|
|
|
nodePort,
|
|
|
|
nodeScheme,
|
2019-01-23 12:15:16 +01:00
|
|
|
parityHost,
|
|
|
|
parityPort,
|
2019-01-23 14:43:41 +01:00
|
|
|
parityScheme,
|
2019-01-23 12:15:16 +01:00
|
|
|
secretStoreHost,
|
|
|
|
secretStorePort,
|
2019-01-23 14:43:41 +01:00
|
|
|
secretStoreScheme,
|
2019-01-23 12:15:16 +01:00
|
|
|
verbose
|
2019-04-04 11:30:31 +02:00
|
|
|
} from './config/config'
|
2019-01-23 12:15:16 +01:00
|
|
|
|
2019-04-06 17:55:24 +02:00
|
|
|
export async function provideOcean(web3provider: Web3) {
|
2019-01-23 12:15:16 +01:00
|
|
|
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 config = {
|
2019-04-06 17:55:24 +02:00
|
|
|
web3provider,
|
2019-01-23 12:15:16 +01:00
|
|
|
nodeUri,
|
|
|
|
aquariusUri,
|
|
|
|
brizoUri,
|
2019-04-02 13:59:07 +02:00
|
|
|
brizoAddress,
|
2019-01-23 12:15:16 +01:00
|
|
|
parityUri,
|
|
|
|
secretStoreUri,
|
|
|
|
verbose
|
|
|
|
}
|
|
|
|
|
2019-04-06 17:55:24 +02:00
|
|
|
const ocean: Ocean = await Ocean.getInstance(config)
|
2019-01-23 12:15:16 +01:00
|
|
|
|
|
|
|
return { ocean }
|
|
|
|
}
|