@oceanprotocol/lib 2.5.2 → 2.6.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.
- package/CHANGELOG.md +36 -16
- package/CodeExamples.md +49 -2
- package/ComputeExamples.md +703 -0
- package/README.md +2 -2
- package/dist/lib.js +1 -1
- package/dist/lib.js.map +1 -1
- package/dist/lib.modern.js +1 -1
- package/dist/lib.modern.js.map +1 -1
- package/dist/lib.module.js +1 -1
- package/dist/lib.module.js.map +1 -1
- package/dist/lib.umd.js +1 -1
- package/dist/lib.umd.js.map +1 -1
- package/dist/src/@types/File.d.ts +14 -0
- package/dist/src/contracts/Datatoken.d.ts +10 -0
- package/dist/src/services/Provider.d.ts +6 -4
- package/dist/test/integration/ComputeExamples.test.d.ts +1 -0
- package/package.json +10 -8
package/CHANGELOG.md
CHANGED
|
@@ -4,11 +4,43 @@ 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
|
+
#### [v2.6.1](https://github.com/oceanprotocol/ocean.js/compare/v2.6.0...v2.6.1)
|
|
8
|
+
|
|
9
|
+
- Fix download when content disposition header missing [`#1680`](https://github.com/oceanprotocol/ocean.js/pull/1680)
|
|
10
|
+
- Bump prettier from 2.7.1 to 2.8.1 [`#1676`](https://github.com/oceanprotocol/ocean.js/pull/1676)
|
|
11
|
+
- Bump @types/node from 18.8.0 to 18.11.18 [`#1675`](https://github.com/oceanprotocol/ocean.js/pull/1675)
|
|
12
|
+
- Bump release-it from 15.5.0 to 15.6.0 [`#1674`](https://github.com/oceanprotocol/ocean.js/pull/1674)
|
|
13
|
+
- Bump @truffle/hdwallet-provider from 2.1.2 to 2.1.4 [`#1677`](https://github.com/oceanprotocol/ocean.js/pull/1677)
|
|
14
|
+
- Bump @typescript-eslint/eslint-plugin from 5.45.0 to 5.47.1 [`#1678`](https://github.com/oceanprotocol/ocean.js/pull/1678)
|
|
15
|
+
- Adding instructions on how to use ERC725 in the CodeExamples file [`#1672`](https://github.com/oceanprotocol/ocean.js/pull/1672)
|
|
16
|
+
- Min 30gwei polygon main and mumbai fees [`#1671`](https://github.com/oceanprotocol/ocean.js/pull/1671)
|
|
17
|
+
- Combining tests and checking that the data received is correct [`39ac4a4`](https://github.com/oceanprotocol/ocean.js/commit/39ac4a40462938c5f1b1f482eaf05bce2812c360)
|
|
18
|
+
- Updating assertion failure messages [`5d3bcde`](https://github.com/oceanprotocol/ocean.js/commit/5d3bcde5bd66588f18efdacc7cd1aafe1c158f0e)
|
|
19
|
+
- Updating guide and formatting [`726e34c`](https://github.com/oceanprotocol/ocean.js/commit/726e34c8fc013523d7db6bad7a86687c9a462f2d)
|
|
20
|
+
|
|
21
|
+
#### [v2.6.0](https://github.com/oceanprotocol/ocean.js/compare/v2.5.2...v2.6.0)
|
|
22
|
+
|
|
23
|
+
> 19 December 2022
|
|
24
|
+
|
|
25
|
+
- Add missing symbol and name helper on datatoken [`#1667`](https://github.com/oceanprotocol/ocean.js/pull/1667)
|
|
26
|
+
- add headers [`#1665`](https://github.com/oceanprotocol/ocean.js/pull/1665)
|
|
27
|
+
- Compute Example Readme flow [`#1615`](https://github.com/oceanprotocol/ocean.js/pull/1615)
|
|
28
|
+
- Updating test command in readme [`#1663`](https://github.com/oceanprotocol/ocean.js/pull/1663)
|
|
29
|
+
- Bump qs from 6.5.2 to 6.5.3 [`#1664`](https://github.com/oceanprotocol/ocean.js/pull/1664)
|
|
30
|
+
- Bump decode-uri-component from 0.2.0 to 0.2.2 [`#1662`](https://github.com/oceanprotocol/ocean.js/pull/1662)
|
|
31
|
+
- Bump @typescript-eslint/eslint-plugin from 5.38.1 to 5.45.0 [`#1657`](https://github.com/oceanprotocol/ocean.js/pull/1657)
|
|
32
|
+
- Bump @truffle/hdwallet-provider from 2.1.0 to 2.1.2 [`#1656`](https://github.com/oceanprotocol/ocean.js/pull/1656)
|
|
33
|
+
- Bump web3 from 1.8.0 to 1.8.1 [`#1659`](https://github.com/oceanprotocol/ocean.js/pull/1659)
|
|
34
|
+
- Release 2.6.0 [`94fd276`](https://github.com/oceanprotocol/ocean.js/commit/94fd276d6b34b3e4d620871d06e7e23271be6868)
|
|
35
|
+
|
|
7
36
|
#### [v2.5.2](https://github.com/oceanprotocol/ocean.js/compare/v2.5.1...v2.5.2)
|
|
8
37
|
|
|
38
|
+
> 15 November 2022
|
|
39
|
+
|
|
9
40
|
- add subgraph url to barge config and fix metadatacache config [`#1652`](https://github.com/oceanprotocol/ocean.js/pull/1652)
|
|
10
41
|
- Updating types to include the price which is sent from Aquarius [`#1651`](https://github.com/oceanprotocol/ocean.js/pull/1651)
|
|
11
42
|
- Bump loader-utils from 1.4.0 to 1.4.2 [`#1650`](https://github.com/oceanprotocol/ocean.js/pull/1650)
|
|
43
|
+
- Release 2.5.2 [`6bc9f0e`](https://github.com/oceanprotocol/ocean.js/commit/6bc9f0ee37ffd8ec4e092db66e476cbfa8fc179d)
|
|
12
44
|
|
|
13
45
|
#### [v2.5.1](https://github.com/oceanprotocol/ocean.js/compare/v2.5.0...v2.5.1)
|
|
14
46
|
|
|
@@ -252,21 +284,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
252
284
|
- Bump typedoc from 0.22.15 to 0.22.17 [`#1514`](https://github.com/oceanprotocol/ocean.js/pull/1514)
|
|
253
285
|
- Release 1.1.3 [`7772e93`](https://github.com/oceanprotocol/ocean.js/commit/7772e9387ef9d63f98ea80cfd4eefbea963dd0ad)
|
|
254
286
|
|
|
255
|
-
#### [v1.1.2](https://github.com/oceanprotocol/ocean.js/compare/v1.
|
|
256
|
-
|
|
257
|
-
> 15 June 2022
|
|
258
|
-
|
|
259
|
-
- Release 1.1.2 [`85bf271`](https://github.com/oceanprotocol/ocean.js/commit/85bf2716e26d8691aeb9d5504e563d557419dc2e)
|
|
260
|
-
- manual bump fix [`5674a54`](https://github.com/oceanprotocol/ocean.js/commit/5674a547d1d367ce88b3595f0be8ebbf12274266)
|
|
261
|
-
|
|
262
|
-
#### [v1.1.1](https://github.com/oceanprotocol/ocean.js/compare/v1.1.0...v1.1.1)
|
|
263
|
-
|
|
264
|
-
> 15 June 2022
|
|
265
|
-
|
|
266
|
-
- Release 1.1.1 [`ea48e01`](https://github.com/oceanprotocol/ocean.js/commit/ea48e015ac8299f71d57a929f8f30c5d1a8446e7)
|
|
267
|
-
- manual bump fix [`a362410`](https://github.com/oceanprotocol/ocean.js/commit/a36241004b1d9578ec5c02d9d6e64d9750c53a7b)
|
|
268
|
-
|
|
269
|
-
#### [v1.1.0](https://github.com/oceanprotocol/ocean.js/compare/v1.0.0...v1.1.0)
|
|
287
|
+
#### [v1.1.2](https://github.com/oceanprotocol/ocean.js/compare/v1.0.0...v1.1.2)
|
|
270
288
|
|
|
271
289
|
> 15 June 2022
|
|
272
290
|
|
|
@@ -274,7 +292,9 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
274
292
|
- Bump @types/node from 17.0.35 to 17.0.44 [`#1513`](https://github.com/oceanprotocol/ocean.js/pull/1513)
|
|
275
293
|
- Bump eslint-config-oceanprotocol from 1.5.0 to 2.0.1 [`#1466`](https://github.com/oceanprotocol/ocean.js/pull/1466)
|
|
276
294
|
- update to new schema & compute fixes [`#1510`](https://github.com/oceanprotocol/ocean.js/pull/1510)
|
|
277
|
-
- Release 1.1.
|
|
295
|
+
- Release 1.1.2 [`85bf271`](https://github.com/oceanprotocol/ocean.js/commit/85bf2716e26d8691aeb9d5504e563d557419dc2e)
|
|
296
|
+
- manual bump fix [`5674a54`](https://github.com/oceanprotocol/ocean.js/commit/5674a547d1d367ce88b3595f0be8ebbf12274266)
|
|
297
|
+
- manual bump fix [`a362410`](https://github.com/oceanprotocol/ocean.js/commit/a36241004b1d9578ec5c02d9d6e64d9750c53a7b)
|
|
278
298
|
|
|
279
299
|
#### [v1.0.0](https://github.com/oceanprotocol/ocean.js/compare/v1.0.0-next.45...v1.0.0)
|
|
280
300
|
|
package/CodeExamples.md
CHANGED
|
@@ -110,7 +110,7 @@ import {
|
|
|
110
110
|
ZERO_ADDRESS,
|
|
111
111
|
calculateEstimatedGas,
|
|
112
112
|
sendTx
|
|
113
|
-
} from '
|
|
113
|
+
} from '@oceanprotocol/lib'
|
|
114
114
|
import { getAddresses, getTestConfig, web3 } from '../config'
|
|
115
115
|
```
|
|
116
116
|
|
|
@@ -166,7 +166,7 @@ Next, we define the metadata that will describe our data asset. This is what we
|
|
|
166
166
|
'@context': ['https://w3id.org/did/v1'],
|
|
167
167
|
id: '',
|
|
168
168
|
version: '4.1.0',
|
|
169
|
-
chainId:
|
|
169
|
+
chainId: 5,
|
|
170
170
|
nftAddress: '0x0',
|
|
171
171
|
metadata: {
|
|
172
172
|
created: '2021-12-20T14:35:20Z',
|
|
@@ -677,6 +677,53 @@ Let's check we received the download URL ok
|
|
|
677
677
|
|
|
678
678
|
```
|
|
679
679
|
|
|
680
|
+
## 8. Using ERC725 Key-Value Store
|
|
681
|
+
|
|
682
|
+
Data NFTs can store arbitrary key-value pairs on-chain. This opens up their usage for a broad variety of applications, such as comments & ratings, attestations, and privately sharing data (when the value is encrypted).
|
|
683
|
+
|
|
684
|
+
Let's see how!
|
|
685
|
+
|
|
686
|
+
Here are the steps:
|
|
687
|
+
|
|
688
|
+
1. Setup (same as above)
|
|
689
|
+
2. Publish data NFT (same as above)
|
|
690
|
+
3. Add key-value pair to data NFT (use the `setData` method)
|
|
691
|
+
4. Retrieve value from data NFT (use the `getData` method)
|
|
692
|
+
|
|
693
|
+
### 8.1 Add key-value pair to data NFT
|
|
694
|
+
Let's start by using the `setData` method to update the nft key value store with some data
|
|
695
|
+
```Typescript
|
|
696
|
+
const nft = new Nft(web3)
|
|
697
|
+
const data = 'SomeData'
|
|
698
|
+
try {
|
|
699
|
+
await nft.setData(freNftAddress, publisherAccount, '1', data)
|
|
700
|
+
} catch (e) {
|
|
701
|
+
assert.fail('Failed to set data in NFT ERC725 key value store', e)
|
|
702
|
+
}
|
|
703
|
+
```
|
|
704
|
+
|
|
705
|
+
Under the hood, this uses [ERC725](https://erc725alliance.org/), which augments ERC721 with a well-defined way to set and get key-value pairs.
|
|
706
|
+
|
|
707
|
+
### 8.2 get the key-value pair data from the NFT'
|
|
708
|
+
|
|
709
|
+
Use the `getData` method to get the data stored in the nft key value store
|
|
710
|
+
|
|
711
|
+
```Typescript
|
|
712
|
+
try {
|
|
713
|
+
const response = await nft.getData(freNftAddress, '1')
|
|
714
|
+
console.log('getData response: ', response)
|
|
715
|
+
assert(
|
|
716
|
+
response === data,
|
|
717
|
+
'Wrong data received when getting data from NFT ERC725 key value store'
|
|
718
|
+
)
|
|
719
|
+
} catch (e) {
|
|
720
|
+
assert.fail('Failed to get data from NFT ERC725 key value store', e)
|
|
721
|
+
}
|
|
722
|
+
```
|
|
723
|
+
|
|
724
|
+
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).
|
|
725
|
+
|
|
726
|
+
|
|
680
727
|
|
|
681
728
|
## Editing this file
|
|
682
729
|
Please note that CodeExamples.md is an autogenerated file, you should not edit it directly.
|