feat(IPAsset): add batch_register functionality#198
Open
chao-peng-story wants to merge 3 commits intomainfrom
Open
feat(IPAsset): add batch_register functionality#198chao-peng-story wants to merge 3 commits intomainfrom
chao-peng-story wants to merge 3 commits intomainfrom
Conversation
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement batch registration of NFTs as IPs, supporting both with and without metadata.
Changes:
Technical details: