1
0
mirror of https://github.com/oceanprotocol/ocean.js.git synced 2024-11-26 20:39:05 +01:00

Merge branch 'main' into issue-1831-fileinfo-case

This commit is contained in:
paulo-ocean 2024-07-01 17:38:26 +01:00
commit 2b04318e25
8 changed files with 55 additions and 36 deletions

View File

@ -4,14 +4,23 @@ 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.3.3-next.0](https://github.com/oceanprotocol/ocean.js/compare/v3.3.2...v3.3.3-next.0)
- wip: update to support agreementId [`9d58208`](https://github.com/oceanprotocol/ocean.js/commit/9d582082f05cab961915aef04e74f8e32fd7ba9c)
- update compute stop, document id is not needed, neither for operator service, neither used on signature check [`5105a4f`](https://github.com/oceanprotocol/ocean.js/commit/5105a4fdadbf5590ebf2954a1d6f3a12f77b235c)
- wip: debug agreemenet id [`1dcafcf`](https://github.com/oceanprotocol/ocean.js/commit/1dcafcff6cd51b1d3f0ec4a7ce882ad727a2267b)
#### [v3.3.2](https://github.com/oceanprotocol/ocean.js/compare/v3.3.1...v3.3.2)
> 25 June 2024
- Split coupled tests to fix timeout issues [`#1827`](https://github.com/oceanprotocol/ocean.js/pull/1827)
- Bump braces from 3.0.2 to 3.0.3 [`#1819`](https://github.com/oceanprotocol/ocean.js/pull/1819)
- Bump chai-spies and @types/chai-spies [`#1816`](https://github.com/oceanprotocol/ocean.js/pull/1816)
- Pontus x devnet config [`#1806`](https://github.com/oceanprotocol/ocean.js/pull/1806)
- Update CODEOWNERS [`#1824`](https://github.com/oceanprotocol/ocean.js/pull/1824)
- Sanitize service endpoint by adding/reving slash when needed. [`#1821`](https://github.com/oceanprotocol/ocean.js/pull/1821)
- Release 3.3.2 [`3ba3ccb`](https://github.com/oceanprotocol/ocean.js/commit/3ba3ccb6b5df9caa87e31dfb316a1c1c74a6740c)
#### [v3.3.1](https://github.com/oceanprotocol/ocean.js/compare/v3.3.0...v3.3.1)
@ -84,29 +93,15 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- make sure we increment a number when working with nonces [`#1781`](https://github.com/oceanprotocol/ocean.js/pull/1781)
- Release 3.1.4 [`b2e2cf2`](https://github.com/oceanprotocol/ocean.js/commit/b2e2cf24293af07f597c25e3a3e392db9caa381a)
#### [v3.1.3](https://github.com/oceanprotocol/ocean.js/compare/v3.1.3-next.1...v3.1.3)
#### [v3.1.3](https://github.com/oceanprotocol/ocean.js/compare/v3.1.2...v3.1.3)
> 16 October 2023
- fix fs use & error handling [`#1777`](https://github.com/oceanprotocol/ocean.js/pull/1777)
- Bump postcss from 8.4.5 to 8.4.31 [`#1778`](https://github.com/oceanprotocol/ocean.js/pull/1778)
- Release 3.1.3 [`1bc5a39`](https://github.com/oceanprotocol/ocean.js/commit/1bc5a39fda217c91cf5c44f41c6275acd20740de)
#### [v3.1.3-next.1](https://github.com/oceanprotocol/ocean.js/compare/v3.1.3-next.0...v3.1.3-next.1)
> 11 October 2023
- update error handling [`aada8e9`](https://github.com/oceanprotocol/ocean.js/commit/aada8e92af9273ccc20e86dc00ea73bcb7e8dfdf)
- Release 3.1.3-next.1 [`40c22b9`](https://github.com/oceanprotocol/ocean.js/commit/40c22b9b1fa147fd4295da1bdd6248d7714a2b30)
#### [v3.1.3-next.0](https://github.com/oceanprotocol/ocean.js/compare/v3.1.2...v3.1.3-next.0)
> 6 October 2023
- Bump @types/crypto-js from 4.1.1 to 4.1.2 [`#1774`](https://github.com/oceanprotocol/ocean.js/pull/1774)
- Bump @types/chai-spies from 1.0.3 to 1.0.4 [`#1776`](https://github.com/oceanprotocol/ocean.js/pull/1776)
- fix fs use [`735dc2f`](https://github.com/oceanprotocol/ocean.js/commit/735dc2f62b976be683bc9fcd7f8940e715b18519)
- Release 3.1.3-next.0 [`5ac5d1f`](https://github.com/oceanprotocol/ocean.js/commit/5ac5d1f44a637b5d8d285757941b0393bb3a7983)
- Release 3.1.3 [`1bc5a39`](https://github.com/oceanprotocol/ocean.js/commit/1bc5a39fda217c91cf5c44f41c6275acd20740de)
#### [v3.1.2](https://github.com/oceanprotocol/ocean.js/compare/v3.1.1...v3.1.2)
@ -584,7 +579,21 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- Bump typedoc from 0.22.15 to 0.22.17 [`#1514`](https://github.com/oceanprotocol/ocean.js/pull/1514)
- Release 1.1.3 [`7772e93`](https://github.com/oceanprotocol/ocean.js/commit/7772e9387ef9d63f98ea80cfd4eefbea963dd0ad)
#### [v1.1.2](https://github.com/oceanprotocol/ocean.js/compare/v1.0.0...v1.1.2)
#### [v1.1.2](https://github.com/oceanprotocol/ocean.js/compare/v1.1.1...v1.1.2)
> 15 June 2022
- Release 1.1.2 [`85bf271`](https://github.com/oceanprotocol/ocean.js/commit/85bf2716e26d8691aeb9d5504e563d557419dc2e)
- manual bump fix [`5674a54`](https://github.com/oceanprotocol/ocean.js/commit/5674a547d1d367ce88b3595f0be8ebbf12274266)
#### [v1.1.1](https://github.com/oceanprotocol/ocean.js/compare/v1.1.0...v1.1.1)
> 15 June 2022
- Release 1.1.1 [`ea48e01`](https://github.com/oceanprotocol/ocean.js/commit/ea48e015ac8299f71d57a929f8f30c5d1a8446e7)
- manual bump fix [`a362410`](https://github.com/oceanprotocol/ocean.js/commit/a36241004b1d9578ec5c02d9d6e64d9750c53a7b)
#### [v1.1.0](https://github.com/oceanprotocol/ocean.js/compare/v1.0.0...v1.1.0)
> 15 June 2022
@ -592,9 +601,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- Bump @types/node from 17.0.35 to 17.0.44 [`#1513`](https://github.com/oceanprotocol/ocean.js/pull/1513)
- Bump eslint-config-oceanprotocol from 1.5.0 to 2.0.1 [`#1466`](https://github.com/oceanprotocol/ocean.js/pull/1466)
- update to new schema & compute fixes [`#1510`](https://github.com/oceanprotocol/ocean.js/pull/1510)
- Release 1.1.2 [`85bf271`](https://github.com/oceanprotocol/ocean.js/commit/85bf2716e26d8691aeb9d5504e563d557419dc2e)
- manual bump fix [`5674a54`](https://github.com/oceanprotocol/ocean.js/commit/5674a547d1d367ce88b3595f0be8ebbf12274266)
- manual bump fix [`a362410`](https://github.com/oceanprotocol/ocean.js/commit/a36241004b1d9578ec5c02d9d6e64d9750c53a7b)
- Release 1.1.0 [`112c27e`](https://github.com/oceanprotocol/ocean.js/commit/112c27edab58ef0681ea3e87fb09978411924753)
#### [v1.0.0](https://github.com/oceanprotocol/ocean.js/compare/v1.0.0-next.45...v1.0.0)

View File

@ -274,6 +274,7 @@ let resolvedDatasetDdo: DDO
let resolvedAlgorithmDdo: DDO
let computeJobId: string
let agreementId: string
```
### 4.3 Helper methods
@ -661,6 +662,8 @@ Let's have 5 minute of compute access
Let's save the compute job it, we re going to use later
```Typescript
computeJobId = computeJobs[0].jobId
// eslint-disable-next-line prefer-destructuring
agreementId = computeJobs[0].agreementId
```
@ -672,7 +675,7 @@ You can also add various delays so you see the various states of the compute job
providerUrl,
await consumerAccount.getAddress(),
computeJobId,
DATASET_DDO.id
agreementId
)
```
<!--

View File

@ -128,9 +128,9 @@ ___
### computeStatus
**computeStatus**(`providerUri`, `consumerAddress`, `jobId?`, `did?`, `signal?`): `Promise`<[`ComputeJob`](../interfaces/ComputeJob.md) \| [`ComputeJob`](../interfaces/ComputeJob.md)[]\>
**computeStatus**(`providerUri`, `consumerAddress`, `jobId?`, `agreementId?`, `signal?`): `Promise`<[`ComputeJob`](../interfaces/ComputeJob.md) \| [`ComputeJob`](../interfaces/ComputeJob.md)[]\>
Get compute status for a specific jobId/documentId/owner.
Get compute status for a specific jobId/agreementId/owner.
#### Parameters
@ -139,7 +139,7 @@ Get compute status for a specific jobId/documentId/owner.
| `providerUri` | `string` | The URI of the provider we want to query |
| `consumerAddress` | `string` | The consumer ethereum address |
| `jobId?` | `string` | The ID of a compute job. |
| `did?` | `string` | The ID of the asset |
| `agreementId?` | `string` | The ID of service agreement |
| `signal?` | `AbortSignal` | abort signal |
#### Returns
@ -154,7 +154,7 @@ ___
### computeStop
**computeStop**(`did`, `consumerAddress`, `jobId`, `providerUri`, `signer`, `signal?`): `Promise`<[`ComputeJob`](../interfaces/ComputeJob.md) \| [`ComputeJob`](../interfaces/ComputeJob.md)[]\>
**computeStop**(`did`, `consumerAddress`, `jobId`, `providerUri`, `signer`, `signal?`, `agreementId?`): `Promise`<[`ComputeJob`](../interfaces/ComputeJob.md) \| [`ComputeJob`](../interfaces/ComputeJob.md)[]\>
Instruct the provider to Stop the execution of a to stop a compute job.
@ -168,6 +168,7 @@ Instruct the provider to Stop the execution of a to stop a compute job.
| `providerUri` | `string` | The provider URI. |
| `signer` | `Signer` | The consumer signer object. |
| `signal?` | `AbortSignal` | abort signal |
| `agreementId?` | `string` | service agreement id |
#### Returns

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "@oceanprotocol/lib",
"version": "3.3.2",
"version": "3.3.3-next.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@oceanprotocol/lib",
"version": "3.3.2",
"version": "3.3.3-next.0",
"license": "Apache-2.0",
"dependencies": {
"@oceanprotocol/contracts": "^2.0.3",

View File

@ -1,7 +1,7 @@
{
"name": "@oceanprotocol/lib",
"source": "./src/index.ts",
"version": "3.3.2",
"version": "3.3.3-next.0",
"description": "JavaScript client library for Ocean Protocol",
"main": "./dist/lib.js",
"umd:main": "dist/lib.umd.js",

View File

@ -622,6 +622,7 @@ export class Provider {
jobId: string,
providerUri: string,
signer: Signer,
agreementId?: string,
signal?: AbortSignal
): Promise<ComputeJob | ComputeJob[]> {
const providerEndpoints = await this.getEndpoints(providerUri)
@ -645,12 +646,16 @@ export class Provider {
let signatureMessage = consumerAddress
signatureMessage += jobId || ''
signatureMessage += (did && `${this.noZeroX(did)}`) || ''
signatureMessage += nonce
// On current provider impl (and nodes) we DO NOT check this signature
// On nodes we are signing again just the Nonce to send the request to Operator Service
// on current provider we sign: {owner}{job_id}{nonce}" OR {owner}{nonce} if no jobId
// On provider service STOP route, we just check signature owner + jobId OR just owner if no jobId
// signatureMessage += (agreementId && `${this.noZeroX(agreementId)}`) || ''
// signatureMessage += nonce
const signature = await this.signProviderRequest(signer, signatureMessage)
const payload = Object()
payload.signature = signature
payload.documentId = this.noZeroX(did)
payload.agreementId = this.noZeroX(agreementId)
payload.consumerAddress = consumerAddress
payload.nonce = nonce
if (jobId) payload.jobId = jobId
@ -690,7 +695,7 @@ export class Provider {
* @param {string} providerUri The URI of the provider we want to query
* @param {string} consumerAddress The consumer ethereum address
* @param {string} jobId The ID of a compute job.
* @param {string} did The ID of the asset
* @param {string} agreementId The ID of the service agreement (tx id)
* @param {AbortSignal} signal abort signal
* @return {Promise<ComputeJob | ComputeJob[]>}
*/
@ -698,7 +703,7 @@ export class Provider {
providerUri: string,
consumerAddress: string,
jobId?: string,
did?: string,
agreementId?: string,
signal?: AbortSignal
): Promise<ComputeJob | ComputeJob[]> {
const providerEndpoints = await this.getEndpoints(providerUri)
@ -711,7 +716,7 @@ export class Provider {
: null
let url = `?consumerAddress=${consumerAddress}`
url += (did && `&documentId=${this.noZeroX(did)}`) || ''
url += (agreementId && `&agreementId=${this.noZeroX(agreementId)}`) || ''
url += (jobId && `&jobId=${jobId}`) || ''
if (!computeStatusUrl) return null

View File

@ -274,6 +274,7 @@ let resolvedDatasetDdo: DDO
let resolvedAlgorithmDdo: DDO
let computeJobId: string
let agreementId: string
/// ```
/// ### 4.3 Helper methods
@ -661,6 +662,8 @@ describe('Compute-to-data example tests', async () => {
/// Let's save the compute job it, we re going to use later
/// ```Typescript
computeJobId = computeJobs[0].jobId
// eslint-disable-next-line prefer-destructuring
agreementId = computeJobs[0].agreementId
}) ///
/// ```
@ -672,7 +675,7 @@ describe('Compute-to-data example tests', async () => {
providerUrl,
await consumerAccount.getAddress(),
computeJobId,
DATASET_DDO.id
agreementId
)
/// ```
/// <!--

View File

@ -222,7 +222,7 @@ describe('Publish consume test', async () => {
addresses.ERC721Factory,
aquarius
)
assert(urlAssetId, 'Failed to publish ipfs DDO')
assert(ipfsAssetId, 'Failed to publish ipfs DDO')
})
it('Should publish arwave asset', async () => {