mirror of
https://github.com/oceanprotocol/docs.git
synced 2024-11-26 19:49:26 +01:00
GITBOOK-522: Updated the code example of the templates page
This commit is contained in:
parent
a16636993f
commit
39e2e5987b
@ -29,50 +29,50 @@ The enterprise template has additional functions apart from methods in the ERC20
|
|||||||
|
|
||||||
#### Set the template
|
#### Set the template
|
||||||
|
|
||||||
When you're in the process of creating an NFT, it's essential to indicate the specific template it should utilize. 
|
When you're creating an ERC20 datatoken, you can specify the desired template by passing on the template index. 
|
||||||
|
|
||||||
{% tabs %}
|
{% tabs %}
|
||||||
{% tab title="Ocean.js" %}
|
{% tab title="Ocean.js" %}
|
||||||
To personalize the template via ocean.js, you can achieve it by customizing the [NFTCreateData](https://github.com/oceanprotocol/ocean.js/blob/ae2ff1ccde53ace9841844c316a855de271f9a3f/src/%40types/NFTFactory.ts#L16) with your desired `templateIndex`. 
|
To specify the datatoken template via ocean.js, you need to customize the [DatatokenCreateParams](https://github.com/oceanprotocol/ocean.js/blob/ae2ff1ccde53ace9841844c316a855de271f9a3f/src/%40types/Datatoken.ts#L3) with your desired `templateIndex`. 
|
||||||
|
|
||||||
The default template used is 1.
|
The default template used is 1.
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
export interface NftCreateData {
|
export interface DatatokenCreateParams {
|
||||||
name: string
|
|
||||||
symbol: string
|
|
||||||
templateIndex: number
|
templateIndex: number
|
||||||
tokenURI: string
|
minter: string
|
||||||
transferable: boolean
|
paymentCollector: string
|
||||||
owner: string
|
mpFeeAddress: string
|
||||||
|
feeToken: string
|
||||||
|
feeAmount: string
|
||||||
|
cap: string
|
||||||
|
name?: string
|
||||||
|
symbol?: string
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
{% endtab %}
|
{% endtab %}
|
||||||
|
|
||||||
{% tab title="Ocean.py" %}
|
{% tab title="Ocean.py" %}
|
||||||
To personalize the template via ocean.py, you can achieve it by customizing the [DataNFTArguments](https://github.com/oceanprotocol/ocean.py/blob/bad11fb3a4cb00be8bab8febf3173682e1c091fd/ocean\_lib/models/data\_nft.py#L317) with your desired `template_index`.
|
To specify the datatoken template via ocean.py, you need to customize the [DatatokenArguments](https://github.com/oceanprotocol/ocean.py/blob/bad11fb3a4cb00be8bab8febf3173682e1c091fd/ocean\_lib/models/datatoken\_base.py#L64) with your desired template\_index. 
|
||||||
|
|
||||||
The default template used is 1.
|
The default template used is 1.
|
||||||
|
|
||||||
```python
|
```python
|
||||||
name: str name of data NFT if creating a new one
|
class DatatokenArguments:
|
||||||
symbol: str symbol of data NFT if creating a new one
|
def __init__(
|
||||||
template_index: int template index of the data NFT, by default is 1.
|
|
||||||
additional_datatoken_deployer: str address of an additional ERC20 deployer.
|
|
||||||
additional_metadata_updater: str address of an additional metadata updater.
|
|
||||||
uri: str URL of the data NFT.
|
|
||||||
"""
|
|
||||||
def __init__(
|
|
||||||
self,
|
self,
|
||||||
name: str,
|
name: Optional[str] = "Datatoken 1",
|
||||||
symbol: str,
|
symbol: Optional[str] = "DT1",
|
||||||
template_index: Optional[int] = 1,
|
template_index: Optional[int] = 1,
|
||||||
additional_datatoken_deployer: Optional[str] = None,
|
minter: Optional[str] = None,
|
||||||
additional_metadata_updater: Optional[str] = None,
|
fee_manager: Optional[str] = None,
|
||||||
uri: Optional[str] = None,
|
publish_market_order_fees: Optional = None,
|
||||||
transferable: Optional[bool] = None,
|
bytess: Optional[List[bytes]] = None,
|
||||||
owner: Optional[str] = None,
|
services: Optional[list] = None,
|
||||||
)...
|
files: Optional[List[FilesType]] = None,
|
||||||
|
consumer_parameters: Optional[List[Dict[str, Any]]] = None,
|
||||||
|
cap: Optional[int] = None,
|
||||||
|
):
|
||||||
```
|
```
|
||||||
{% endtab %}
|
{% endtab %}
|
||||||
{% endtabs %}
|
{% endtabs %}
|
||||||
|
Loading…
Reference in New Issue
Block a user