From f9d2fb4371dd33d9ffb62bf1b60bd01dca192a44 Mon Sep 17 00:00:00 2001 From: Christian Casazza Date: Wed, 7 Jun 2023 14:01:34 +0000 Subject: [PATCH] GITBOOK-444: change request with no subject merged in GitBook --- data-science/README.md | 6 +- developers/ocean.py/ocean-assets.md | 219 +++++++++++++++++++++++ developers/ocean.py/technical-details.md | 176 +----------------- 3 files changed, 223 insertions(+), 178 deletions(-) diff --git a/data-science/README.md b/data-science/README.md index 5d36155f..aaf7ba4d 100644 --- a/data-science/README.md +++ b/data-science/README.md @@ -7,13 +7,13 @@ coverY: 0 The world runs on data. From social media to shopping online to healthcare to financial planning, data drives our interactions in the world. Access to greater amounts of data can create a flywheel of value creation; better data leads to better insights which leads to greater profits. -Unfortunately, today's data infrastructure is broken. Data lives in silos unable to interact with each other. Sharing data is difficult due to the difficulty of managing a hodgepodge of different methods for ownership and access control across many different service providers and applications. Data privacy problems also loom over data sharing; once it is duplicated, the owner loses control over their assets. -Ocean Protocol was created to build a better system for how we manage and share our data assets. It repurposes the standards created within crypto and DeFi to facilitate a new paradigm of _self-custodial_ ownership and access control of our data assets. NFTs become a permissionless standard of ownership, ERC20s act as a permissionless standard for flexible access control rights, crypto wallets like metamask become a self-custodial holder of our assets. + +Ocean Protocol was built to democratize the free flow of data. It repurposes the standards created within crypto and DeFi to facilitate a new paradigm of _self-custodial_ ownership and access control of our data assets. NFTs become a permissionless standard of ownership, ERC20s act as a permissionless standard for flexible access control rights, crypto wallets like metamask become a self-custodial holder of our assets. -Ocean's Compute-to-Data engine resolves the trade-off between the benefits of open data and data privacy risks. Using the engine, algorithms can be run on +Ocean's [Compute-to-Data](../developers/compute-to-data/) engine resolves the trade-off between the benefits of open data and data privacy risks. Using the engine, algorithms can be run on data without exposing the underlying data. Now, data can be widely shared to contribute to the worlds shared knowledge while also respecting indivudals right to privacy. diff --git a/developers/ocean.py/ocean-assets.md b/developers/ocean.py/ocean-assets.md index 8b25c093..1613f12b 100644 --- a/developers/ocean.py/ocean-assets.md +++ b/developers/ocean.py/ocean-assets.md @@ -1,2 +1,221 @@ +--- +description: Technical details about OceanAssets functions +--- + # Ocean Assets +Through this class we can publish assets & consume them to make 💲💲💲 + +### Creates URL Asset + +* **create\_url\_asset**(`self`, `name: str`, `url: str`, `publisher_wallet`, `wait_for_aqua: bool = True` ) -> `tuple` + +It is the most used functions in all the READMEs. + +Creates asset of type "dataset", having `UrlFiles`, with good defaults. + +It can be called after instantiating Ocean object. + +**Parameters** + +* `name` - name of the asset, `string` +* `url` - url that is stored in the asset, `string` +* `publisher_wallet` - wallet of the asset publisher/owner, `Brownie account` +* `wait_for_aqua` - boolean value which default is `True`, waiting for aquarius to fetch the asset takes additional time, but if you want to be sure that your asset is indexed, keep the default value. + +**Returns** + +`tuple` + +A tuple which contains the data NFT, datatoken and the data asset. + +**Defined in** + +[ocean/ocean\_assets.py](https://github.com/oceanprotocol/ocean.py/blob/4aa12afd8a933d64bc2ed68d1e5359d0b9ae62f9/ocean\_lib/ocean/ocean\_assets.py#LL178C1-L185C82) + +
+ +Source code + +{% code overflow="wrap" %} +```python + @enforce_types + def create_url_asset( + self, name: str, url: str, publisher_wallet, wait_for_aqua: bool = True + ) -> tuple: + """Create asset of type "data", having UrlFiles, with good defaults""" + metadata = self._default_metadata(name, publisher_wallet) + files = [UrlFile(url)] + return self._create_1dt(metadata, files, publisher_wallet, wait_for_aqua) +``` +{% endcode %} + +
+ +### Creates Algorithm Asset + +* **create\_algo\_asset**(`self`, `name: str`, `url: str`, `publisher_wallet`, `image: str = "oceanprotocol/algo_dockers"`, `tag: str = "python-branin"`, `checksum: str = "sha256:8221d20c1c16491d7d56b9657ea09082c0ee4a8ab1a6621fa720da58b09580e4"`, `wait_for_aqua: bool = True`) -> `tuple`: + +Create asset of type "algorithm", having `UrlFiles`, with good defaults. + +It can be called after instantiating Ocean object. + +**Parameters**: + +* `name` - name of the asset, `string` +* `url` - url that is stored in the asset, `string` +* `publisher_wallet` - wallet of the asset publisher/owner, `Brownie account` +* `image` - docker image of that algorithm, `string` +* `tag` - docker tag for that algorithm image, `string` +* `checksum` - docker checksum for algorithm's image, `string` +* `wait_for_aqua` - boolean value which default is `True`, waiting for aquarius to fetch the asset takes additional time, but if you want to be sure that your asset is indexed, keep the default value. + +**Returns** + +`tuple` + +A tuple which contains the algorithm NFT, algorithm datatoken and the algorithm asset. + +**Defined in** + +[ocean/ocean\_assets.py](https://github.com/oceanprotocol/ocean.py/blob/4aa12afd8a933d64bc2ed68d1e5359d0b9ae62f9/ocean\_lib/ocean/ocean\_assets.py#LL146C4-L176C82) + +
+ +Source code + +{% code overflow="wrap" %} +```python +@enforce_types + def create_algo_asset( + self, + name: str, + url: str, + publisher_wallet, + image: str = "oceanprotocol/algo_dockers", + tag: str = "python-branin", + checksum: str = "sha256:8221d20c1c16491d7d56b9657ea09082c0ee4a8ab1a6621fa720da58b09580e4", + wait_for_aqua: bool = True, + ) -> tuple: + """Create asset of type "algorithm", having UrlFiles, with good defaults""" + + if image == "oceanprotocol/algo_dockers" or tag == "python-branin": + assert image == "oceanprotocol/algo_dockers" and tag == "python-branin" + + metadata = self._default_metadata(name, publisher_wallet, "algorithm") + metadata["algorithm"] = { + "language": "python", + "format": "docker-image", + "version": "0.1", + "container": { + "entrypoint": "python $ALGO", + "image": image, + "tag": tag, + "checksum": checksum, + }, + } + + files = [UrlFile(url)] + return self._create_1dt(metadata, files, publisher_wallet, wait_for_aqua) +``` +{% endcode %} + +
+ +### Creates Arweave Asset + +* **create\_arweave\_asset**(`self`, `name: str`, `transaction_id: str`, `publisher_wallet`, `wait_for_aqua: bool = True`) -> `tuple` + +Creates asset of type "data", having `ArweaveFile`, with good defaults. + +It can be called after instantiating Ocean object. + +**Parameters** + +* `name` - name of the asset, `string` +* `transaction_id` - transaction id from the arweave file, `string` +* `publisher_wallet` - wallet of the asset publisher/owner, `Brownie account` +* `wait_for_aqua` - boolean value which default is `True`, waiting for aquarius to fetch the asset takes additional time, but if you want to be sure that your asset is indexed, keep the default value. + +**Returns** + +`tuple` + +A tuple which contains the data NFT, datatoken and the data asset. + +**Defined in** + +[ocean/ocean\_assets.py](https://github.com/oceanprotocol/ocean.py/blob/4aa12afd8a933d64bc2ed68d1e5359d0b9ae62f9/ocean\_lib/ocean/ocean\_assets.py#LL187C5-L198C82) + +
+ +Source code + +{% code overflow="wrap" %} +```python +@enforce_types + def create_arweave_asset( + self, + name: str, + transaction_id: str, + publisher_wallet, + wait_for_aqua: bool = True, + ) -> tuple: + """Create asset of type "data", having ArweaveFiles, with good defaults""" + metadata = self._default_metadata(name, publisher_wallet) + files = [ArweaveFile(transaction_id)] + return self._create_1dt(metadata, files, publisher_wallet, wait_for_aqua) +``` +{% endcode %} + +
+ +### Creates GraphQL Asset + +* **create\_graphql\_asset**(`self`, `name: str`, `url: str`, `query: str`, `publisher_wallet`, `wait_for_aqua: bool = True`) -> `tuple` + +Creates asset of type "data", having `GraphqlQuery` files, with good defaults. + +It can be called after instantiating Ocean object. + +**Parameters** + +* `name` - name of the asset, `string` +* `url` - url of subgraph that you are using, `string` +* `query` - GraphQL query, `string` +* `publisher_wallet` - wallet of the asset publisher/owner, `Brownie account` +* `wait_for_aqua` - boolean value which default is `True`, waiting for aquarius to fetch the asset takes additional time, but if you want to be sure that your asset is indexed, keep the default value. + +**Returns** + +`tuple` + +A tuple which contains the data NFT, datatoken and the data asset. + +**Defined in** + +[ocean/ocean\_assets.py](https://github.com/oceanprotocol/ocean.py/blob/4aa12afd8a933d64bc2ed68d1e5359d0b9ae62f9/ocean\_lib/ocean/ocean\_assets.py#LL200C5-L212C82) + +
+ +Source code + +{% code overflow="wrap" %} +```python +@enforce_types + def create_graphql_asset( + self, + name: str, + url: str, + query: str, + publisher_wallet, + wait_for_aqua: bool = True, + ) -> tuple: + """Create asset of type "data", having GraphqlQuery files, w good defaults""" + metadata = self._default_metadata(name, publisher_wallet) + files = [GraphqlQuery(url, query)] + return self._create_1dt(metadata, files, publisher_wallet, wait_for_aqua) +``` +{% endcode %} + +
diff --git a/developers/ocean.py/technical-details.md b/developers/ocean.py/technical-details.md index e1216cb2..d1bce4bd 100644 --- a/developers/ocean.py/technical-details.md +++ b/developers/ocean.py/technical-details.md @@ -525,181 +525,7 @@ A dictionary which contains the following keys (`providerFeeAddress`, `providerF -#### Ocean Assets - -
- -ocean.assets.create_url_asset( self, name: str, url: str, publisher_wallet, wait_for_aqua: bool = True ) -> tuple - -It is the most used functions in all the READMEs. - -Creates asset of type "dataset", having `UrlFiles`, with good defaults. - -It can be called after instantiating Ocean object. - -Params: - -1. `name` - name of the asset, `string` -2. `url` - url that is stored in the asset, `string` -3. `publisher_wallet` - wallet of the asset publisher/owner, `Brownie account` -4. `wait_for_aqua` - boolean value which default is `True`, waiting for aquarius to fetch the asset takes additional time, but if you want to be sure that your asset is indexed, keep the default value. - -Return: - -A tuple which contains the data NFT, datatoken and the data asset. - -{% code overflow="wrap" %} -```python - @enforce_types - def create_url_asset( - self, name: str, url: str, publisher_wallet, wait_for_aqua: bool = True - ) -> tuple: - """Create asset of type "data", having UrlFiles, with good defaults""" - metadata = self._default_metadata(name, publisher_wallet) - files = [UrlFile(url)] - return self._create_1dt(metadata, files, publisher_wallet, wait_for_aqua) -``` -{% endcode %} - -
- -
- -ocean.assets.create_algo_asset( self, name: str, url: str, publisher_wallet, image: str = "oceanprotocol/algo_dockers", tag: str = "python-branin", checksum: str = "sha256:8221d20c1c16491d7d56b9657ea09082c0ee4a8ab1a6621fa720da58b09580e4", wait_for_aqua: bool = True) -> tuple - -Create asset of type "algorithm", having `UrlFiles`, with good defaults - -It can be called after instantiating Ocean object. - -Params: - -1. `name` - name of the asset, `string` -2. `url` - url that is stored in the asset, `string` -3. `publisher_wallet` - wallet of the asset publisher/owner, `Brownie account` -4. `image` - docker image of that algorithm, `string` -5. `tag` - docker tag for that algorithm image, `string` -6. `checksum` - docker checksum for algorithm's image, `string` -7. `wait_for_aqua` - boolean value which default is `True`, waiting for aquarius to fetch the asset takes additional time, but if you want to be sure that your asset is indexed, keep the default value. - -Return: - -A tuple which contains the algorithm NFT, algorithm datatoken and the algorithm asset. - -{% code overflow="wrap" %} -```python -@enforce_types - def create_algo_asset( - self, - name: str, - url: str, - publisher_wallet, - image: str = "oceanprotocol/algo_dockers", - tag: str = "python-branin", - checksum: str = "sha256:8221d20c1c16491d7d56b9657ea09082c0ee4a8ab1a6621fa720da58b09580e4", - wait_for_aqua: bool = True, - ) -> tuple: - """Create asset of type "algorithm", having UrlFiles, with good defaults""" - - if image == "oceanprotocol/algo_dockers" or tag == "python-branin": - assert image == "oceanprotocol/algo_dockers" and tag == "python-branin" - - metadata = self._default_metadata(name, publisher_wallet, "algorithm") - metadata["algorithm"] = { - "language": "python", - "format": "docker-image", - "version": "0.1", - "container": { - "entrypoint": "python $ALGO", - "image": image, - "tag": tag, - "checksum": checksum, - }, - } - - files = [UrlFile(url)] - return self._create_1dt(metadata, files, publisher_wallet, wait_for_aqua) -``` -{% endcode %} - -
- -
- -ocean.assets.create_arweave_asset( self, name: str, transaction_id: str, publisher_wallet, wait_for_aqua: bool = True) -> tuple - -Creates asset of type "data", having `ArweaveFile`, with good defaults. - -It can be called after instantiating Ocean object. - -Params: - -1. `name` - name of the asset, `string` -2. `transaction_id` - transaction id from the arweave file, `string` -3. `publisher_wallet` - wallet of the asset publisher/owner, `Brownie account` -4. `wait_for_aqua` - boolean value which default is `True`, waiting for aquarius to fetch the asset takes additional time, but if you want to be sure that your asset is indexed, keep the default value. - -Return: - -A tuple which contains the data NFT, datatoken and the data asset. - -{% code overflow="wrap" %} -```python -@enforce_types - def create_arweave_asset( - self, - name: str, - transaction_id: str, - publisher_wallet, - wait_for_aqua: bool = True, - ) -> tuple: - """Create asset of type "data", having ArweaveFiles, with good defaults""" - metadata = self._default_metadata(name, publisher_wallet) - files = [ArweaveFile(transaction_id)] - return self._create_1dt(metadata, files, publisher_wallet, wait_for_aqua) -``` -{% endcode %} - -
- -
- -ocean.assets.create_graphql_asset( self, name: str, url: str, query: str, publisher_wallet, wait_for_aqua: bool = True, ) -> tuple - -Creates asset of type "data", having `GraphqlQuery` files, with good defaults. - -It can be called after instantiating Ocean object. - -Params: - -1. `name` - name of the asset, `string` -2. `url` - url of subgraph that you are using, `string` -3. `query` - GraphQL query, `string` -4. `publisher_wallet` - wallet of the asset publisher/owner, `Brownie account` -5. `wait_for_aqua` - boolean value which default is `True`, waiting for aquarius to fetch the asset takes additional time, but if you want to be sure that your asset is indexed, keep the default value. - -Return: - -A tuple which contains the data NFT, datatoken and the data asset. - -{% code overflow="wrap" %} -```python -@enforce_types - def create_graphql_asset( - self, - name: str, - url: str, - query: str, - publisher_wallet, - wait_for_aqua: bool = True, - ) -> tuple: - """Create asset of type "data", having GraphqlQuery files, w good defaults""" - metadata = self._default_metadata(name, publisher_wallet) - files = [GraphqlQuery(url, query)] - return self._create_1dt(metadata, files, publisher_wallet, wait_for_aqua) -``` -{% endcode %} - -
+### Ocean Assets