diff --git a/README.md b/README.md index a038cd9..a035396 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,19 @@ const ocean: Ocean = await Ocean.getInstance({ For an overview of endpoint configurations making up various Ocean networks, please refer to [`.env.local.example`](https://github.com/oceanprotocol/commons/blob/master/client/.env.local.example) from commons. +Optionally, you can initialize an Aquarius connection without relying on the rest of Ocean to be loaded. This is useful for outputting asset metadata stored in Aquarius without the need to configure Web3 and all other Ocean Protocol network connections. + +```js +import { Ocean, Aquarius, Logger } from 'squid' + +const aquarius = new Aquarius('http://localhost:5000', Logger) +const asset = aquarius.retrieveDDO('did:op:e6fda48e8d814d5d9655645aac3c046cc87528dbc1a9449799e579d7b83d1360') + +const ocean = await Ocean.getInstance({ ... }) +// Aquarius will still be available under ocean.aquarius, just later +const asset = ocean.aquarius.retrieveDDO('did:op:e6fda48e8d814d5d9655645aac3c046cc87528dbc1a9449799e579d7b83d1360') +``` + ### Examples You can see how `squid-js` is used on: diff --git a/test/aquarius/Aquarius.test.ts b/test/aquarius/Aquarius.test.ts index 9dfd587..0927779 100644 --- a/test/aquarius/Aquarius.test.ts +++ b/test/aquarius/Aquarius.test.ts @@ -5,7 +5,7 @@ import { Aquarius, SearchQuery } from '../../src/aquarius/Aquarius' import { DDO } from '../../src/ddo/DDO' import DID from '../../src/ocean/DID' import config from '../config' -import { Logger } from '../../src/utils' +import { LoggerInstance } from '../../src/utils' use(spies) @@ -99,7 +99,7 @@ describe('Aquarius', () => { }) it('should query metadata by text with a new instance', async () => { - const aquariusNew = new Aquarius(config.aquariusUri, new Logger()) + const aquariusNew = new Aquarius(config.aquariusUri, LoggerInstance) spy.on(aquariusNew.fetch, 'get', () => reponsify(getResults([new DDO()]))) const result = await aquariusNew.queryMetadataByText(query)