@oceanprotocol/lib 3.0.0-next.1 → 3.0.0-next.3

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 (96) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/CodeExamples.md +1 -1
  3. package/dist/lib.js +1 -1
  4. package/dist/lib.js.map +1 -1
  5. package/dist/lib.modern.js +1 -1
  6. package/dist/lib.modern.js.map +1 -1
  7. package/dist/lib.module.js +1 -1
  8. package/dist/lib.module.js.map +1 -1
  9. package/dist/lib.umd.js +1 -1
  10. package/dist/lib.umd.js.map +1 -1
  11. package/docs/.nojekyll +1 -0
  12. package/docs/README.md +192 -0
  13. package/docs/classes/Aquarius.md +171 -0
  14. package/docs/classes/Config.md +481 -0
  15. package/docs/classes/ConfigHelper.md +66 -0
  16. package/docs/classes/Datatoken.md +1123 -0
  17. package/docs/classes/DfRewards.md +345 -0
  18. package/docs/classes/DfStrategyV1.md +313 -0
  19. package/docs/classes/Dispenser.md +502 -0
  20. package/docs/classes/FixedRateExchange.md +1068 -0
  21. package/docs/classes/Logger.md +191 -0
  22. package/docs/classes/Nft.md +970 -0
  23. package/docs/classes/NftFactory.md +861 -0
  24. package/docs/classes/Provider.md +628 -0
  25. package/docs/classes/Router.md +645 -0
  26. package/docs/classes/SmartContract.md +193 -0
  27. package/docs/classes/SmartContractWithAddress.md +268 -0
  28. package/docs/classes/VeAllocate.md +372 -0
  29. package/docs/classes/VeFeeDistributor.md +325 -0
  30. package/docs/classes/VeFeeEstimate.md +281 -0
  31. package/docs/classes/VeOcean.md +513 -0
  32. package/docs/enums/LogLevel.md +63 -0
  33. package/docs/interfaces/AbiInput.md +63 -0
  34. package/docs/interfaces/AbiItem.md +107 -0
  35. package/docs/interfaces/AbiOutput.md +52 -0
  36. package/docs/interfaces/Arweave.md +32 -0
  37. package/docs/interfaces/Asset.md +227 -0
  38. package/docs/interfaces/AssetDatatoken.md +60 -0
  39. package/docs/interfaces/AssetLastEvent.md +63 -0
  40. package/docs/interfaces/AssetNft.md +105 -0
  41. package/docs/interfaces/AssetPrice.md +47 -0
  42. package/docs/interfaces/ComputeAlgorithm.md +82 -0
  43. package/docs/interfaces/ComputeAsset.md +56 -0
  44. package/docs/interfaces/ComputeEnvironment.md +173 -0
  45. package/docs/interfaces/ComputeJob.md +140 -0
  46. package/docs/interfaces/ComputeOutput.md +118 -0
  47. package/docs/interfaces/ComputeResult.md +52 -0
  48. package/docs/interfaces/ConsumeMarketFee.md +41 -0
  49. package/docs/interfaces/Credential.md +30 -0
  50. package/docs/interfaces/Credentials.md +30 -0
  51. package/docs/interfaces/DDO.md +137 -0
  52. package/docs/interfaces/DatatokenCreateParams.md +107 -0
  53. package/docs/interfaces/DatatokenRoles.md +30 -0
  54. package/docs/interfaces/DispenserCreationParams.md +63 -0
  55. package/docs/interfaces/DispenserParams.md +52 -0
  56. package/docs/interfaces/DispenserToken.md +85 -0
  57. package/docs/interfaces/DownloadResponse.md +30 -0
  58. package/docs/interfaces/Event.md +73 -0
  59. package/docs/interfaces/FeesInfo.md +74 -0
  60. package/docs/interfaces/FileInfo.md +118 -0
  61. package/docs/interfaces/Files.md +41 -0
  62. package/docs/interfaces/FixedPriceExchange.md +162 -0
  63. package/docs/interfaces/FreCreationParams.md +118 -0
  64. package/docs/interfaces/FreOrderParams.md +85 -0
  65. package/docs/interfaces/GraphqlQuery.md +69 -0
  66. package/docs/interfaces/Ipfs.md +32 -0
  67. package/docs/interfaces/Metadata.md +193 -0
  68. package/docs/interfaces/MetadataAlgorithm.md +69 -0
  69. package/docs/interfaces/MetadataAndTokenURI.md +107 -0
  70. package/docs/interfaces/MetadataProof.md +52 -0
  71. package/docs/interfaces/NftCreateData.md +74 -0
  72. package/docs/interfaces/NftRoles.md +52 -0
  73. package/docs/interfaces/Operation.md +145 -0
  74. package/docs/interfaces/OrderParams.md +52 -0
  75. package/docs/interfaces/PriceAndFees.md +52 -0
  76. package/docs/interfaces/ProviderComputeInitialize.md +41 -0
  77. package/docs/interfaces/ProviderComputeInitializeResults.md +30 -0
  78. package/docs/interfaces/ProviderFees.md +96 -0
  79. package/docs/interfaces/ProviderInitialize.md +52 -0
  80. package/docs/interfaces/PublisherTrustedAlgorithm.md +47 -0
  81. package/docs/interfaces/PublishingMarketFee.md +41 -0
  82. package/docs/interfaces/Purgatory.md +34 -0
  83. package/docs/interfaces/SearchQuery.md +67 -0
  84. package/docs/interfaces/Service.md +138 -0
  85. package/docs/interfaces/ServiceComputeOptions.md +63 -0
  86. package/docs/interfaces/ServiceEndpoint.md +41 -0
  87. package/docs/interfaces/Smartcontract-1.md +58 -0
  88. package/docs/interfaces/Stats.md +47 -0
  89. package/docs/interfaces/Template.md +30 -0
  90. package/docs/interfaces/TokenOrder.md +63 -0
  91. package/docs/interfaces/UrlFile.md +71 -0
  92. package/docs/interfaces/UserCustomParameters.md +7 -0
  93. package/docs/interfaces/ValidateMetadata.md +52 -0
  94. package/docs/modules.md +856 -0
  95. package/package.json +7 -8
  96. package/typedoc.json +4 -0
package/docs/.nojekyll ADDED
@@ -0,0 +1 @@
1
+ TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.
package/docs/README.md ADDED
@@ -0,0 +1,192 @@
1
+ @oceanprotocol/lib / [Exports](modules.md)
2
+
3
+ [![banner](https://raw.githubusercontent.com/oceanprotocol/art/master/github/repo-banner%402x.png)](https://oceanprotocol.com)
4
+
5
+ <h1 align="center">ocean.js</h1>
6
+
7
+ > JavaScript library to privately & securely publish, exchange, and consume data.
8
+
9
+ [![npm](https://img.shields.io/npm/v/@oceanprotocol/lib.svg)](https://www.npmjs.com/package/@oceanprotocol/lib)
10
+ [![Build Status](https://github.com/oceanprotocol/ocean.js/workflows/CI/badge.svg)](https://github.com/oceanprotocol/ocean.js/actions)
11
+ [![Maintainability](https://api.codeclimate.com/v1/badges/6381c81b8ac568a53537/maintainability)](https://codeclimate.com/github/oceanprotocol/ocean.js/maintainability)
12
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/6381c81b8ac568a53537/test_coverage)](https://codeclimate.com/github/oceanprotocol/ocean.js/test_coverage)
13
+ [![code style: prettier](https://img.shields.io/badge/code_style-prettier-7b1173.svg?style=flat-square)](https://github.com/prettier/prettier)
14
+ [![js oceanprotocol](https://img.shields.io/badge/js-oceanprotocol-7b1173.svg)](https://github.com/oceanprotocol/eslint-config-oceanprotocol)
15
+
16
+ With ocean.js, you can:
17
+
18
+ - **Publish** data services: downloadable files or compute-to-data. Create an ERC721 **data NFT** for each service, and ERC20 **datatoken** for access (1.0 datatokens to access).
19
+ - **Sell** datatokens for a fixed price. Sell data NFTs.
20
+ - **Transfer** data NFTs & datatokens to another owner, and **all other ERC721 & ERC20 actions** using [web3.js](https://web3js.readthedocs.io/en/v1.2.9/web3-eth-contract.html) etc.
21
+
22
+ ocean.js is part of the [Ocean Protocol](https://oceanprotocol.com) toolset.
23
+
24
+ This is in alpha state. If you run into problems, please open up a [new issue](https://github.com/oceanprotocol/ocean.js/issues/new?assignees=&labels=bug&template=bug_report.md&title=).
25
+
26
+ - [📚 Prerequisites](#-prerequisites)
27
+ - [🏗 Installation & Usage](#-installation--usage)
28
+ - [🦑 Development](#-development)
29
+ - [✨ Code Style](#-code-style)
30
+ - [👩‍🔬 Testing](#-testing)
31
+ - [Unit Tests](#unit-tests)
32
+ - [Integration Tests](#integration-tests)
33
+ - [🛳 Production](#-production)
34
+ - [⬆️ Releases](#️-releases)
35
+ - [Production](#production)
36
+ - [Pre-Releases](#pre-releases)
37
+ - [🏛 License](#-license)
38
+
39
+ ## 📚 Prerequisites
40
+
41
+ - node.js ([Install from here](https://nodejs.org/en/download/))
42
+ - Docker ([Managed as a non-root user](https://docs.docker.com/engine/install/linux-postinstall/))
43
+ - A Unix based operating system (Mac or Linux)
44
+
45
+ ## 🏗 Installation & Usage
46
+
47
+ ```bash
48
+ npm install @oceanprotocol/lib
49
+ ```
50
+
51
+ - Checkout our [code examples](CodeExamples.md) or [compute to data examples](C2DExamples.md) to see how you can use ocean.js.
52
+ - Refer to the [Ocean Protocol documentation](https://docs.oceanprotocol.com/) for more guides and tutorials.
53
+ - Visit the [Ocean Protocol website](https://docs.oceanprotocol.com/) for general information about Ocean Protocol.
54
+ - 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).
55
+ - 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=).
56
+
57
+ ## 🦑 Development
58
+
59
+ The project is authored with TypeScript and compiled with `tsc`.
60
+
61
+ To start compiler in watch mode:
62
+
63
+ ```bash
64
+ npm install
65
+ npm start
66
+ ```
67
+
68
+ ## ✨ Code Style
69
+
70
+ For linting and auto-formatting you can use from the root of the project:
71
+
72
+ ```bash
73
+ # lint all js with eslint
74
+ npm run lint
75
+
76
+ # auto format all js & css with prettier, taking all configs into account
77
+ npm run format
78
+ ```
79
+
80
+ ## 👩‍🔬 Testing
81
+
82
+ Test suite for unit & integration tests is setup with [Mocha](https://mochajs.org) as test runner, and [nyc](https://github.com/istanbuljs/nyc) for coverage reporting. A combined coverage report is sent to CodeClimate via the `coverage` GitHub Actions job.
83
+
84
+ Running all tests requires running Ocean Protocol components beforehand with [Barge](https://github.com/oceanprotocol/barge), which also runs a `ganache-cli` instance:
85
+
86
+ ```bash
87
+ git clone https://github.com/oceanprotocol/barge
88
+ cd barge
89
+
90
+ ./start_ocean.sh --with-provider2 --no-dashboard --with-c2d
91
+ ```
92
+
93
+ You can then proceed to run in another terminal.
94
+
95
+ Let ocean.js know where to pickup the smart contract addresses, which has been written out by Barge in this location:
96
+
97
+ ```
98
+ export ADDRESS_FILE="${HOME}/.ocean/ocean-contracts/artifacts/address.json"
99
+ ```
100
+
101
+ Build metadata:
102
+
103
+ ```
104
+ npm run build:metadata
105
+ ```
106
+
107
+ Executing linting, type checking, unit, and integration tests with coverage reporting all in one go:
108
+
109
+ ```bash
110
+ npm test
111
+ ```
112
+
113
+ ### Unit Tests
114
+
115
+ You can execute the unit tests individually with:
116
+
117
+ ```bash
118
+ npm run test:unit
119
+ # same thing, but with coverage reporting
120
+ npm run test:unit:cover
121
+ ```
122
+
123
+ ### Integration Tests
124
+
125
+ You can execute the integration tests individually with:
126
+
127
+ ```bash
128
+ npm run test:integration
129
+ # same thing, but with coverage reporting
130
+ npm run test:integration:cover
131
+ ```
132
+
133
+ > Note: On macOS, changes to the `provider`, `metadataCache` and `subgraph` URLs are required, as their default `barge` IPs can not be accessed due to network constraints on macOS. Instead use `http://127.0.0.1` for each direct call to the mentioned services, but keep the internal `provider` URL (`http://172.15.0.4:8030`) hardcoded inside all DDO's `serviceEndpoint`, and when calling `nft.setMetadata()`.
134
+
135
+ ## 🛳 Production
136
+
137
+ To create a production build, run from the root of the project:
138
+
139
+ ```bash
140
+ npm run build
141
+ ```
142
+
143
+ ## ⬆️ Releases
144
+
145
+ Releases are managed semi-automatically. They are always manually triggered from a developer's machine with release scripts.
146
+
147
+ ### Production
148
+
149
+ From a clean `main` branch you can run the release task bumping the version accordingly based on semantic versioning:
150
+
151
+ ```bash
152
+ npm run release
153
+ ```
154
+
155
+ The task does the following:
156
+
157
+ - bumps the project version in `package.json`, `package-lock.json`
158
+ - auto-generates and updates the CHANGELOG.md file from commit messages
159
+ - creates a Git tag
160
+ - commits and pushes everything
161
+ - creates a GitHub release with commit messages as description
162
+ - Git tag push will trigger a GitHub Action workflow to do a npm release
163
+
164
+ For the GitHub releases steps a GitHub personal access token, exported as `GITHUB_TOKEN` is required. [Setup](https://github.com/release-it/release-it#github-releases)
165
+
166
+ ### Pre-Releases
167
+
168
+ For pre-releases, this is required for the first one like `v0.18.0-next.0`:
169
+
170
+ ```bash
171
+ ./node_modules/.bin/release-it major|minor|patch --preRelease=next
172
+ ```
173
+
174
+ Further releases afterwards can be done with `npm run release` again and selecting the appropriate next version, in this case `v0.18.0-next.1` and so on.
175
+
176
+ ## 🏛 License
177
+
178
+ ```
179
+ Copyright ((C)) 2023 Ocean Protocol Foundation
180
+
181
+ Licensed under the Apache License, Version 2.0 (the "License");
182
+ you may not use this file except in compliance with the License.
183
+ You may obtain a copy of the License at
184
+
185
+ http://www.apache.org/licenses/LICENSE-2.0
186
+
187
+ Unless required by applicable law or agreed to in writing, software
188
+ distributed under the License is distributed on an "AS IS" BASIS,
189
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
190
+ See the License for the specific language governing permissions and
191
+ limitations under the License.
192
+ ```
@@ -0,0 +1,171 @@
1
+ [@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / Aquarius
2
+
3
+ # Class: Aquarius
4
+
5
+ ## Table of contents
6
+
7
+ ### Constructors
8
+
9
+ - [constructor](Aquarius.md#constructor)
10
+
11
+ ### Properties
12
+
13
+ - [aquariusURL](Aquarius.md#aquariusurl)
14
+
15
+ ### Methods
16
+
17
+ - [getAssetMetadata](Aquarius.md#getassetmetadata)
18
+ - [querySearch](Aquarius.md#querysearch)
19
+ - [resolve](Aquarius.md#resolve)
20
+ - [validate](Aquarius.md#validate)
21
+ - [waitForAqua](Aquarius.md#waitforaqua)
22
+
23
+ ## Constructors
24
+
25
+ ### constructor
26
+
27
+ • **new Aquarius**(`aquariusURL`)
28
+
29
+ Instantiate Aquarius
30
+
31
+ #### Parameters
32
+
33
+ | Name | Type |
34
+ | :------ | :------ |
35
+ | `aquariusURL` | `string` |
36
+
37
+ #### Defined in
38
+
39
+ [services/Aquarius.ts:21](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Aquarius.ts#L21)
40
+
41
+ ## Properties
42
+
43
+ ### aquariusURL
44
+
45
+ • **aquariusURL**: `string`
46
+
47
+ #### Defined in
48
+
49
+ [services/Aquarius.ts:15](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Aquarius.ts#L15)
50
+
51
+ ## Methods
52
+
53
+ ### getAssetMetadata
54
+
55
+ ▸ **getAssetMetadata**(`did`, `signal?`): `Promise`<`any`\>
56
+
57
+ Search over the DDOs using a query.
58
+
59
+ #### Parameters
60
+
61
+ | Name | Type | Description |
62
+ | :------ | :------ | :------ |
63
+ | `did` | `string` | DID of the asset |
64
+ | `signal?` | `AbortSignal` | abort signal |
65
+
66
+ #### Returns
67
+
68
+ `Promise`<`any`\>
69
+
70
+ #### Defined in
71
+
72
+ [services/Aquarius.ts:135](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Aquarius.ts#L135)
73
+
74
+ ___
75
+
76
+ ### querySearch
77
+
78
+ ▸ **querySearch**(`query`, `signal?`): `Promise`<`any`\>
79
+
80
+ Search over the DDOs using a query.
81
+
82
+ #### Parameters
83
+
84
+ | Name | Type | Description |
85
+ | :------ | :------ | :------ |
86
+ | `query` | [`SearchQuery`](../interfaces/SearchQuery.md) | Query to filter the DDOs. |
87
+ | `signal?` | `AbortSignal` | abort signal |
88
+
89
+ #### Returns
90
+
91
+ `Promise`<`any`\>
92
+
93
+ #### Defined in
94
+
95
+ [services/Aquarius.ts:166](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Aquarius.ts#L166)
96
+
97
+ ___
98
+
99
+ ### resolve
100
+
101
+ ▸ **resolve**(`did`, `signal?`): `Promise`<[`Asset`](../interfaces/Asset.md)\>
102
+
103
+ Resolves a DID
104
+
105
+ #### Parameters
106
+
107
+ | Name | Type | Description |
108
+ | :------ | :------ | :------ |
109
+ | `did` | `string` | DID of the asset. |
110
+ | `signal?` | `AbortSignal` | abort signal |
111
+
112
+ #### Returns
113
+
114
+ `Promise`<[`Asset`](../interfaces/Asset.md)\>
115
+
116
+ Asset
117
+
118
+ #### Defined in
119
+
120
+ [services/Aquarius.ts:30](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Aquarius.ts#L30)
121
+
122
+ ___
123
+
124
+ ### validate
125
+
126
+ ▸ **validate**(`ddo`, `signal?`): `Promise`<[`ValidateMetadata`](../interfaces/ValidateMetadata.md)\>
127
+
128
+ Validate DDO content
129
+
130
+ #### Parameters
131
+
132
+ | Name | Type | Description |
133
+ | :------ | :------ | :------ |
134
+ | `ddo` | [`DDO`](../interfaces/DDO.md) | DID Descriptor Object content. |
135
+ | `signal?` | `AbortSignal` | abort signal |
136
+
137
+ #### Returns
138
+
139
+ `Promise`<[`ValidateMetadata`](../interfaces/ValidateMetadata.md)\>
140
+
141
+ .
142
+
143
+ #### Defined in
144
+
145
+ [services/Aquarius.ts:94](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Aquarius.ts#L94)
146
+
147
+ ___
148
+
149
+ ### waitForAqua
150
+
151
+ ▸ **waitForAqua**(`did`, `txid?`, `signal?`): `Promise`<[`Asset`](../interfaces/Asset.md)\>
152
+
153
+ Blocks until Aqua will cache the did (or the update for that did) or timeouts
154
+
155
+ #### Parameters
156
+
157
+ | Name | Type | Description |
158
+ | :------ | :------ | :------ |
159
+ | `did` | `string` | DID of the asset. |
160
+ | `txid?` | `string` | used when the did exists and we expect an update with that txid. |
161
+ | `signal?` | `AbortSignal` | abort signal |
162
+
163
+ #### Returns
164
+
165
+ `Promise`<[`Asset`](../interfaces/Asset.md)\>
166
+
167
+ DDO of the asset.
168
+
169
+ #### Defined in
170
+
171
+ [services/Aquarius.ts:58](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Aquarius.ts#L58)