Skip to content

Commit

Permalink
merge main, fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
paulo-ocean committed Jan 14, 2025
2 parents c1b8546 + edd3581 commit c7a5ffd
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 39 deletions.
25 changes: 22 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [v3.4.5](https://github.com/oceanprotocol/ocean.js/compare/v4.0.0-next.1...v3.4.5)
#### [v3.4.6](https://github.com/oceanprotocol/ocean.js/compare/v4.0.0-next.1...v3.4.6)

- make retries and interval bigger & configurable on waitForAqua [`#1895`](https://github.com/oceanprotocol/ocean.js/pull/1895)
- Bump eslint-config-prettier from 9.0.0 to 9.1.0 [`#1884`](https://github.com/oceanprotocol/ocean.js/pull/1884)
- Add back check for access list factory. [`#1889`](https://github.com/oceanprotocol/ocean.js/pull/1889)
- Remove circular dependencies, fix imports and improve build [`#1881`](https://github.com/oceanprotocol/ocean.js/pull/1881)
- chore: remove redundant words in comment [`#1890`](https://github.com/oceanprotocol/ocean.js/pull/1890)
Expand All @@ -17,8 +19,8 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- Bump rollup from 2.61.1 to 2.79.2 [`#1866`](https://github.com/oceanprotocol/ocean.js/pull/1866)
- Remove checks from publishing. ADded chain ID check for ordering. [`#1875`](https://github.com/oceanprotocol/ocean.js/pull/1875)
- done [`60d0272`](https://github.com/oceanprotocol/ocean.js/commit/60d027294a2893410860f1180ff47177e12e45de)
- rename waitForAqua as waitForIndexer [`6381795`](https://github.com/oceanprotocol/ocean.js/commit/6381795c957f301b93461d84a14ff59991b58738)
- 4th pass [`bf94e10`](https://github.com/oceanprotocol/ocean.js/commit/bf94e102e53dd07eac6c671ef222b96e34ffca7f)
- Release 3.4.4 [`fa242a5`](https://github.com/oceanprotocol/ocean.js/commit/fa242a5095d16327adf2d53830a643350fcdfa84)

#### [v4.0.0-next.1](https://github.com/oceanprotocol/ocean.js/compare/v4.0.0-next.0...v4.0.0-next.1)

Expand All @@ -28,12 +30,29 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- support for consumer signature on initialize compute [`71c5923`](https://github.com/oceanprotocol/ocean.js/commit/71c59230db99a08a6c28df66c26e32ca61c71089)
- add file object types [`cd936c2`](https://github.com/oceanprotocol/ocean.js/commit/cd936c24a989633d3d8e71b908a375802d2e2970)

#### [v4.0.0-next.0](https://github.com/oceanprotocol/ocean.js/compare/v3.4.4...v4.0.0-next.0)
#### [v4.0.0-next.0](https://github.com/oceanprotocol/ocean.js/compare/v3.4.5...v4.0.0-next.0)

> 12 November 2024
- Release 4.0.0-next.0 [`658cfe8`](https://github.com/oceanprotocol/ocean.js/commit/658cfe83ff855a83eb97e3cbf1276bed6022a1a6)

#### [v3.4.5](https://github.com/oceanprotocol/ocean.js/compare/v3.4.4...v3.4.5)

> 19 December 2024
- Add back check for access list factory. [`#1889`](https://github.com/oceanprotocol/ocean.js/pull/1889)
- Remove circular dependencies, fix imports and improve build [`#1881`](https://github.com/oceanprotocol/ocean.js/pull/1881)
- chore: remove redundant words in comment [`#1890`](https://github.com/oceanprotocol/ocean.js/pull/1890)
- Bump @truffle/hdwallet-provider from 2.1.10 to 2.1.15 [`#1886`](https://github.com/oceanprotocol/ocean.js/pull/1886)
- Bump nyc from 15.1.0 to 17.1.0 [`#1883`](https://github.com/oceanprotocol/ocean.js/pull/1883)
- Bump @types/crypto-js from 4.1.2 to 4.2.2 [`#1882`](https://github.com/oceanprotocol/ocean.js/pull/1882)
- Bump actions/download-artifact from 2 to 4.1.7 in /.github/workflows [`#1844`](https://github.com/oceanprotocol/ocean.js/pull/1844)
- Remove node:16 docker image from workflow. [`#1879`](https://github.com/oceanprotocol/ocean.js/pull/1879)
- Bump rollup from 2.61.1 to 2.79.2 [`#1866`](https://github.com/oceanprotocol/ocean.js/pull/1866)
- done [`60d0272`](https://github.com/oceanprotocol/ocean.js/commit/60d027294a2893410860f1180ff47177e12e45de)
- 4th pass [`bf94e10`](https://github.com/oceanprotocol/ocean.js/commit/bf94e102e53dd07eac6c671ef222b96e34ffca7f)
- Release 3.4.5 [`a1ee835`](https://github.com/oceanprotocol/ocean.js/commit/a1ee835294b6a51721c3c215dd3c16f741b0573b)

#### [v3.4.4](https://github.com/oceanprotocol/ocean.js/compare/v3.4.3...v3.4.4)

> 20 November 2024
Expand Down
4 changes: 2 additions & 2 deletions CodeExamples.md
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ Now we can make the contract call
)
console.log(`Consumer ${FRE_NFT_SYMBOL} balance after swap: ${consumerDTBalance}`)

const resolvedDDO = await aquarius.waitForAqua(fixedDDO.id)
const resolvedDDO = await aquarius.waitForIndexer(fixedDDO.id)
assert(resolvedDDO, 'Cannot fetch DDO from Aquarius')

```
Expand Down Expand Up @@ -726,7 +726,7 @@ Now we need to encrypt file(s) using provider
`Consumer ${DISP_NFT_SYMBOL} balance after dispense: ${consumerDTBalance}`
)

const resolvedDDO = await aquarius.waitForAqua(fixedDDO.id)
const resolvedDDO = await aquarius.waitForIndexer(fixedDDO.id)
assert(resolvedDDO, 'Cannot fetch DDO from Aquarius')

datatoken = new Datatoken(consumerAccount, await consumerAccount.getChainId())
Expand Down
4 changes: 2 additions & 2 deletions ComputeExamples.md
Original file line number Diff line number Diff line change
Expand Up @@ -539,8 +539,8 @@ Now, let's check that we successfully published a algorithm (create NFT + Datato

### 7.1 Resolve published datasets and algorithms
```Typescript
resolvedDatasetDdo = await aquariusInstance.waitForAqua(datasetId)
resolvedAlgorithmDdo = await aquariusInstance.waitForAqua(algorithmId)
resolvedDatasetDdo = await aquariusInstance.waitForIndexer(datasetId)
resolvedAlgorithmDdo = await aquariusInstance.waitForIndexer(algorithmId)
```
<!--
assert(resolvedDatasetDdo, 'Cannot fetch DDO from Aquarius')
Expand Down
10 changes: 6 additions & 4 deletions docs/classes/Aquarius.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
- [querySearch](Aquarius.md#querysearch)
- [resolve](Aquarius.md#resolve)
- [validate](Aquarius.md#validate)
- [waitForAqua](Aquarius.md#waitforaqua)
- [waitForIndexer](Aquarius.md#waitForIndexer)

## Constructors

Expand Down Expand Up @@ -146,11 +146,11 @@ Validate DDO content

___

### waitForAqua
### waitForIndexer

**waitForAqua**(`did`, `txid?`, `signal?`): `Promise`<[`Asset`](../interfaces/Asset.md)\>
**waitForIndexer**(`did`, `txid?`, `signal?`, `interval=3000`,`maxRetries=100`): `Promise`<[`Asset`](../interfaces/Asset.md)\>

Blocks until Aqua will cache the did (or the update for that did) or timeouts
Blocks until Indexer will cache the did (or the update for that did) or timeouts

#### Parameters

Expand All @@ -159,6 +159,8 @@ Blocks until Aqua will cache the did (or the update for that did) or timeouts
| `did` | `string` | DID of the asset. |
| `txid?` | `string` | used when the did exists and we expect an update with that txid. |
| `signal?` | `AbortSignal` | abort signal |
| `interval` | `number` | retry interval in miliseconds. Default is 3000 |
| `maxRetries` | `number` | max number of retries. Default is 100 |

#### Returns

Expand Down
4 changes: 0 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 12 additions & 5 deletions src/services/Aquarius.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,25 @@ export class Aquarius {
}

/**
* Blocks until Aqua will cache the did (or the update for that did) or timeouts
* Blocks until Indexer will cache the did (or the update for that did) or timeouts
* @param {string} did DID of the asset.
* @param {string} txid used when the did exists and we expect an update with that txid.
* @param {AbortSignal} signal abort signal
* @return {Promise<Asset>} DDO of the asset.
*/
public async waitForAqua(
public async waitForIndexer(
did: string,
txid?: string,
signal?: AbortSignal
signal?: AbortSignal,
interval: number = 3000,
maxRetries: number = 100
): Promise<Asset> {
let tries = 0
// lets have a cap to prevent possible abuse as well
if (maxRetries > 500) {
LoggerInstance.warn('Max Limit exceeded, defaulting to 500 retries.')
maxRetries = 500
}
do {
try {
const path = this.aquariusURL + '/api/aquarius/assets/ddo/' + did
Expand All @@ -80,9 +87,9 @@ export class Aquarius {
} catch (e) {
// do nothing
}
await sleep(1500)
await sleep(interval)
tries++
} while (tries < 100)
} while (tries < maxRetries)
return null
}

Expand Down
4 changes: 2 additions & 2 deletions test/integration/CodeExamples.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ describe('Marketplace flow tests', async () => {
)
console.log(`Consumer ${FRE_NFT_SYMBOL} balance after swap: ${consumerDTBalance}`)

const resolvedDDO = await aquarius.waitForAqua(fixedDDO.id)
const resolvedDDO = await aquarius.waitForIndexer(fixedDDO.id)
assert(resolvedDDO, 'Cannot fetch DDO from Aquarius')

/// ```
Expand Down Expand Up @@ -726,7 +726,7 @@ describe('Marketplace flow tests', async () => {
`Consumer ${DISP_NFT_SYMBOL} balance after dispense: ${consumerDTBalance}`
)

const resolvedDDO = await aquarius.waitForAqua(fixedDDO.id)
const resolvedDDO = await aquarius.waitForIndexer(fixedDDO.id)
assert(resolvedDDO, 'Cannot fetch DDO from Aquarius')

datatoken = new Datatoken(consumerAccount, await consumerAccount.getChainId())
Expand Down
4 changes: 2 additions & 2 deletions test/integration/ComputeExamples.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -539,8 +539,8 @@ describe('Compute-to-data example tests', async () => {

it('7.1 Resolve published datasets and algorithms', async () => {
/// ```Typescript
resolvedDatasetDdo = await aquariusInstance.waitForAqua(datasetId)
resolvedAlgorithmDdo = await aquariusInstance.waitForAqua(algorithmId)
resolvedDatasetDdo = await aquariusInstance.waitForIndexer(datasetId)
resolvedAlgorithmDdo = await aquariusInstance.waitForIndexer(algorithmId)
/// ```
/// <!--
assert(resolvedDatasetDdo, 'Cannot fetch DDO from Aquarius')
Expand Down
8 changes: 4 additions & 4 deletions test/integration/ComputeFlow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,13 +348,13 @@ describe('Compute flow tests', async () => {
delay(10000)

it('should resolve published datasets and algorithms', async () => {
resolvedDdoWith5mTimeout = await aquarius.waitForAqua(ddoWith5mTimeoutId)
resolvedDdoWith5mTimeout = await aquarius.waitForIndexer(ddoWith5mTimeoutId)
assert(resolvedDdoWith5mTimeout, 'Cannot fetch DDO from Aquarius')
resolvedDdoWithNoTimeout = await aquarius.waitForAqua(ddoWithNoTimeoutId)
resolvedDdoWithNoTimeout = await aquarius.waitForIndexer(ddoWithNoTimeoutId)
assert(resolvedDdoWithNoTimeout, 'Cannot fetch DDO from Aquarius')
resolvedAlgoDdoWith5mTimeout = await aquarius.waitForAqua(algoDdoWith5mTimeoutId)
resolvedAlgoDdoWith5mTimeout = await aquarius.waitForIndexer(algoDdoWith5mTimeoutId)
assert(resolvedAlgoDdoWith5mTimeout, 'Cannot fetch DDO from Aquarius')
resolvedAlgoDdoWithNoTimeout = await aquarius.waitForAqua(algoDdoWithNoTimeoutId)
resolvedAlgoDdoWithNoTimeout = await aquarius.waitForIndexer(algoDdoWithNoTimeoutId)
assert(resolvedAlgoDdoWithNoTimeout, 'Cannot fetch DDO from Aquarius')
})

Expand Down
18 changes: 9 additions & 9 deletions test/integration/PublishEditConsume.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,19 +304,19 @@ describe('Publish consume test', async () => {
delay(10000) // let's wait for aquarius to index the assets

it('Resolve published assets', async () => {
resolvedUrlAssetDdo = await aquarius.waitForAqua(urlAssetId)
resolvedUrlAssetDdo = await aquarius.waitForIndexer(urlAssetId)
assert(resolvedUrlAssetDdo, 'Cannot fetch url DDO from Aquarius')

resolvedArweaveAssetDdo = await aquarius.waitForAqua(arweaveAssetId)
resolvedArweaveAssetDdo = await aquarius.waitForIndexer(arweaveAssetId)
assert(resolvedArweaveAssetDdo, 'Cannot fetch arwave DDO from Aquarius')

resolvedIpfsAssetDdo = await aquarius.waitForAqua(ipfsAssetId)
resolvedIpfsAssetDdo = await aquarius.waitForIndexer(ipfsAssetId)
assert(resolvedIpfsAssetDdo, 'Cannot fetch ipfs DDO from Aquarius')

resolvedOnchainAssetDdo = await aquarius.waitForAqua(onchainAssetId)
resolvedOnchainAssetDdo = await aquarius.waitForIndexer(onchainAssetId)
assert(resolvedOnchainAssetDdo, 'Cannot fetch onchain DDO from Aquarius')

resolvedGraphqlAssetDdo = await aquarius.waitForAqua(grapqlAssetId)
resolvedGraphqlAssetDdo = await aquarius.waitForIndexer(grapqlAssetId)
assert(resolvedGraphqlAssetDdo, 'Cannot fetch graphql DDO from Aquarius')
})

Expand Down Expand Up @@ -557,19 +557,19 @@ describe('Publish consume test', async () => {
delay(10000) // let's wait for aquarius to index the updated ddo's

it('Should resolve updated datasets', async () => {
resolvedUrlAssetDdoAfterUpdate = await aquarius.waitForAqua(urlAssetId)
resolvedUrlAssetDdoAfterUpdate = await aquarius.waitForIndexer(urlAssetId)
assert(resolvedUrlAssetDdoAfterUpdate, 'Cannot fetch url DDO from Aquarius')

resolvedArweaveAssetDdoAfterUpdate = await aquarius.waitForAqua(arweaveAssetId)
resolvedArweaveAssetDdoAfterUpdate = await aquarius.waitForIndexer(arweaveAssetId)
assert(resolvedArweaveAssetDdoAfterUpdate, 'Cannot fetch arwave DDO from Aquarius')
// To be fixed in #1849
// resolvedIpfsAssetDdoAfterUpdate = await aquarius.waitForAqua(ipfsAssetId)
// assert(resolvedIpfsAssetDdoAfterUpdate, 'Cannot fetch ipfs DDO from Aquarius')

resolvedOnchainAssetDdoAfterUpdate = await aquarius.waitForAqua(onchainAssetId)
resolvedOnchainAssetDdoAfterUpdate = await aquarius.waitForIndexer(onchainAssetId)
assert(resolvedOnchainAssetDdoAfterUpdate, 'Cannot fetch onchain DDO from Aquarius')

resolvedGraphqlAssetDdoAfterUpdate = await aquarius.waitForAqua(grapqlAssetId)
resolvedGraphqlAssetDdoAfterUpdate = await aquarius.waitForIndexer(grapqlAssetId)
assert(resolvedGraphqlAssetDdoAfterUpdate, 'Cannot fetch onchain DDO from Aquarius')
})
})
Expand Down
4 changes: 2 additions & 2 deletions test/integration/PublishFlows.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ describe('Publish tests', async () => {
})

it('should resolve the fixed price dataset', async () => {
const resolvedDDO = await aquarius.waitForAqua(fixedPricedDID)
const resolvedDDO = await aquarius.waitForIndexer(fixedPricedDID)
assert(resolvedDDO, 'Cannot fetch DDO from Aquarius')
}).timeout(40000)

Expand Down Expand Up @@ -316,7 +316,7 @@ describe('Publish tests', async () => {
delay(19000)

it('should resolve the free dataset', async () => {
const resolvedDDO = await aquarius.waitForAqua(dispenserDID)
const resolvedDDO = await aquarius.waitForIndexer(dispenserDID)
assert(resolvedDDO, 'Cannot fetch DDO from Aquarius')
})
})

0 comments on commit c7a5ffd

Please sign in to comment.