Skip to content

feat(IPAsset): add batch_register functionality#198

Open
chao-peng-story wants to merge 3 commits intomainfrom
feature/batch-register-ip
Open

feat(IPAsset): add batch_register functionality#198
chao-peng-story wants to merge 3 commits intomainfrom
feature/batch-register-ip

Conversation

@chao-peng-story
Copy link
Collaborator

Implement batch registration of NFTs as IPs, supporting both with and without metadata.

Changes:

  • Add aggregate3 method to Multicall3Client
  • Modify IPAsset.register() to support encodedTxDataOnly parameter
  • Implement IPAsset.batch_register() method with:
    • Support for batch registration with/without metadata
    • Automatic grouping: metadata uses RegistrationWorkflows.multicall, non-metadata uses Multicall3.aggregate3
    • Event parsing to extract ipId, tokenId, and nftContract from IPRegistered events
  • Add comprehensive unit tests (5 tests)
  • Add integration tests (3 tests) with on-chain verification

Technical details:

  • Metadata registrations require permission signatures and must use RegistrationWorkflows.multicall
  • Non-metadata registrations can use Multicall3.aggregate3 for cross-contract batching
  • Returns: {tx_hash, spg_tx_hash, results: [{ip_id, token_id, nft_contract}]}

Implement batch registration of NFTs as IPs, supporting both with and without metadata.

Changes:
- Add aggregate3 method to Multicall3Client
- Modify IPAsset.register() to support encodedTxDataOnly parameter
- Implement IPAsset.batch_register() method with:
  - Support for batch registration with/without metadata
  - Automatic grouping: metadata uses RegistrationWorkflows.multicall, non-metadata uses Multicall3.aggregate3
  - Event parsing to extract ipId, tokenId, and nftContract from IPRegistered events
- Add comprehensive unit tests (5 tests)
- Add integration tests (3 tests) with on-chain verification

Technical details:
- Metadata registrations require permission signatures and must use RegistrationWorkflows.multicall
- Non-metadata registrations can use Multicall3.aggregate3 for cross-contract batching
- Returns: {tx_hash, spg_tx_hash, results: [{ip_id, token_id, nft_contract}]}
- Fix Mock object subscriptable error by properly mocking web3.eth.get_transaction_receipt
- Mock transaction receipt with proper logs structure
- Mock IPRegistered event process_log to return correct event args
- Adjust assertions to check for presence of fields rather than exact mock values
- All 5 unit tests now pass
Implement batch registration of NFTs as IPs, supporting both with and without metadata.

Changes:
- Add aggregate3 method to Multicall3Client
- Modify IPAsset.register() to support encodedTxDataOnly parameter
- Implement IPAsset.batch_register() method with:
  - Support for batch registration with/without metadata
  - Automatic grouping: metadata uses RegistrationWorkflows.multicall, non-metadata uses Multicall3.aggregate3
  - Event parsing to extract ipId, tokenId, and nftContract from IPRegistered events
  - Added documentation explaining use of deprecated register() method for internal implementation
- Add comprehensive unit tests (5 tests) with proper mocking
- Add integration tests (3 tests) with on-chain verification

Technical details:
- Metadata registrations require permission signatures and must use RegistrationWorkflows.multicall
- Non-metadata registrations can use Multicall3.aggregate3 for cross-contract batching
- Returns: {tx_hash, spg_tx_hash, results: [{ip_id, token_id, nft_contract}]}
- Uses low-level register() internally (appropriate for batch encoding despite deprecation)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant