@oceanprotocol/lib 4.0.2 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,11 +4,36 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ #### [v4.1.0](https://github.com/oceanprotocol/ocean.js/compare/v4.0.3...v4.1.0)
8
+
9
+ - Feature/paid compute [`#1924`](https://github.com/oceanprotocol/ocean.js/pull/1924)
10
+ - Escrow contract integration [`#1910`](https://github.com/oceanprotocol/ocean.js/pull/1910)
11
+ - Updating ComputeExamples.md [`95caa93`](https://github.com/oceanprotocol/ocean.js/commit/95caa93c8d44ee7a276d2bf65864a58bf4030f57)
12
+ - Merge 3746bd826b24e56abec0a2ee4640aeb4ea648d20 into 261c665f4f434b0f8eba9fed952dab1adf0321f5 [`f2a8129`](https://github.com/oceanprotocol/ocean.js/commit/f2a8129533ee61e5903df892e0b10b54f4c506a6)
13
+ - Updating ComputeExamples.md [`68d5386`](https://github.com/oceanprotocol/ocean.js/commit/68d53864a90ce34cccf7d54065d4aff947c37a86)
14
+
15
+ #### [v4.0.3](https://github.com/oceanprotocol/ocean.js/compare/v4.0.2...v4.0.3)
16
+
17
+ > 28 April 2025
18
+
19
+ - Dependencies update [`#1938`](https://github.com/oceanprotocol/ocean.js/pull/1938)
20
+ - use main branch for node checkout [`#1936`](https://github.com/oceanprotocol/ocean.js/pull/1936)
21
+ - Further integrate ddo-js [`#1935`](https://github.com/oceanprotocol/ocean.js/pull/1935)
22
+ - Make integration tests use Ocean Node not Provider or Aquarius [`#1932`](https://github.com/oceanprotocol/ocean.js/pull/1932)
23
+ - update CODEOWNERS [`#1933`](https://github.com/oceanprotocol/ocean.js/pull/1933)
24
+ - Bump release-it from 15.6.1 to 18.1.2 [`#1921`](https://github.com/oceanprotocol/ocean.js/pull/1921)
25
+ - Bump esbuild and tsx [`#1925`](https://github.com/oceanprotocol/ocean.js/pull/1925)
26
+ - Bump serialize-javascript and mocha [`#1915`](https://github.com/oceanprotocol/ocean.js/pull/1915)
27
+ - Release 4.0.3 [`f00bb95`](https://github.com/oceanprotocol/ocean.js/commit/f00bb955957ed1b69a01200bc73b2857da91117e)
28
+
7
29
  #### [v4.0.2](https://github.com/oceanprotocol/ocean.js/compare/v4.0.1...v4.0.2)
8
30
 
31
+ > 27 March 2025
32
+
9
33
  - Bump axios from 1.7.9 to 1.8.3 [`#1926`](https://github.com/oceanprotocol/ocean.js/pull/1926)
10
34
  - update to ddo.js v0.0.2 [`#1931`](https://github.com/oceanprotocol/ocean.js/pull/1931)
11
35
  - Updating codeowners [`#1929`](https://github.com/oceanprotocol/ocean.js/pull/1929)
36
+ - Release 4.0.2 [`b6a78b6`](https://github.com/oceanprotocol/ocean.js/commit/b6a78b64c684af7c9f360e22ecb7a0fa839e8907)
12
37
 
13
38
  #### [v4.0.1](https://github.com/oceanprotocol/ocean.js/compare/v4.0.0...v4.0.1)
14
39
 
@@ -17,7 +42,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
17
42
  - moving the getChainId call [`#1928`](https://github.com/oceanprotocol/ocean.js/pull/1928)
18
43
  - Release 4.0.1 [`519e378`](https://github.com/oceanprotocol/ocean.js/commit/519e378c3cfd6df0ece6e503c89c796a0c76027d)
19
44
 
20
- ### [v4.0.0](https://github.com/oceanprotocol/ocean.js/compare/v3.4.6...v4.0.0)
45
+ ### [v4.0.0](https://github.com/oceanprotocol/ocean.js/compare/v4.0.0-next.1...v4.0.0)
21
46
 
22
47
  > 18 March 2025
23
48
 
@@ -26,9 +51,35 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
26
51
  - add missing exports, refactor addresses file [`#1904`](https://github.com/oceanprotocol/ocean.js/pull/1904)
27
52
  - Use serviceIndex instead of hardcoded indexes. [`#1905`](https://github.com/oceanprotocol/ocean.js/pull/1905)
28
53
  - Bump path-to-regexp and express [`#1893`](https://github.com/oceanprotocol/ocean.js/pull/1893)
29
- - Release 4.0.0 [`9a3f920`](https://github.com/oceanprotocol/ocean.js/commit/9a3f9209a49ed6181df695d57d32ed725ee962d2)
30
- - fix ci.yml, fix typo on test file [`bde6f0a`](https://github.com/oceanprotocol/ocean.js/commit/bde6f0a7e9f1c7cc635b78c5b045caed16be65ca)
31
- - fix policy server [`19bfe3e`](https://github.com/oceanprotocol/ocean.js/commit/19bfe3eedf00809379bf49ec506e32285499242c)
54
+ - make retries and interval bigger & configurable on waitForAqua [`#1895`](https://github.com/oceanprotocol/ocean.js/pull/1895)
55
+ - Bump eslint-config-prettier from 9.0.0 to 9.1.0 [`#1884`](https://github.com/oceanprotocol/ocean.js/pull/1884)
56
+ - Add back check for access list factory. [`#1889`](https://github.com/oceanprotocol/ocean.js/pull/1889)
57
+ - Remove circular dependencies, fix imports and improve build [`#1881`](https://github.com/oceanprotocol/ocean.js/pull/1881)
58
+ - chore: remove redundant words in comment [`#1890`](https://github.com/oceanprotocol/ocean.js/pull/1890)
59
+ - Bump @truffle/hdwallet-provider from 2.1.10 to 2.1.15 [`#1886`](https://github.com/oceanprotocol/ocean.js/pull/1886)
60
+ - Bump nyc from 15.1.0 to 17.1.0 [`#1883`](https://github.com/oceanprotocol/ocean.js/pull/1883)
61
+ - Bump @types/crypto-js from 4.1.2 to 4.2.2 [`#1882`](https://github.com/oceanprotocol/ocean.js/pull/1882)
62
+ - Bump actions/download-artifact from 2 to 4.1.7 in /.github/workflows [`#1844`](https://github.com/oceanprotocol/ocean.js/pull/1844)
63
+ - Remove node:16 docker image from workflow. [`#1879`](https://github.com/oceanprotocol/ocean.js/pull/1879)
64
+ - Bump rollup from 2.61.1 to 2.79.2 [`#1866`](https://github.com/oceanprotocol/ocean.js/pull/1866)
65
+ - Remove checks from publishing. ADded chain ID check for ordering. [`#1875`](https://github.com/oceanprotocol/ocean.js/pull/1875)
66
+ - done [`60d0272`](https://github.com/oceanprotocol/ocean.js/commit/60d027294a2893410860f1180ff47177e12e45de)
67
+ - rename waitForAqua as waitForIndexer [`6381795`](https://github.com/oceanprotocol/ocean.js/commit/6381795c957f301b93461d84a14ff59991b58738)
68
+ - 4th pass [`bf94e10`](https://github.com/oceanprotocol/ocean.js/commit/bf94e102e53dd07eac6c671ef222b96e34ffca7f)
69
+
70
+ #### [v4.0.0-next.1](https://github.com/oceanprotocol/ocean.js/compare/v4.0.0-next.0...v4.0.0-next.1)
71
+
72
+ > 12 November 2024
73
+
74
+ - add datasets on ComputeAsset, new start compute fn [`8563429`](https://github.com/oceanprotocol/ocean.js/commit/85634293306fca9aaa3ab5ae06a114149ccc8911)
75
+ - support for consumer signature on initialize compute [`71c5923`](https://github.com/oceanprotocol/ocean.js/commit/71c59230db99a08a6c28df66c26e32ca61c71089)
76
+ - add file object types [`cd936c2`](https://github.com/oceanprotocol/ocean.js/commit/cd936c24a989633d3d8e71b908a375802d2e2970)
77
+
78
+ #### [v4.0.0-next.0](https://github.com/oceanprotocol/ocean.js/compare/v3.4.6...v4.0.0-next.0)
79
+
80
+ > 12 November 2024
81
+
82
+ - Release 4.0.0-next.0 [`658cfe8`](https://github.com/oceanprotocol/ocean.js/commit/658cfe83ff855a83eb97e3cbf1276bed6022a1a6)
32
83
 
33
84
  #### [v3.4.6](https://github.com/oceanprotocol/ocean.js/compare/v3.4.5...v3.4.6)
34
85
 
package/CodeExamples.md CHANGED
@@ -105,11 +105,10 @@ import {
105
105
  ConfigHelper,
106
106
  configHelperNetworks,
107
107
  amountToUnits,
108
- ValidateMetadata,
109
108
  getEventFromTx,
110
- DDO,
111
109
  LoggerInstance
112
110
  } from '../../src/index.js'
111
+ import { DDO, ValidateMetadata } from '@oceanprotocol/ddo-js'
113
112
  ```
114
113
  const { SHA256 } = crypto
115
114
 
@@ -136,7 +135,7 @@ Now we define the variables which we will need later
136
135
  let dispenserNftAddress: string
137
136
  let dispenserDatatokenAddress: string
138
137
  let dispenserAddress: string
139
- let fixedDDO
138
+ let fixedDDO: DDO
140
139
  ```
141
140
 
142
141
  We also define some constants that we will use:
@@ -184,12 +183,11 @@ Next, we define the metadata that will describe our data asset. This is what we
184
183
  },
185
184
  services: [
186
185
  {
187
- id: 'testFakeId',
186
+ id: 'db164c1b981e4d2974e90e61bda121512e6909c1035c908d68933ae4cfaba6b0',
188
187
  type: 'access',
189
- description: 'Download service',
190
188
  files: '',
191
- datatokenAddress: '0x0',
192
- serviceEndpoint: 'http://172.15.0.4:8030',
189
+ datatokenAddress: '0xa15024b732A8f2146423D14209eFd074e61964F3',
190
+ serviceEndpoint: 'http://127.0.0.1:8001',
193
191
  timeout: 0
194
192
  }
195
193
  ]
@@ -208,9 +206,11 @@ Next, we define the metadata that will describe our data asset. This is what we
208
206
  const config = new ConfigHelper().getConfig(
209
207
  parseInt(String((await publisherAccount.provider.getNetwork()).chainId))
210
208
  )
211
- config.providerUri = process.env.PROVIDER_URL || config.providerUri
212
- aquarius = new Aquarius(config?.metadataCacheUri)
213
- providerUrl = config?.providerUri
209
+ if (process.env.OCEAN_NODE_URL) {
210
+ config.oceanNodeUri = process.env.OCEAN_NODE_URL
211
+ }
212
+ aquarius = new Aquarius(config?.oceanNodeUri)
213
+ providerUrl = config?.oceanNodeUri
214
214
  addresses = JSON.parse(
215
215
  // eslint-disable-next-line security/detect-non-literal-fs-filename
216
216
  fs.readFileSync(
@@ -222,7 +222,7 @@ Next, we define the metadata that will describe our data asset. This is what we
222
222
  ```
223
223
  As we go along it's a good idea to console log the values so that you check they are right
224
224
  ```Typescript
225
- console.log(`Aquarius URL: ${config.metadataCacheUri}`)
225
+ console.log(`Indexer URL: ${config.oceanNodeUri}`)
226
226
  console.log(`Provider URL: ${providerUrl}`)
227
227
  console.log(`Deployed contracts address: ${addresses}`)
228
228
  console.log(`Publisher account address: ${await publisherAccount.getAddress()}`)
@@ -487,9 +487,11 @@ Before we call the contract we have to call `approve` so that the contract can m
487
487
  consumerAccount,
488
488
  await consumerAccount.getChainId()
489
489
  )
490
+
490
491
  ```
491
492
  Now we can make the contract call
492
493
  ```Typescript
494
+
493
495
  await fixedRate.buyDatatokens(freId, '1', '2')
494
496
 
495
497
  consumerOCEANBalance = await balance(
@@ -530,6 +532,17 @@ Next, we need to initialize the provider
530
532
  validUntil: initializeData.providerFee.validUntil
531
533
  }
532
534
 
535
+ console.log(`Provider fee amount: ${providerFees.providerFeeAmount}`)
536
+
537
+ const approveTx = await approve(
538
+ consumerAccount,
539
+ config,
540
+ await consumerAccount.getAddress(),
541
+ freDatatokenAddress,
542
+ providerFees.providerFeeAddress,
543
+ providerFees.providerFeeAmount
544
+ )
545
+
533
546
  datatoken = new Datatoken(consumerAccount, await consumerAccount.getChainId())
534
547
 
535
548
  ```
@@ -543,6 +556,8 @@ Lets now make the payment
543
556
  )
544
557
  const orderTx = await tx.wait()
545
558
  const orderStartedTx = getEventFromTx(orderTx, 'OrderStarted')
559
+ console.log(`Order started, tx: ${orderStartedTx.transactionHash}`)
560
+
546
561
  ```
547
562
  Now we can get the url
548
563
  ```Typescript
@@ -580,8 +595,10 @@ Lets check that the download URL was successfully received
580
595
  LoggerInstance.error('Download failed', e)
581
596
  assert.fail('Download failed')
582
597
  }
583
-
584
598
  ```
599
+ <!--
600
+ }).timeout(40000)
601
+ -->
585
602
 
586
603
  ## 8. Publish Data NFT and a Datatoken with a dispenser
587
604
 
@@ -639,9 +656,10 @@ Lets check that we managed to received all of those values without any problems
639
656
  console.log(`Dispenser NFT address: ${dispenserNftAddress}`)
640
657
  console.log(`Dispenser Datatoken address: ${dispenserDatatokenAddress}`)
641
658
  console.log(`Dispenser address: ${dispenserAddress}`)
642
-
643
659
  ```
644
-
660
+ <!--
661
+ }).timeout(40000)
662
+ -->
645
663
  ### 8.2 Set metadata in the dispenser NFT
646
664
  ```Typescript
647
665
  const nft = new Nft(
@@ -689,8 +707,10 @@ Now we need to encrypt file(s) using provider
689
707
  encryptedDDO,
690
708
  isAssetValid.hash
691
709
  )
692
-
693
710
  ```
711
+ <!--
712
+ }).timeout(40000)
713
+ -->
694
714
 
695
715
  ## 9. Consume a dispenser data asset
696
716
 
@@ -793,8 +813,10 @@ Let's check we received the download URL ok
793
813
  } catch (e) {
794
814
  assert.fail('Download failed')
795
815
  }
796
-
797
816
  ```
817
+ <!--
818
+ }).timeout(40000)
819
+ -->
798
820
 
799
821
  ## 10. Using ERC725 Key-Value Store
800
822
 
@@ -848,7 +870,9 @@ Use the `getData` method to get the data stored in the nft key value store
848
870
  ```
849
871
 
850
872
  That's it! Note the simplicity. All data was stored and retrieved from on-chain. We don't need Ocean Provider or Ocean Aquarius for these use cases (though the latter can help for fast querying & retrieval).
851
-
873
+ <!--
874
+ }).timeout(40000)
875
+ -->
852
876
 
853
877
 
854
878
  ## Editing this file