> ## Documentation Index
> Fetch the complete documentation index at: https://docs.datafdn.org/llms.txt
> Use this file to discover all available pages before exploring further.

# IP Asset

> IPAsset을 사용하면 DATA Foundation 내의 IP 자산을 생성, 조회, 나열할 수 있습니다.

## IPAsset

### Methods

* register
* register\_derivative
* register\_derivative\_with\_license\_tokens
* mint\_and\_register\_ip\_asset\_with\_pil\_terms

### IPAssetClient 둘러보기

[📜 Licensing Module](/concepts/licensing-module)과 상호작용하는 함수가 많기 때문에, 찾고 있는 것을 식별하고 관련 문서를 찾을 수 있도록 유용한 차트로 분류했습니다.

| **Function**                                                                             | **Mint an NFT** | **Register IPA** | **Create License Terms** | **Attach License Terms** | **Mint License Token** | **Register as Derivative** |
| ---------------------------------------------------------------------------------------- | :-------------: | :--------------: | :----------------------: | :----------------------: | :--------------------: | :------------------------: |
| <span style={{color: "#e03130"}}>register</span>                                         |                 |         ✓        |                          |                          |                        |                            |
| <span style={{color: "#e03130"}}>mint\_and\_register\_ip\_asset\_with\_pil\_terms</span> |        ✓        |         ✓        |             ✓            |             ✓            |                        |                            |
| <span style={{color: "#e03130"}}>register\_derivative</span>                             |                 |                  |                          |                          |                        |              ✓             |
| <span style={{color: "#e03130"}}>register\_derivative\_with\_license\_tokens</span>      |                 |                  |                          |                          |                        |              ✓             |
| <span style={{color: "#1971c2"}}>register\_pil\_terms</span>                             |                 |                  |             ✓            |                          |                        |                            |
| <span style={{color: "#1971c2"}}>attach\_license\_terms</span>                           |                 |                  |                          |             ✓            |                        |                            |
| <span style={{color: "#1971c2"}}>mint\_license\_tokens</span>                            |                 |                  |                          |                          |            ✓           |                            |

* <span style={{ color: "#e03130" }}>빨강</span>: IPAssetClient (이 페이지)
* <span style={{ color: "#1971c2" }}>파랑</span>:
  [LicenseClient](/sdk-reference/python/license)

## register

NFT를 IP로 등록하여 해당 [🧩 IP Asset](/concepts/ip-asset)을 생성합니다. 주어진 NFT가 이미 등록되어 있다면, 이 함수는 기존의 `ipId`를 반환합니다.

<Note title="NFT 메타데이터">
  이 함수는 기본 NFT의 `tokenUri`도 `ipMetadata.nftMetadataURI`에
  전달된 값으로 설정한다는 점에 유의하세요.
</Note>

| Method     |
| ---------- |
| `register` |

Parameters:

* `nft_contract`: NFT의 주소입니다.
* `token_id`: NFT의 토큰 식별자입니다.
* `ip_metadata`: \[Optional] 새로 발행된 NFT와 새로 등록된 IP에 대한 원하는 메타데이터입니다.
  * `ip_metadata['ip_metadata_uri']`: \[Optional] IP 메타데이터의 URI입니다.
  * `ip_metadata['ip_metadata_hash']`: \[Optional] IP 메타데이터의 해시입니다.
  * `ip_metadata['nft_metadata_uri']`: \[Optional] NFT 메타데이터의 URI입니다.
  * `ip_metadata['nft_metadata_hash']`: \[Optional] IP NFT 메타데이터의 해시입니다.
* `deadline`: \[Optional] 서명의 만료 시간(밀리초)입니다.
* `tx_options`: \[Optional] 트랜잭션 옵션 딕셔너리입니다.

<CodeGroup>
  ```python Python theme={null}
  metadata = {
    'ip_metadata_uri': "test-uri",
    'ip_metadata_hash': web3.to_hex(web3.keccak(text="test-ip-metadata-hash")),
    'nft_metadata_uri': "test-uri",
    'nft_metadata_hash': web3.to_hex(web3.keccak(text="test-nft-metadata-hash"))
  }

  response = story_client.IPAsset.register(
    nft_contract="0x041B4F29183317Fd352AE57e331154b73F8a1D73",
    token_id="12",
    ip_metadata=metadata
  )
  ```

  ```python Request Parameters theme={null}
  nft_contract: str  # The address of the NFT
  token_id: str  # The token identifier of the NFT
  ip_metadata: dict = None  # Optional: Metadata for the NFT and IP
  deadline: int = None  # Optional: The deadline for the signature in milliseconds
  tx_options: dict = None  # Optional: Transaction options
  ```

  ```python Response theme={null}
  {
    "ip_id": str,  # The IP ID of the registered IP
    "tx_hash": str  # The transaction hash
  }
  ```
</CodeGroup>

## register\_derivative

라이선스 토큰 없이 부모 IP의 라이선스 조건으로 파생물을 직접 등록하고, 부모 IP의 라이선스 조건을 파생 IP에 첨부합니다.

이 함수를 호출하기 전에 라이선스 조건이 부모 IP에 첨부되어 있어야 합니다.

모든 IP는 기본적으로 기본 라이선스 조건이 첨부되어 있습니다.

파생 IP 소유자는 호출자이거나 권한이 부여된 운영자여야 합니다.

| Method                |
| --------------------- |
| `register_derivative` |

Parameters:

* `child_ip_id`: 파생 IP ID입니다.
* `parent_ip_ids`: 부모 IP ID들입니다.
* `license_terms_ids`: 부모 IP가 지원하는 라이선스 조건의 ID들입니다.
* `max_minting_fee`: \[Optional] 호출자가 지불할 의향이 있는 최대 발행 수수료입니다. 0으로 설정하면 제한이 없습니다. **기본값: 0**
* `max_revenue_share`: \[Optional] 자식이 파생물로 등록될 때 자식과 부모 사이에 합의된 최대 수익 공유 비율입니다. 0에서 100 사이여야 합니다. **기본값: 100**
* `max_rts`: \[Optional] 외부 로열티 정책에 분배될 수 있는 로열티 토큰의 최대 수입니다. 0에서 100,000,000 사이여야 합니다. **기본값: 100\_000\_000**
* `tx_options`: \[Optional] 트랜잭션 옵션 딕셔너리입니다.

<CodeGroup>
  ```python Python theme={null}
  response = story_client.IPAsset.register_derivative(
    child_ip_id="0xC92EC2f4c86458AFee7DD9EB5d8c57920BfCD0Ba",
    parent_ip_ids=["0xC92EC2f4c86458AFee7DD9EB5d8c57920BfCD0Ba"],
    license_terms_ids=["5"],
    max_minting_fee=0, # disabled
    max_rts=100_000_000, # default
    max_revenue_share=100 # default
  )
  ```

  ```python Request Parameters theme={null}
  child_ip_id: str  # The derivative IP ID
  parent_ip_ids: list  # The parent IP IDs
  license_terms_ids: list  # The IDs of the license terms that the parent IP supports
  max_minting_fee: int = 0  # Optional: The maximum minting fee the caller is willing to pay
  max_rts: int = 0  # Optional: The maximum number of royalty tokens
  max_revenue_share: int = 0  # Optional: The maximum revenue share percentage
  license_template: str = None  # Optional: The address of the license template
  tx_options: dict = None  # Optional: Transaction options
  ```

  ```python Response theme={null}
  {
    "tx_hash": str  # The transaction hash
  }
  ```
</CodeGroup>

## register\_derivative\_with\_license\_tokens

라이선스 토큰으로 파생물을 등록합니다.

파생 IP는 부모 IP의 라이선스 조건으로부터 발행된 라이선스 토큰을 사용해 등록됩니다.

라이선스 토큰과 함께 발행된 부모 IP의 라이선스 조건이 파생 IP에 첨부됩니다.

호출자는 파생 IP 소유자 또는 권한이 부여된 운영자여야 합니다.

| Method                                    |
| ----------------------------------------- |
| `register_derivative_with_license_tokens` |

Parameters:

* `child_ip_id`: 파생 IP ID입니다.
* `license_token_ids`: 라이선스 토큰의 ID들입니다.
* `max_rts`: 외부 로열티 정책에 분배될 수 있는 로열티 토큰의 최대 수입니다. 0에서 100,000,000 사이여야 합니다. **간단하게 권장: 100\_000\_000**
* `tx_options`: \[Optional] 트랜잭션 옵션 딕셔너리입니다.

<CodeGroup>
  ```python Python theme={null}
  response = story_client.IPAsset.register_derivative_with_license_tokens(
    child_ip_id="0xC92EC2f4c86458AFee7DD9EB5d8c57920BfCD0Ba",
    license_token_ids=["5"],
    max_rts=100_000_000 # default
  )
  ```

  ```python Request Parameters theme={null}
  child_ip_id: str  # The derivative IP ID
  license_token_ids: list  # The IDs of the license tokens
  max_rts: int = 0  # Optional: The maximum number of royalty tokens
  tx_options: dict = None  # Optional: Transaction options
  ```

  ```python Response theme={null}
  {
    "tx_hash": str  # The transaction hash
  }
  ```
</CodeGroup>

## mint\_and\_register\_ip\_asset\_with\_pil\_terms

컬렉션에서 NFT를 발행하고, IP로 등록하고, IP에 메타데이터를 첨부하고, IP에 라이선스 조건을 첨부하는 작업을 한 함수에서 모두 수행합니다.

<Note>
  이 함수는 기본 NFT의 `tokenUri`도 `ipMetadata.nftMetadataURI`에
  전달된 값으로 설정한다는 점에 유의하세요.
</Note>

| Method                                      |
| ------------------------------------------- |
| `mint_and_register_ip_asset_with_pil_terms` |

Parameters:

* `spg_nft_contract`: NFT 컬렉션의 주소입니다.
* `terms`: 첨부할 라이선스 조건의 배열입니다. ⚠️ **빈 배열을 전달하면 이 함수는 실패합니다.**
  * `terms[].terms`: 라이선스 조건 데이터입니다. 구조는 아래 Python 예제를 참고하세요.
  * `terms[].licensing_config`: \[Optional] 라이선싱 설정입니다. 구조는 아래 Python 예제를 참고하세요.
* `allow_duplicates`: \[Optional] 동일한 NFT 메타데이터로 IP 발행을 허용하려면 true로 설정합니다. **기본값: True**
* `ip_metadata`: \[Optional] 새로 발행된 NFT와 새로 등록된 IP에 대한 원하는 메타데이터입니다.
  * `ip_metadata['ip_metadata_uri']`: \[Optional] IP 메타데이터의 URI입니다.
  * `ip_metadata['ip_metadata_hash']`: \[Optional] IP 메타데이터의 해시입니다.
  * `ip_metadata['nft_metadata_uri']`: \[Optional] NFT 메타데이터의 URI입니다.
  * `ip_metadata['nft_metadata_hash']`: \[Optional] IP NFT 메타데이터의 해시입니다.
* `recipient`: \[Optional] 발행된 NFT의 수신자 주소입니다.
* `tx_options`: \[Optional] 트랜잭션 옵션 딕셔너리입니다.

<CodeGroup>
  ```python Python theme={null}
  commercial_remix_terms = {
    "transferable": True,
    "royalty_policy": "0xBe54FB168b3c982b7AaE60dB6CF75Bd8447b390E", # RoyaltyPolicyLAP address from https://docs.datafdn.org/docs/deployed-smart-contracts
    "default_minting_fee": 0,
    "expiration": 0,
    "commercial_use": True,
    "commercial_attribution": True,
    "commercializer_checker": "0x0000000000000000000000000000000000000000",
    "commercializer_checker_data": "0x0000000000000000000000000000000000000000",
    "commercial_rev_share": 50,
    "commercial_rev_ceiling": 0,
    "derivatives_allowed": True,
    "derivatives_attribution": True,
    "derivatives_approval": False,
    "derivatives_reciprocal": True,
    "derivative_rev_ceiling": 0,
    "currency": "0x1514000000000000000000000000000000000000", # $WIP address from https://docs.datafdn.org/docs/deployed-smart-contracts
    "uri": "",
  }

  licensing_config = {
    "is_set": False,
    "minting_fee": 0,
    "licensing_hook": "0x0000000000000000000000000000000000000000",
    "hook_data": "0x0000000000000000000000000000000000000000",
    "commercial_rev_share": 0,
    "disabled": False,
    "expect_minimum_group_reward_share": 0,
    "expect_group_reward_pool": "0x0000000000000000000000000000000000000000",
  }

  metadata = {
    'ip_metadata_uri': "test-uri",
    'ip_metadata_hash': web3.to_hex(web3.keccak(text="test-ip-metadata-hash")),
    'nft_metadata_uri': "test-uri",
    'nft_metadata_hash': web3.to_hex(web3.keccak(text="test-nft-metadata-hash"))
  }

  response = story_client.IPAsset.mint_and_register_ip_asset_with_pil_terms(
    spg_nft_contract="0xfE265a91dBe911db06999019228a678b86C04959",
    terms=[{
      "terms": commercial_remix_terms,
      "licensing_config": licensing_config
    }],
    allow_duplicates=True,
    ip_metadata=metadata
  )
  ```

  ```python Request Parameters theme={null}
  spg_nft_contract: str  # The address of the NFT collection
  terms: list  # The array of license terms to be attached
  ip_metadata: dict = None  # Optional: Metadata for the NFT and IP
  recipient: str = None  # Optional: The address of the recipient of the minted NFT
  allow_duplicates: bool = False  # Optional: Allow minting IPs with the same NFT metadata
  tx_options: dict = None  # Optional: Transaction options
  ```

  ```python Response theme={null}
  {
    "ip_id": str,  # The IP ID of the registered IP
    "token_id": int,  # The token ID of the minted NFT
    "tx_hash": str,  # The transaction hash
    "license_terms_ids": list  # The IDs of the registered license terms
  }
  ```
</CodeGroup>
