1
0
mirror of https://github.com/oceanprotocol/docs.git synced 2024-11-26 19:49:26 +01:00

GITBOOK-430: change request with no subject merged in GitBook

This commit is contained in:
mariacarmina.cretu 2023-06-07 13:09:44 +00:00 committed by gitbook-bot
parent 7ab67b1a71
commit e896d707fd
No known key found for this signature in database
GPG Key ID: 07D2180C7B12D0FF
12 changed files with 204 additions and 57 deletions

View File

Before

Width:  |  Height:  |  Size: 320 KiB

After

Width:  |  Height:  |  Size: 320 KiB

View File

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 78 KiB

View File

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 77 KiB

View File

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 77 KiB

View File

@ -1,6 +1,6 @@
--- ---
description: Help for wherever you are on your Ocean Protocol journey. description: Help for wherever you are on your Ocean Protocol journey.
cover: .gitbook/assets/cover/contribute (1).png cover: .gitbook/assets/cover/contribute (1) (1) (2).png
coverY: 0 coverY: 0
layout: landing layout: landing
--- ---

View File

@ -41,7 +41,7 @@
* [Asset Pricing](developers/asset-pricing.md) * [Asset Pricing](developers/asset-pricing.md)
* [Fees](developers/fees.md) * [Fees](developers/fees.md)
* [Metadata](developers/contracts/metadata.md) * [Metadata](developers/contracts/metadata.md)
* [Fractional Ownership](developers/datanft-and-datatoken/fractional-ownership.md) * [Fractional Ownership](developers/contracts/fractional-ownership.md)
* [Community Monetization](developers/community-monetization.md) * [Community Monetization](developers/community-monetization.md)
* [Identifiers & Metadata](developers/Identifiers-Metadata.md) * [Identifiers & Metadata](developers/Identifiers-Metadata.md)
* [DDO Specification](developers/ddo-specification.md) * [DDO Specification](developers/ddo-specification.md)
@ -66,7 +66,10 @@
* [Publish flow](developers/ocean.py/publish-flow.md) * [Publish flow](developers/ocean.py/publish-flow.md)
* [Consume flow](developers/ocean.py/consume-flow.md) * [Consume flow](developers/ocean.py/consume-flow.md)
* [Compute flow](developers/ocean.py/compute-flow.md) * [Compute flow](developers/ocean.py/compute-flow.md)
* [Technical Details](developers/ocean.py/technical-details.md) * [Ocean Instance](developers/ocean.py/technical-details.md)
* [Ocean Assets](developers/ocean.py/ocean-assets.md)
* [Ocean Compute](developers/ocean.py/ocean-compute.md)
* [Datatoken Interface](developers/ocean.py/datatoken-interface.md)
* [Ocean.js](developers/ocean.js/README.md) * [Ocean.js](developers/ocean.js/README.md)
* [Configuration](developers/ocean.js/configuration.md) * [Configuration](developers/ocean.js/configuration.md)
* [Creating a data NFT](developers/ocean.js/creating-datanft.md) * [Creating a data NFT](developers/ocean.js/creating-datanft.md)

View File

@ -0,0 +1,2 @@
# Datatoken Interface

View File

@ -0,0 +1,2 @@
# Ocean Assets

View File

@ -0,0 +1,2 @@
# Ocean Compute

View File

@ -2,13 +2,11 @@
description: Technical details about most used ocean.py functions description: Technical details about most used ocean.py functions
--- ---
# Technical Details # Ocean Instance
At the beginning of most flows, we create an `ocean` object, which is an instance of class [`Ocean`](https://github.com/oceanprotocol/ocean.py/blob/main/ocean\_lib/ocean/ocean.py). It exposes useful information, including the following. At the beginning of most flows, we create an `ocean` object, which is an instance of class [`Ocean`](https://github.com/oceanprotocol/ocean.py/blob/main/ocean\_lib/ocean/ocean.py). It exposes useful information, including the following.
### Ocean Instance ### Constructor
#### constructor
* **\_\_init\_\_**(`self`, `config_dict: Dict`, `data_provider: Optional[Type] = None`) * **\_\_init\_\_**(`self`, `config_dict: Dict`, `data_provider: Optional[Type] = None`)
@ -94,9 +92,9 @@ class Ocean:
</details> </details>
#### config getter ### Config Getter
**config**(`self`) -> `dict` * **config**(`self`) -> `dict`
It is a helper method for retrieving the user's configuration for ocean.py.\ It is a helper method for retrieving the user's configuration for ocean.py.\
It can be called only by Ocean object and returns a python dictionary. It can be called only by Ocean object and returns a python dictionary.
@ -124,15 +122,27 @@ Configuration fields as dictionary.
</details> </details>
OCEAN token: ### OCEAN Token Address
<details> * **OCEAN\_address**(`self`) -> `str`
<summary><a href="https://github.com/oceanprotocol/ocean.py/blob/main/ocean_lib/ocean/ocean.py#LL100C1-L103C52"><code>ocean.OCEAN_address -> str</code></a></summary>
It is a helper method for retrieving the OCEAN's token address.\ It is a helper method for retrieving the OCEAN's token address.\
It can be called only by Ocean object and returns the address as a `string`. It can be called only by Ocean object and returns the address as a `string`.
**Returns**
`str`
OCEAN token address for that network.
**Defined in**
[ocean/ocean.py](https://github.com/oceanprotocol/ocean.py/blob/main/ocean\_lib/ocean/ocean.py#LL100C1-L103C52)
<details>
<summary>Source code</summary>
```python ```python
@property @property
@enforce_types @enforce_types
@ -157,13 +167,28 @@ def get_ocean_token_address(config_dict: dict) -> str:
</details> </details>
<details> ### OCEAN Token Object
<summary><a href="https://github.com/oceanprotocol/ocean.py/blob/main/ocean_lib/ocean/ocean.py#LL105C1-L113C32"><code>ocean.OCEAN_token</code> or <code>ocean.OCEAN -> Datatoken</code></a></summary> * **OCEAN\_token**(`self`) -> `DatatokenBase`
* **OCEAN**(`self`) -> `DatatokenBase` as alias for the above option
It is a helper method for retrieving the OCEAN token object (Datatoken class).\ It is a helper method for retrieving the OCEAN token object (Datatoken class).\
It can be called within Ocean class and returns the OCEAN Datatoken. It can be called within Ocean class and returns the OCEAN Datatoken.
**Returns**
`DatatokenBase`
OCEAN token as `DatatokenBase` object.
**Defined in**
[ocean/ocean.py](https://github.com/oceanprotocol/ocean.py/blob/main/ocean\_lib/ocean/ocean.py#LL105C1-L113C32)
<details>
<summary>Source code</summary>
```python ```python
@property @property
@enforce_types @enforce_types
@ -178,15 +203,27 @@ It can be called within Ocean class and returns the OCEAN Datatoken.
</details> </details>
Ocean smart contracts: ### Data NFT Factory
<details> * **data\_nft\_factory**(`self`) -> `DataNFTFactoryContract`
<summary><a href="https://github.com/oceanprotocol/ocean.py/blob/main/ocean_lib/ocean/ocean.py#LL117C1-L120C80"><code>ocean.data_nft_factory -> DataNFTFactoryContract</code></a></summary>
It is a property for getting `Data NFT Factory` object for the singleton smart contract.\ It is a property for getting `Data NFT Factory` object for the singleton smart contract.\
It can be called within Ocean class and returns the `DataNFTFactoryContract` instance. It can be called within Ocean class and returns the `DataNFTFactoryContract` instance.
**Returns**
`DataNFTFactoryContract`
Data NFT Factory contract object which access all the functionalities available from smart contracts in Python.
**Defined in**
[ocean/ocean.py](https://github.com/oceanprotocol/ocean.py/blob/main/ocean\_lib/ocean/ocean.py#LL117C1-L120C80)
<details>
<summary>Source code</summary>
{% code overflow="wrap" %} {% code overflow="wrap" %}
```python ```python
@property @property
@ -198,14 +235,28 @@ It can be called within Ocean class and returns the `DataNFTFactoryContract` ins
</details> </details>
<details> ### Dispenser
<summary><a href="https://github.com/oceanprotocol/ocean.py/blob/main/ocean_lib/ocean/ocean.py#LL122C1-L125C63"><code>ocean.dispenser -> Dispenser</code></a></summary> * **dispenser**(`self`) -> `Dispenser`
`Dispenser` is represented by a faucet for free data.\ `Dispenser` is represented by a faucet for free data.\
It is a property for getting `Dispenser` object for the singleton smart contract.\ It is a property for getting `Dispenser` object for the singleton smart contract.\
It can be called within Ocean class and returns the `Dispenser` instance. It can be called within Ocean class and returns the `Dispenser` instance.
**Returns**
`Dispenser`
Dispenser contract object which access all the functionalities available from smart contracts in Python.
**Defined in**
[ocean/ocean.py](https://github.com/oceanprotocol/ocean.py/blob/main/ocean\_lib/ocean/ocean.py#LL122C1-L125C63)
<details>
<summary>Source code</summary>
```python ```python
@property @property
@enforce_types @enforce_types
@ -215,14 +266,28 @@ It can be called within Ocean class and returns the `Dispenser` instance.
</details> </details>
<details> ### Fixed Rate Exchange
<summary><a href="https://github.com/oceanprotocol/ocean.py/blob/main/ocean_lib/ocean/ocean.py#LL127C1-L130C72"><code>ocean.fixed_rate_exchange -> FixedRateExchange</code></a></summary> * **fixed\_rate\_exchange**(`self`) -> `FixedRateExchange`
Exchange is used for priced data.\ Exchange is used for priced data.\
It is a property for getting `FixedRateExchange` object for the singleton smart contract.\ It is a property for getting `FixedRateExchange` object for the singleton smart contract.\
It can be called within Ocean class and returns the `FixedRateExchange` instance. It can be called within Ocean class and returns the `FixedRateExchange` instance.
**Returns**
`FixedRateExchange`
Fixed Rate Exchange contract object which access all the functionalities available from smart contracts in Python.
**Defined in**
[ocean/ocean.py](https://github.com/oceanprotocol/ocean.py/blob/main/ocean\_lib/ocean/ocean.py#LL127C1-L130C72)
<details>
<summary>Source code</summary>
```python ```python
@property @property
@enforce_types @enforce_types
@ -232,14 +297,30 @@ It can be called within Ocean class and returns the `FixedRateExchange` instance
</details> </details>
Simple getters: ### NFT Token Getter
* **get\_nft\_token**(`self`, `token_adress: str`) -> `DataNFT`
It is a getter for a specific data NFT object based on its checksumed address.\
It can be called within Ocean class which returns the `DataNFT` instance based on string `token_address` specified as parameter.
**Parameters**
* `token_address` - string checksumed address of the NFT token that you are searching for.
**Returns**
`DataNFT`
Data NFT object which access all the functionalities available for ERC721 template in Python.
**Defined in**
[ocean/ocean.py](https://github.com/oceanprotocol/ocean.py/blob/main/ocean\_lib/ocean/ocean.py#LL139C5-L145C51)
<details> <details>
<summary><a href="https://github.com/oceanprotocol/ocean.py/blob/main/ocean_lib/ocean/ocean.py#LL139C5-L145C51"><code>ocean.get_nft_token(self, token_address: str) -> DataNFT</code></a></summary> <summary>Source code</summary>
It is a getter for a specific data NFT object based on its checksumed address.\
It can be called within Ocean class with a string `token_address` as parameter which returns the `DataNFT` instance.
```python ```python
@enforce_types @enforce_types
@ -253,13 +334,31 @@ It can be called within Ocean class with a string `token_address` as parameter w
</details> </details>
<details> ### Datatoken Getter
<summary><a href="https://github.com/oceanprotocol/ocean.py/blob/main/ocean_lib/ocean/ocean.py#LL147C5-L153C67"><code>ocean.get_datatoken(self, token_address: str) -> DatatokenBase</code></a></summary> * **get\_datatoken**(`self`, `token_address: str`) -> `DatatokenBase`
It is a getter for a specific `datatoken` object based on its checksumed address.\ It is a getter for a specific `datatoken` object based on its checksumed address.\
It can be called within Ocean class with a string `token_address` as parameter which returns the `DatatokenBase` instance depending on datatoken's template index. It can be called within Ocean class with a string `token_address` as parameter which returns the `DatatokenBase` instance depending on datatoken's template index.
**Parameters**
* `token_address` - string checksumed address of the datatoken that you are searching for.
**Returns**
`DatatokenBase`
Datatoken object which access all the functionalities available for ERC20 templates in Python.
**Defined in**
[ocean/ocean.py](https://github.com/oceanprotocol/ocean.py/blob/main/ocean\_lib/ocean/ocean.py#LL147C5-L153C67)
<details>
<summary>Source code</summary>
```python ```python
@enforce_types @enforce_types
def get_datatoken(self, token_address: str) -> DatatokenBase: def get_datatoken(self, token_address: str) -> DatatokenBase:
@ -273,20 +372,33 @@ It can be called within Ocean class with a string `token_address` as parameter w
</details> </details>
<details> ### User Orders Getter
<summary><a href="https://github.com/oceanprotocol/ocean.py/blob/main/ocean_lib/ocean/ocean.py#LL157C5-L173C23"><code>ocean.get_user_orders(self, address: str, datatoken: str)</code></a></summary> * **get\_user\_orders**(`self`, `address: str`, `datatoken: str`) -> `List[AttributeDict]`
Returns the list of orders that were made by a certain user on a specific datatoken. Returns the list of orders that were made by a certain user on a specific datatoken.
As parameters:
1. `address` - ETH wallet address of that user
2. `datatoken` - datatoken address
\
It can be called within Ocean class. It can be called within Ocean class.
**Parameters**
* `address` - wallet address of that user
* `datatoken` - datatoken address
**Returns**
`List[AttributeDict]`
List of all the orders on that `datatoken` done by the specified `user`.
**Defined in**
[ocean/ocean.py](https://github.com/oceanprotocol/ocean.py/blob/main/ocean\_lib/ocean/ocean.py#LL157C5-L173C23)
<details>
<summary>Source code</summary>
{% code overflow="wrap" %} {% code overflow="wrap" %}
```python ```python
@enforce_types @enforce_types
@ -313,19 +425,31 @@ It can be called within Ocean class.
</details> </details>
Provider fees: ### Provider Fees
<details> * **retrieve\_provider\_fees**( `self`, `ddo: DDO`, `access_service: Service`, `publisher_wallet` ) -> `dict`
<summary><a href="https://github.com/oceanprotocol/ocean.py/blob/main/ocean_lib/ocean/ocean.py#LL177C4-L189C1"><code>ocean.retrieve_provider_fees( self, ddo: DDO, access_service: Service, publisher_wallet ) -> dict:</code></a></summary>
Calls Provider to compute provider fees as dictionary for access service. Calls Provider to compute provider fees as dictionary for access service.
As parameters: **Parameters**
1. `ddo` - the data asset which has the DDO object * `ddo` - the data asset which has the DDO object
2. `access_service` - Service instance for the service that needs the provider fees * `access_service` - Service instance for the service that needs the provider fees
3. `publisher_wallet` - Wallet instance of the user that wants to retrieve the provider fees * `publisher_wallet` - Wallet instance of the user that wants to retrieve the provider fees
**Returns**
`dict`
A dictionary which contains the following keys (`providerFeeAddress`, `providerFeeToken`, `providerFeeAmount`, `providerData`, `v`, `r`, `s`, `validUntil`).
**Defined in**
[ocean/ocean.py](https://github.com/oceanprotocol/ocean.py/blob/main/ocean\_lib/ocean/ocean.py#LL177C4-L189C1)
<details>
<summary>Source code</summary>
{% code overflow="wrap" %} {% code overflow="wrap" %}
```python ```python
@ -346,19 +470,33 @@ As parameters:
</details> </details>
<details> ### Compute Provider Fees
<summary><a href="https://github.com/oceanprotocol/ocean.py/blob/main/ocean_lib/ocean/ocean.py#LL190C4-L210C1"><code>ocean.retrieve_provider_fees_for_compute( self, datasets: List[ComputeInput], algorithm_data: Union[ComputeInput, AlgorithmMetadata], consumer_address: str, compute_environment: str, valid_until: int, ) -> dict:</code></a></summary> * **retrieve\_provider\_fees\_for\_compute**(`self`, `datasets: List[ComputeInput]`, `algorithm_data: Union[ComputeInput, AlgorithmMetadata]`, `consumer_address: str`, `compute_environment: str`, `valid_until: int`) -> `dict`
Calls Provider to generate provider fees as dictionary for compute service. Calls Provider to generate provider fees as dictionary for compute service.
As parameters: **Parameters**
1. `datasets` - list of `ComputeInput` which contains the data assets * `datasets` - list of `ComputeInput` which contains the data assets
2. `algorithm_data` - necessary data for algorithm and it can be either a `ComputeInput` object, either just the algorithm metadata, `AlgorithmMetadata` * `algorithm_data` - necessary data for algorithm and it can be either a `ComputeInput` object, either just the algorithm metadata, `AlgorithmMetadata`
3. `consumer_address` - address of the compute consumer wallet which is requesting the provider fees * `consumer_address` - address of the compute consumer wallet which is requesting the provider fees
4. `compute_environment` - id provided from the compute environment as `string` * `compute_environment` - id provided from the compute environment as `string`
5. `valid_until` - timestamp in UNIX miliseconds for the duration of provider fees for the compute service. * `valid_until` - timestamp in UNIX miliseconds for the duration of provider fees for the compute service.
**Returns**
`dict`
A dictionary which contains the following keys (`providerFeeAddress`, `providerFeeToken`, `providerFeeAmount`, `providerData`, `v`, `r`, `s`, `validUntil`).
**Defined in**
[ocean/ocean.py](https://github.com/oceanprotocol/ocean.py/blob/main/ocean\_lib/ocean/ocean.py#LL190C4-L210C1)
<details>
<summary>Source code</summary>
{% code overflow="wrap" %} {% code overflow="wrap" %}
```python ```python
@ -387,7 +525,7 @@ As parameters:
</details> </details>
### Ocean Assets #### Ocean Assets
<details> <details>
@ -1237,7 +1375,7 @@ Return value is a tuple composed of list of datasets and algorithm data (if exis
</details> </details>
### Ocean Compute #### Ocean Compute
<details> <details>
@ -1547,7 +1685,7 @@ A list of objects containing information about each compute environment. For eac
</details> </details>
### Datatoken Interface #### Datatoken Interface
Dispenser utils: Dispenser utils: