@oceanprotocol/lib 4.0.0-next.1 → 4.0.1

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.
Files changed (65) hide show
  1. package/.mocharc.json +8 -0
  2. package/CHANGELOG.md +77 -69
  3. package/CodeExamples.md +7 -6
  4. package/ComputeExamples.md +127 -98
  5. package/README.md +9 -0
  6. package/dist/lib.cjs +2 -0
  7. package/dist/lib.cjs.map +1 -0
  8. package/dist/lib.modern.js +1 -1
  9. package/dist/lib.modern.js.map +1 -1
  10. package/dist/lib.module.mjs +2 -0
  11. package/dist/lib.module.mjs.map +1 -0
  12. package/dist/lib.umd.js +1 -1
  13. package/dist/lib.umd.js.map +1 -1
  14. package/dist/types/@types/Compute.d.ts +46 -14
  15. package/dist/types/@types/DDO/Metadata.d.ts +1 -1
  16. package/dist/types/@types/DDO/Service.d.ts +2 -2
  17. package/dist/types/@types/File.d.ts +1 -1
  18. package/dist/types/@types/index.d.ts +20 -20
  19. package/dist/types/config/index.d.ts +2 -2
  20. package/dist/types/contracts/AccessList.d.ts +3 -3
  21. package/dist/types/contracts/AccessListFactory.d.ts +3 -3
  22. package/dist/types/contracts/Datatoken.d.ts +4 -4
  23. package/dist/types/contracts/Datatoken4.d.ts +4 -4
  24. package/dist/types/contracts/Dispenser.d.ts +3 -3
  25. package/dist/types/contracts/FixedRateExchange.d.ts +2 -2
  26. package/dist/types/contracts/NFT.d.ts +2 -2
  27. package/dist/types/contracts/NFTFactory.d.ts +3 -3
  28. package/dist/types/contracts/Router.d.ts +2 -2
  29. package/dist/types/contracts/SmartContract.d.ts +3 -3
  30. package/dist/types/contracts/SmartContractWithAddress.d.ts +3 -3
  31. package/dist/types/contracts/df/DfRewards.d.ts +1 -1
  32. package/dist/types/contracts/df/DfStrategyV1.d.ts +1 -1
  33. package/dist/types/contracts/index.d.ts +20 -20
  34. package/dist/types/contracts/ve/VeAllocate.d.ts +2 -2
  35. package/dist/types/contracts/ve/VeFeeDistributor.d.ts +2 -2
  36. package/dist/types/contracts/ve/VeFeeEstimate.d.ts +2 -2
  37. package/dist/types/contracts/ve/VeOcean.d.ts +2 -2
  38. package/dist/types/index.d.ts +5 -5
  39. package/dist/types/services/Aquarius.d.ts +7 -4
  40. package/dist/types/services/Provider.d.ts +33 -8
  41. package/dist/types/services/index.d.ts +2 -2
  42. package/dist/types/utils/Addresses.d.ts +23 -0
  43. package/dist/types/utils/Assets.d.ts +1 -23
  44. package/dist/types/utils/ContractUtils.d.ts +1 -1
  45. package/dist/types/utils/FetchHelper.d.ts +1 -1
  46. package/dist/types/utils/General.d.ts +1 -0
  47. package/dist/types/utils/OrderUtils.d.ts +5 -1
  48. package/dist/types/utils/SignatureUtils.d.ts +1 -0
  49. package/dist/types/utils/TokenUtils.d.ts +2 -2
  50. package/dist/types/utils/index.d.ts +13 -13
  51. package/docs/classes/Aquarius.md +9 -5
  52. package/docs/classes/NftFactory.md +1 -1
  53. package/docs/classes/Provider.md +39 -6
  54. package/docs/interfaces/ComputeEnvFees.md +30 -0
  55. package/docs/interfaces/ComputeEnvFeesStructure.md +20 -0
  56. package/docs/interfaces/ComputeEnvironment.md +50 -39
  57. package/docs/interfaces/ComputeResourcesPricingInfo.md +30 -0
  58. package/docs/interfaces/ComputeResourcesRequest.md +30 -0
  59. package/docs/interfaces/Metadata.md +1 -1
  60. package/docs/interfaces/RunningPlatform.md +30 -0
  61. package/package.json +30 -20
  62. package/dist/lib.js +0 -2
  63. package/dist/lib.js.map +0 -1
  64. package/dist/lib.module.js +0 -2
  65. package/dist/lib.module.js.map +0 -1
package/.mocharc.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "require": ["source-map-support/register", "mock-local-storage"],
3
+ "extension": ["ts"],
4
+ "timeout": 200000,
5
+ "bail": true,
6
+ "exit": true,
7
+ "fullTrace": true
8
+ }
package/CHANGELOG.md CHANGED
@@ -4,18 +4,83 @@ 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.0.1](https://github.com/oceanprotocol/ocean.js/compare/v4.0.0...v4.0.1)
8
+
9
+ - moving the getChainId call [`#1928`](https://github.com/oceanprotocol/ocean.js/pull/1928)
10
+
11
+ ### [v4.0.0](https://github.com/oceanprotocol/ocean.js/compare/v4.0.0-next.1...v4.0.0)
12
+
13
+ > 18 March 2025
14
+
15
+ - Release 4.0 [`#1922`](https://github.com/oceanprotocol/ocean.js/pull/1922)
16
+ - add policy server option to getDownloadUrl [`#1917`](https://github.com/oceanprotocol/ocean.js/pull/1917)
17
+ - add missing exports, refactor addresses file [`#1904`](https://github.com/oceanprotocol/ocean.js/pull/1904)
18
+ - Use serviceIndex instead of hardcoded indexes. [`#1905`](https://github.com/oceanprotocol/ocean.js/pull/1905)
19
+ - Bump path-to-regexp and express [`#1893`](https://github.com/oceanprotocol/ocean.js/pull/1893)
20
+ - make retries and interval bigger & configurable on waitForAqua [`#1895`](https://github.com/oceanprotocol/ocean.js/pull/1895)
21
+ - Bump eslint-config-prettier from 9.0.0 to 9.1.0 [`#1884`](https://github.com/oceanprotocol/ocean.js/pull/1884)
22
+ - Add back check for access list factory. [`#1889`](https://github.com/oceanprotocol/ocean.js/pull/1889)
23
+ - Remove circular dependencies, fix imports and improve build [`#1881`](https://github.com/oceanprotocol/ocean.js/pull/1881)
24
+ - chore: remove redundant words in comment [`#1890`](https://github.com/oceanprotocol/ocean.js/pull/1890)
25
+ - Bump @truffle/hdwallet-provider from 2.1.10 to 2.1.15 [`#1886`](https://github.com/oceanprotocol/ocean.js/pull/1886)
26
+ - Bump nyc from 15.1.0 to 17.1.0 [`#1883`](https://github.com/oceanprotocol/ocean.js/pull/1883)
27
+ - Bump @types/crypto-js from 4.1.2 to 4.2.2 [`#1882`](https://github.com/oceanprotocol/ocean.js/pull/1882)
28
+ - Bump actions/download-artifact from 2 to 4.1.7 in /.github/workflows [`#1844`](https://github.com/oceanprotocol/ocean.js/pull/1844)
29
+ - Remove node:16 docker image from workflow. [`#1879`](https://github.com/oceanprotocol/ocean.js/pull/1879)
30
+ - Bump rollup from 2.61.1 to 2.79.2 [`#1866`](https://github.com/oceanprotocol/ocean.js/pull/1866)
31
+ - Remove checks from publishing. ADded chain ID check for ordering. [`#1875`](https://github.com/oceanprotocol/ocean.js/pull/1875)
32
+ - done [`60d0272`](https://github.com/oceanprotocol/ocean.js/commit/60d027294a2893410860f1180ff47177e12e45de)
33
+ - rename waitForAqua as waitForIndexer [`6381795`](https://github.com/oceanprotocol/ocean.js/commit/6381795c957f301b93461d84a14ff59991b58738)
34
+ - 4th pass [`bf94e10`](https://github.com/oceanprotocol/ocean.js/commit/bf94e102e53dd07eac6c671ef222b96e34ffca7f)
35
+
7
36
  #### [v4.0.0-next.1](https://github.com/oceanprotocol/ocean.js/compare/v4.0.0-next.0...v4.0.0-next.1)
8
37
 
38
+ > 12 November 2024
39
+
9
40
  - add datasets on ComputeAsset, new start compute fn [`8563429`](https://github.com/oceanprotocol/ocean.js/commit/85634293306fca9aaa3ab5ae06a114149ccc8911)
10
41
  - support for consumer signature on initialize compute [`71c5923`](https://github.com/oceanprotocol/ocean.js/commit/71c59230db99a08a6c28df66c26e32ca61c71089)
11
42
  - add file object types [`cd936c2`](https://github.com/oceanprotocol/ocean.js/commit/cd936c24a989633d3d8e71b908a375802d2e2970)
12
43
 
13
- #### [v4.0.0-next.0](https://github.com/oceanprotocol/ocean.js/compare/v3.4.3...v4.0.0-next.0)
44
+ #### [v4.0.0-next.0](https://github.com/oceanprotocol/ocean.js/compare/v3.4.6...v4.0.0-next.0)
14
45
 
15
46
  > 12 November 2024
16
47
 
17
48
  - Release 4.0.0-next.0 [`658cfe8`](https://github.com/oceanprotocol/ocean.js/commit/658cfe83ff855a83eb97e3cbf1276bed6022a1a6)
18
49
 
50
+ #### [v3.4.6](https://github.com/oceanprotocol/ocean.js/compare/v3.4.5...v3.4.6)
51
+
52
+ > 8 January 2025
53
+
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
+ - rename waitForAqua as waitForIndexer [`6381795`](https://github.com/oceanprotocol/ocean.js/commit/6381795c957f301b93461d84a14ff59991b58738)
57
+ - Release 3.4.6 [`edd3581`](https://github.com/oceanprotocol/ocean.js/commit/edd3581df80e59f7f6ce64c9e1ae5e4553835f92)
58
+ - make retries and interval bigger & configurable [`2b6e537`](https://github.com/oceanprotocol/ocean.js/commit/2b6e537f4e2a06603cfb62c61a2af5f471b4a699)
59
+
60
+ #### [v3.4.5](https://github.com/oceanprotocol/ocean.js/compare/v3.4.4...v3.4.5)
61
+
62
+ > 19 December 2024
63
+
64
+ - Add back check for access list factory. [`#1889`](https://github.com/oceanprotocol/ocean.js/pull/1889)
65
+ - Remove circular dependencies, fix imports and improve build [`#1881`](https://github.com/oceanprotocol/ocean.js/pull/1881)
66
+ - chore: remove redundant words in comment [`#1890`](https://github.com/oceanprotocol/ocean.js/pull/1890)
67
+ - Bump @truffle/hdwallet-provider from 2.1.10 to 2.1.15 [`#1886`](https://github.com/oceanprotocol/ocean.js/pull/1886)
68
+ - Bump nyc from 15.1.0 to 17.1.0 [`#1883`](https://github.com/oceanprotocol/ocean.js/pull/1883)
69
+ - Bump @types/crypto-js from 4.1.2 to 4.2.2 [`#1882`](https://github.com/oceanprotocol/ocean.js/pull/1882)
70
+ - Bump actions/download-artifact from 2 to 4.1.7 in /.github/workflows [`#1844`](https://github.com/oceanprotocol/ocean.js/pull/1844)
71
+ - Remove node:16 docker image from workflow. [`#1879`](https://github.com/oceanprotocol/ocean.js/pull/1879)
72
+ - Bump rollup from 2.61.1 to 2.79.2 [`#1866`](https://github.com/oceanprotocol/ocean.js/pull/1866)
73
+ - done [`60d0272`](https://github.com/oceanprotocol/ocean.js/commit/60d027294a2893410860f1180ff47177e12e45de)
74
+ - 4th pass [`bf94e10`](https://github.com/oceanprotocol/ocean.js/commit/bf94e102e53dd07eac6c671ef222b96e34ffca7f)
75
+ - Release 3.4.5 [`a1ee835`](https://github.com/oceanprotocol/ocean.js/commit/a1ee835294b6a51721c3c215dd3c16f741b0573b)
76
+
77
+ #### [v3.4.4](https://github.com/oceanprotocol/ocean.js/compare/v3.4.3...v3.4.4)
78
+
79
+ > 20 November 2024
80
+
81
+ - Remove checks from publishing. ADded chain ID check for ordering. [`#1875`](https://github.com/oceanprotocol/ocean.js/pull/1875)
82
+ - Release 3.4.4 [`fa242a5`](https://github.com/oceanprotocol/ocean.js/commit/fa242a5095d16327adf2d53830a643350fcdfa84)
83
+
19
84
  #### [v3.4.3](https://github.com/oceanprotocol/ocean.js/compare/v3.4.2...v3.4.3)
20
85
 
21
86
  > 5 November 2024
@@ -171,29 +236,15 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
171
236
  - make sure we increment a number when working with nonces [`#1781`](https://github.com/oceanprotocol/ocean.js/pull/1781)
172
237
  - Release 3.1.4 [`b2e2cf2`](https://github.com/oceanprotocol/ocean.js/commit/b2e2cf24293af07f597c25e3a3e392db9caa381a)
173
238
 
174
- #### [v3.1.3](https://github.com/oceanprotocol/ocean.js/compare/v3.1.3-next.1...v3.1.3)
239
+ #### [v3.1.3](https://github.com/oceanprotocol/ocean.js/compare/v3.1.2...v3.1.3)
175
240
 
176
241
  > 16 October 2023
177
242
 
178
243
  - fix fs use & error handling [`#1777`](https://github.com/oceanprotocol/ocean.js/pull/1777)
179
244
  - Bump postcss from 8.4.5 to 8.4.31 [`#1778`](https://github.com/oceanprotocol/ocean.js/pull/1778)
180
- - Release 3.1.3 [`1bc5a39`](https://github.com/oceanprotocol/ocean.js/commit/1bc5a39fda217c91cf5c44f41c6275acd20740de)
181
-
182
- #### [v3.1.3-next.1](https://github.com/oceanprotocol/ocean.js/compare/v3.1.3-next.0...v3.1.3-next.1)
183
-
184
- > 11 October 2023
185
-
186
- - update error handling [`aada8e9`](https://github.com/oceanprotocol/ocean.js/commit/aada8e92af9273ccc20e86dc00ea73bcb7e8dfdf)
187
- - Release 3.1.3-next.1 [`40c22b9`](https://github.com/oceanprotocol/ocean.js/commit/40c22b9b1fa147fd4295da1bdd6248d7714a2b30)
188
-
189
- #### [v3.1.3-next.0](https://github.com/oceanprotocol/ocean.js/compare/v3.1.2...v3.1.3-next.0)
190
-
191
- > 6 October 2023
192
-
193
245
  - Bump @types/crypto-js from 4.1.1 to 4.1.2 [`#1774`](https://github.com/oceanprotocol/ocean.js/pull/1774)
194
246
  - Bump @types/chai-spies from 1.0.3 to 1.0.4 [`#1776`](https://github.com/oceanprotocol/ocean.js/pull/1776)
195
- - fix fs use [`735dc2f`](https://github.com/oceanprotocol/ocean.js/commit/735dc2f62b976be683bc9fcd7f8940e715b18519)
196
- - Release 3.1.3-next.0 [`5ac5d1f`](https://github.com/oceanprotocol/ocean.js/commit/5ac5d1f44a637b5d8d285757941b0393bb3a7983)
247
+ - Release 3.1.3 [`1bc5a39`](https://github.com/oceanprotocol/ocean.js/commit/1bc5a39fda217c91cf5c44f41c6275acd20740de)
197
248
 
198
249
  #### [v3.1.2](https://github.com/oceanprotocol/ocean.js/compare/v3.1.1...v3.1.2)
199
250
 
@@ -252,22 +303,14 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
252
303
  - Merge 8699e4a8bb30b3ecb7ee894412ebe85267fddd67 into ae2ff1ccde53ace9841844c316a855de271f9a3f [`9da0268`](https://github.com/oceanprotocol/ocean.js/commit/9da0268be6ddfb1e4f110ee48725e8c9a492f6fb)
253
304
  - Adding tests to check if the number of decimals is correct for the publishMarketFee [`8699e4a`](https://github.com/oceanprotocol/ocean.js/commit/8699e4a8bb30b3ecb7ee894412ebe85267fddd67)
254
305
 
255
- #### [v3.0.1](https://github.com/oceanprotocol/ocean.js/compare/v3.0.1-next.0...v3.0.1)
306
+ #### [v3.0.1](https://github.com/oceanprotocol/ocean.js/compare/v3.0.0...v3.0.1)
256
307
 
257
308
  > 6 June 2023
258
309
 
259
310
  - set min gas fee 30 gwei on priority fees for polygon and mumbai as well [`#1736`](https://github.com/oceanprotocol/ocean.js/pull/1736)
260
311
  - Release 3.0.1 [`ae2ff1c`](https://github.com/oceanprotocol/ocean.js/commit/ae2ff1ccde53ace9841844c316a855de271f9a3f)
261
312
 
262
- #### [v3.0.1-next.0](https://github.com/oceanprotocol/ocean.js/compare/v3.0.0...v3.0.1-next.0)
263
-
264
- > 31 May 2023
265
-
266
- - Release 3.0.1-next.0 [`b670073`](https://github.com/oceanprotocol/ocean.js/commit/b67007363a8e2a3b640411c3b6471edeacdf5d19)
267
- - Merge 04deabccd3ffbc8d3620e42a8b1bc4a2d5019e54 into 543f71f7cda1b3d0099cc26975d34b89bead7452 [`c33663c`](https://github.com/oceanprotocol/ocean.js/commit/c33663cfdbf501c407d3e1e17f56b17761f9e556)
268
- - set min gas fee 30 gwei on priority fees for polygon and mumbai as well [`04deabc`](https://github.com/oceanprotocol/ocean.js/commit/04deabccd3ffbc8d3620e42a8b1bc4a2d5019e54)
269
-
270
- #### [v3.0.0](https://github.com/oceanprotocol/ocean.js/compare/v3.0.0-next.5...v3.0.0)
313
+ ### [v3.0.0](https://github.com/oceanprotocol/ocean.js/compare/v3.0.0-next.5...v3.0.0)
271
314
 
272
315
  > 29 May 2023
273
316
 
@@ -336,7 +379,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
336
379
  - more cleanup and jsdoc updates [`967f664`](https://github.com/oceanprotocol/ocean.js/commit/967f6642fb1a0cf9c20d4f4fa28d36527d8e43ba)
337
380
  - Updating CodeExamples.md [`815ee37`](https://github.com/oceanprotocol/ocean.js/commit/815ee37c52f9aa64f2cac4948fb137f447d1c6b4)
338
381
 
339
- #### [v2.7.0](https://github.com/oceanprotocol/ocean.js/compare/v2.7.0-next.2...v2.7.0)
382
+ #### [v2.7.0](https://github.com/oceanprotocol/ocean.js/compare/v2.6.3...v2.7.0)
340
383
 
341
384
  > 20 March 2023
342
385
 
@@ -347,29 +390,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
347
390
  - Updated copyright year. [`#1700`](https://github.com/oceanprotocol/ocean.js/pull/1700)
348
391
  - Release 2.7.0 [`a2e9901`](https://github.com/oceanprotocol/ocean.js/commit/a2e9901697b32c6aaaa489c3bec1a19fcfa185ab)
349
392
 
350
- #### [v2.7.0-next.2](https://github.com/oceanprotocol/ocean.js/compare/v2.7.0-next.1...v2.7.0-next.2)
351
-
352
- > 22 February 2023
353
-
354
- - Release 2.7.0-next.2 [`2687751`](https://github.com/oceanprotocol/ocean.js/commit/26877517ff8a7537729e37cf6c68260ca3b3bcf4)
355
- - fix isValid provider method [`010306c`](https://github.com/oceanprotocol/ocean.js/commit/010306c92e003021b08df0b8b8ad6743ae6b240c)
356
-
357
- #### [v2.7.0-next.1](https://github.com/oceanprotocol/ocean.js/compare/v2.7.0-next.0...v2.7.0-next.1)
358
-
359
- > 22 February 2023
360
-
361
- - Release 2.7.0-next.0 [`500062b`](https://github.com/oceanprotocol/ocean.js/commit/500062beb575b21ab7210a675bdf5174d11842c8)
362
- - Updating CodeExamples.md [`6cc891a`](https://github.com/oceanprotocol/ocean.js/commit/6cc891a5da9e4042e3eee243b651e8a7188d1786)
363
- - Release 2.7.0-next.1 [`ba27412`](https://github.com/oceanprotocol/ocean.js/commit/ba2741296167de4c112560f2807b1a45e86eba94)
364
-
365
- #### [v2.7.0-next.0](https://github.com/oceanprotocol/ocean.js/compare/v2.6.3...v2.7.0-next.0)
366
-
367
- > 21 February 2023
368
-
369
- - add needed multichain provider changes [`95551ee`](https://github.com/oceanprotocol/ocean.js/commit/95551eeb669395357149dd923ecec304955add14)
370
- - Release 2.7.0-next.0 [`95886a1`](https://github.com/oceanprotocol/ocean.js/commit/95886a184faadd4a13e857e285e016ef4c20966f)
371
- - fix code example [`c4a00e4`](https://github.com/oceanprotocol/ocean.js/commit/c4a00e45848ace6a4fe3d4fa1a2aeac518aa44ce)
372
-
373
393
  #### [v2.6.3](https://github.com/oceanprotocol/ocean.js/compare/v2.6.2...v2.6.3)
374
394
 
375
395
  > 13 February 2023
@@ -543,7 +563,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
543
563
  - put back paid env test [`219d4b4`](https://github.com/oceanprotocol/ocean.js/commit/219d4b4a1e1a2bba04cfaa2e26808b0f4a1fa717)
544
564
  - update asset timeouts [`9fc8a8e`](https://github.com/oceanprotocol/ocean.js/commit/9fc8a8ebb316d0aefcce6d38f83aeb6f4fc5734d)
545
565
 
546
- #### [v2.0.0](https://github.com/oceanprotocol/ocean.js/compare/v2.0.0-next.3...v2.0.0)
566
+ ### [v2.0.0](https://github.com/oceanprotocol/ocean.js/compare/v2.0.0-next.3...v2.0.0)
547
567
 
548
568
  > 7 September 2022
549
569
 
@@ -671,21 +691,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
671
691
  - Bump typedoc from 0.22.15 to 0.22.17 [`#1514`](https://github.com/oceanprotocol/ocean.js/pull/1514)
672
692
  - Release 1.1.3 [`7772e93`](https://github.com/oceanprotocol/ocean.js/commit/7772e9387ef9d63f98ea80cfd4eefbea963dd0ad)
673
693
 
674
- #### [v1.1.2](https://github.com/oceanprotocol/ocean.js/compare/v1.1.1...v1.1.2)
675
-
676
- > 15 June 2022
677
-
678
- - Release 1.1.2 [`85bf271`](https://github.com/oceanprotocol/ocean.js/commit/85bf2716e26d8691aeb9d5504e563d557419dc2e)
679
- - manual bump fix [`5674a54`](https://github.com/oceanprotocol/ocean.js/commit/5674a547d1d367ce88b3595f0be8ebbf12274266)
680
-
681
- #### [v1.1.1](https://github.com/oceanprotocol/ocean.js/compare/v1.1.0...v1.1.1)
682
-
683
- > 15 June 2022
684
-
685
- - Release 1.1.1 [`ea48e01`](https://github.com/oceanprotocol/ocean.js/commit/ea48e015ac8299f71d57a929f8f30c5d1a8446e7)
686
- - manual bump fix [`a362410`](https://github.com/oceanprotocol/ocean.js/commit/a36241004b1d9578ec5c02d9d6e64d9750c53a7b)
687
-
688
- #### [v1.1.0](https://github.com/oceanprotocol/ocean.js/compare/v1.0.0...v1.1.0)
694
+ #### [v1.1.2](https://github.com/oceanprotocol/ocean.js/compare/v1.0.0...v1.1.2)
689
695
 
690
696
  > 15 June 2022
691
697
 
@@ -693,9 +699,11 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
693
699
  - Bump @types/node from 17.0.35 to 17.0.44 [`#1513`](https://github.com/oceanprotocol/ocean.js/pull/1513)
694
700
  - Bump eslint-config-oceanprotocol from 1.5.0 to 2.0.1 [`#1466`](https://github.com/oceanprotocol/ocean.js/pull/1466)
695
701
  - update to new schema & compute fixes [`#1510`](https://github.com/oceanprotocol/ocean.js/pull/1510)
696
- - Release 1.1.0 [`112c27e`](https://github.com/oceanprotocol/ocean.js/commit/112c27edab58ef0681ea3e87fb09978411924753)
702
+ - Release 1.1.2 [`85bf271`](https://github.com/oceanprotocol/ocean.js/commit/85bf2716e26d8691aeb9d5504e563d557419dc2e)
703
+ - manual bump fix [`5674a54`](https://github.com/oceanprotocol/ocean.js/commit/5674a547d1d367ce88b3595f0be8ebbf12274266)
704
+ - manual bump fix [`a362410`](https://github.com/oceanprotocol/ocean.js/commit/a36241004b1d9578ec5c02d9d6e64d9750c53a7b)
697
705
 
698
- #### [v1.0.0](https://github.com/oceanprotocol/ocean.js/compare/v1.0.0-next.45...v1.0.0)
706
+ ### [v1.0.0](https://github.com/oceanprotocol/ocean.js/compare/v1.0.0-next.45...v1.0.0)
699
707
 
700
708
  > 8 June 2022
701
709
 
package/CodeExamples.md CHANGED
@@ -79,7 +79,7 @@ Start by importing all of the necessary dependencies
79
79
  import fs from 'fs'
80
80
 
81
81
  import { ethers, providers, Signer } from 'ethers'
82
- import { SHA256 } from 'crypto-js'
82
+ import crypto from 'crypto-js'
83
83
  import { homedir } from 'os'
84
84
  import {
85
85
  approve,
@@ -109,8 +109,9 @@ import {
109
109
  getEventFromTx,
110
110
  DDO,
111
111
  LoggerInstance
112
- } from '@oceanprotocol/lib'
112
+ } from '../../src/index.js'
113
113
  ```
114
+ const { SHA256 } = crypto
114
115
 
115
116
  <!--
116
117
  describe('Marketplace flow tests
@@ -165,7 +166,7 @@ Next, we define the metadata that will describe our data asset. This is what we
165
166
  ```Typescript
166
167
  const genericAsset: DDO = {
167
168
  '@context': ['https://w3id.org/did/v1'],
168
- id: '',
169
+ id: 'did:op',
169
170
  version: '4.1.0',
170
171
  chainId: 8996,
171
172
  nftAddress: '0x0',
@@ -504,7 +505,7 @@ Now we can make the contract call
504
505
  )
505
506
  console.log(`Consumer ${FRE_NFT_SYMBOL} balance after swap: ${consumerDTBalance}`)
506
507
 
507
- const resolvedDDO = await aquarius.waitForAqua(fixedDDO.id)
508
+ const resolvedDDO = await aquarius.waitForIndexer(fixedDDO.id)
508
509
  assert(resolvedDDO, 'Cannot fetch DDO from Aquarius')
509
510
 
510
511
  ```
@@ -726,7 +727,7 @@ Now we need to encrypt file(s) using provider
726
727
  `Consumer ${DISP_NFT_SYMBOL} balance after dispense: ${consumerDTBalance}`
727
728
  )
728
729
 
729
- const resolvedDDO = await aquarius.waitForAqua(fixedDDO.id)
730
+ const resolvedDDO = await aquarius.waitForIndexer(fixedDDO.id)
730
731
  assert(resolvedDDO, 'Cannot fetch DDO from Aquarius')
731
732
 
732
733
  datatoken = new Datatoken(consumerAccount, await consumerAccount.getChainId())
@@ -821,7 +822,7 @@ Let's start by using the `setData` method to update the nft key value store with
821
822
  data
822
823
  )
823
824
  } catch (e) {
824
- console.log('e = ', e)
825
+ console.log('error = ', e)
825
826
  assert.fail('Failed to set data in NFT ERC725 key value store', e)
826
827
  }
827
828
  ```
@@ -119,7 +119,6 @@ Start by importing all of the necessary dependencies
119
119
  import fs from 'fs'
120
120
  import { homedir } from 'os'
121
121
 
122
- import { SHA256 } from 'crypto-js'
123
122
  import { ethers, providers, Signer } from 'ethers'
124
123
  import {
125
124
  ProviderInstance,
@@ -144,9 +143,12 @@ import {
144
143
  configHelperNetworks,
145
144
  ConfigHelper,
146
145
  getEventFromTx,
147
- amountToUnits
148
- } from '@oceanprotocol/lib'
146
+ amountToUnits,
147
+ isDefined
148
+ } from '../../src/index.js'
149
149
  ```
150
+ import crypto from 'crypto-js'
151
+ const { SHA256 } = crypto
150
152
 
151
153
  ### 4.2. Constants and variables
152
154
 
@@ -275,15 +277,18 @@ let resolvedAlgorithmDdo: DDO
275
277
 
276
278
  let computeJobId: string
277
279
  let agreementId: string
280
+
281
+ let computeRoutePath: string
282
+ let hasFreeComputeSupport: boolean
278
283
  ```
279
284
 
280
285
  ### 4.3 Helper methods
281
286
 
282
287
  Now we define the helper methods which we will use later to publish the dataset and algorithm, and also order them
283
288
 
284
- Add a `createAsset()`function.
289
+ Add a `createAssetHelper()`function.
285
290
  ```Typescript
286
- async function createAsset(
291
+ async function createAssetHelper(
287
292
  name: string,
288
293
  symbol: string,
289
294
  owner: Signer,
@@ -503,7 +508,7 @@ you need to mint oceans to mentioned accounts only if you are using barge to tes
503
508
 
504
509
  ### 6.1 Publish a dataset (create NFT + Datatoken) and set dataset metadata
505
510
  ```Typescript
506
- datasetId = await createAsset(
511
+ datasetId = await createAssetHelper(
507
512
  'D1Min',
508
513
  'D1M',
509
514
  publisherAccount,
@@ -520,7 +525,7 @@ Now, let's check that we successfully published a dataset (create NFT + Datatoke
520
525
 
521
526
  ### 6.2 Publish an algorithm (create NFT + Datatoken) and set algorithm metadata
522
527
  ```Typescript
523
- algorithmId = await createAsset(
528
+ algorithmId = await createAssetHelper(
524
529
  'D1Min',
525
530
  'D1M',
526
531
  publisherAccount,
@@ -539,8 +544,8 @@ Now, let's check that we successfully published a algorithm (create NFT + Datato
539
544
 
540
545
  ### 7.1 Resolve published datasets and algorithms
541
546
  ```Typescript
542
- resolvedDatasetDdo = await aquariusInstance.waitForAqua(datasetId)
543
- resolvedAlgorithmDdo = await aquariusInstance.waitForAqua(algorithmId)
547
+ resolvedDatasetDdo = await aquariusInstance.waitForIndexer(datasetId)
548
+ resolvedAlgorithmDdo = await aquariusInstance.waitForIndexer(algorithmId)
544
549
  ```
545
550
  <!--
546
551
  assert(resolvedDatasetDdo, 'Cannot fetch DDO from Aquarius')
@@ -594,7 +599,7 @@ Now, let's check that we successfully published a algorithm (create NFT + Datato
594
599
  let's check the free compute environment
595
600
  ```Typescript
596
601
  const computeEnv = computeEnvs[resolvedDatasetDdo.chainId].find(
597
- (ce) => ce.priceMin === 0
602
+ (ce) => ce.priceMin === 0 || isDefined(ce.free)
598
603
  )
599
604
  console.log('Free compute environment = ', computeEnv)
600
605
  ```
@@ -602,111 +607,135 @@ let's check the free compute environment
602
607
  assert(computeEnv, 'Cannot find the free compute env')
603
608
  -->
604
609
 
605
- Let's have 5 minute of compute access
606
- ```Typescript
607
- const mytime = new Date()
608
- const computeMinutes = 5
609
- mytime.setMinutes(mytime.getMinutes() + computeMinutes)
610
- const computeValidUntil = Math.floor(mytime.getTime() / 1000)
611
-
612
- const assets: ComputeAsset[] = [
613
- {
614
- documentId: resolvedDatasetDdo.id,
615
- serviceId: resolvedDatasetDdo.services[0].id
610
+ computeRoutePath = await ProviderInstance.getComputeStartRoutes(providerUrl, true)
611
+ if (isDefined(computeRoutePath)) {
612
+ hasFreeComputeSupport = true
613
+ Let's have 5 minute of compute access
614
+ ```Typescript
615
+ const mytime = new Date()
616
+ const computeMinutes = 5
617
+ mytime.setMinutes(mytime.getMinutes() + computeMinutes)
618
+ const computeValidUntil = Math.floor(mytime.getTime() / 1000)
619
+
620
+ const assets: ComputeAsset[] = [
621
+ {
622
+ documentId: resolvedDatasetDdo.id,
623
+ serviceId: resolvedDatasetDdo.services[0].id
624
+ }
625
+ ]
626
+ const dtAddressArray = [resolvedDatasetDdo.services[0].datatokenAddress]
627
+ const algo: ComputeAlgorithm = {
628
+ documentId: resolvedAlgorithmDdo.id,
629
+ serviceId: resolvedAlgorithmDdo.services[0].id
616
630
  }
617
- ]
618
- const dtAddressArray = [resolvedDatasetDdo.services[0].datatokenAddress]
619
- const algo: ComputeAlgorithm = {
620
- documentId: resolvedAlgorithmDdo.id,
621
- serviceId: resolvedAlgorithmDdo.services[0].id
622
- }
623
631
 
624
- const providerInitializeComputeResults = await ProviderInstance.initializeCompute(
625
- assets,
626
- algo,
627
- computeEnv.id,
628
- computeValidUntil,
629
- providerUrl,
630
- consumerAccount
631
- )
632
- ```
633
- <!--
634
- assert(!('error' in providerInitializeComputeResults), 'Cannot order algorithm')
635
- -->
636
- ```Typescript
637
- algo.transferTxId = await handleOrder(
638
- providerInitializeComputeResults.algorithm,
639
- resolvedAlgorithmDdo.services[0].datatokenAddress,
640
- consumerAccount,
641
- computeEnv.consumerAddress,
642
- 0
643
- )
644
- for (let i = 0; i < providerInitializeComputeResults.datasets.length; i++) {
645
- assets[i].transferTxId = await handleOrder(
646
- providerInitializeComputeResults.datasets[i],
647
- dtAddressArray[i],
632
+ const providerInitializeComputeResults = await ProviderInstance.initializeCompute(
633
+ assets,
634
+ algo,
635
+ computeEnv.id,
636
+ computeValidUntil,
637
+ providerUrl,
638
+ consumerAccount
639
+ )
640
+ ```
641
+ <!--
642
+ assert(!('error' in providerInitializeComputeResults), 'Cannot order algorithm')
643
+ -->
644
+ ```Typescript
645
+ algo.transferTxId = await handleOrder(
646
+ providerInitializeComputeResults.algorithm,
647
+ resolvedAlgorithmDdo.services[0].datatokenAddress,
648
648
  consumerAccount,
649
649
  computeEnv.consumerAddress,
650
650
  0
651
651
  )
652
- }
652
+ for (let i = 0; i < providerInitializeComputeResults.datasets.length; i++) {
653
+ assets[i].transferTxId = await handleOrder(
654
+ providerInitializeComputeResults.datasets[i],
655
+ dtAddressArray[i],
656
+ consumerAccount,
657
+ computeEnv.consumerAddress,
658
+ 0
659
+ )
660
+ }
653
661
 
654
- const computeJobs = await ProviderInstance.computeStart(
655
- providerUrl,
656
- consumerAccount,
657
- computeEnv.id,
658
- assets,
659
- algo
660
- )
662
+ const computeJobs = await ProviderInstance.freeComputeStart(
663
+ providerUrl,
664
+ consumerAccount,
665
+ computeEnv.id,
666
+ assets,
667
+ algo
668
+ )
661
669
 
662
- ```
663
- <!--
664
- assert(computeJobs, 'Cannot start compute job')
665
- -->
666
- Let's save the compute job it, we re going to use later
667
- ```Typescript
668
- computeJobId = computeJobs[0].jobId
669
- // eslint-disable-next-line prefer-destructuring
670
- agreementId = computeJobs[0].agreementId
670
+ ```
671
+ <!--
672
+ assert(computeJobs, 'Cannot start compute job')
673
+ -->
674
+ Let's save the compute job it, we re going to use later
675
+ ```Typescript
676
+ computeJobId = computeJobs[0].jobId
677
+ // eslint-disable-next-line prefer-destructuring
678
+ agreementId = computeJobs[0].agreementId
679
+ } else {
680
+ assert(
681
+ computeRoutePath === null,
682
+ 'Route path for free compute is not defined (perhaps because provider does not support it yet?)'
683
+ )
684
+ hasFreeComputeSupport = false
685
+ }
671
686
 
672
687
  ```
673
688
 
674
689
  ## 11. Check compute status and get download compute results URL
675
690
  ### 11.1 Check compute status
676
- You can also add various delays so you see the various states of the compute job
677
- ```Typescript
678
- const jobStatus = await ProviderInstance.computeStatus(
679
- providerUrl,
680
- await consumerAccount.getAddress(),
681
- computeJobId,
682
- agreementId
683
- )
684
- ```
685
- <!--
686
- assert(jobStatus, 'Cannot retrieve compute status!')
687
- -->
688
- Now, let's see the current status of the previously started computer job
689
- ```Typescript
690
- console.log('Current status of the compute job: ', jobStatus)
691
+ if (!hasFreeComputeSupport) {
692
+ assert(
693
+ computeRoutePath === null,
694
+ 'Compute route path for free compute is not defined (perhaps because provider does not support it yet?)'
695
+ )
696
+ } else {
697
+ You can also add various delays so you see the various states of the compute job
698
+ ```Typescript
699
+ const jobStatus = await ProviderInstance.computeStatus(
700
+ providerUrl,
701
+ await consumerAccount.getAddress(),
702
+ computeJobId,
703
+ agreementId
704
+ )
705
+ ```
706
+ <!--
707
+ assert(jobStatus, 'Cannot retrieve compute status!')
708
+ -->
709
+ Now, let's see the current status of the previously started computer job
710
+ ```Typescript
711
+ console.log('Current status of the compute job: ', jobStatus)
712
+ }
691
713
 
692
714
  ```
693
715
 
694
716
  ### 11.2 Get download compute results URL
695
- ```Typescript
696
- await sleep(10000)
697
- const downloadURL = await ProviderInstance.getComputeResultUrl(
698
- providerUrl,
699
- consumerAccount,
700
- computeJobId,
701
- 0
702
- )
703
- ```
704
- <!--
705
- assert(downloadURL, 'Provider getComputeResultUrl failed!')
706
- -->
707
- Let's check the compute results url for the specified index
708
- ```Typescript
709
- console.log(`Compute results URL: ${downloadURL}`)
717
+ if (!hasFreeComputeSupport) {
718
+ assert(
719
+ computeRoutePath === null,
720
+ 'Compute route path for free compute is not defined (perhaps because provider does not support it yet?)'
721
+ )
722
+ } else {
723
+ ```Typescript
724
+ await sleep(10000)
725
+ const downloadURL = await ProviderInstance.getComputeResultUrl(
726
+ providerUrl,
727
+ consumerAccount,
728
+ computeJobId,
729
+ 0
730
+ )
731
+ ```
732
+ <!--
733
+ assert(downloadURL, 'Provider getComputeResultUrl failed!')
734
+ -->
735
+ Let's check the compute results url for the specified index
736
+ ```Typescript
737
+ console.log(`Compute results URL: ${downloadURL}`)
738
+ }
710
739
 
711
740
  ```
712
741
 
package/README.md CHANGED
@@ -51,6 +51,15 @@ npm install @oceanprotocol/lib
51
51
  - Visit the [Ocean Protocol website](https://docs.oceanprotocol.com/) for general information about Ocean Protocol.
52
52
  - If you have any difficulties or if you have further questions about how to use ocean.js please reach out to us on [Discord](https://discord.gg/TnXjkR5).
53
53
  - If you notice any bugs or issues with ocean.js please [open an issue on github](https://github.com/oceanprotocol/ocean.js/issues/new?assignees=&labels=bug&template=bug_report.md&title=).
54
+ - Developers using this library should ensure their tsconfig.json includes the necessary options:
55
+ ```
56
+ {
57
+ "moduleResolution": "node",
58
+ "esModuleInterop": true,
59
+ "allowSyntheticDefaultImports": true
60
+ }
61
+ ```
62
+ - If using Next.js, they may need "moduleResolution": "bundler" for better compatibility.
54
63
 
55
64
  ## 🦑 Development
56
65