Skip to content

Conversation

@bonnie57
Copy link
Collaborator

Description

This PR introduces a new high-level batch registration method batch_ip_asset_with_optimized_workflows() that intelligently selects the appropriate workflow based on input parameters and provides automatic transaction batching for better gas efficiency.

Key Features

1. Intelligent Workflow Selection

The method automatically routes requests to the most appropriate workflow contract based on the combination of parameters provided:
For MintAndRegisterRequest (mint new NFT + register as IP):
license_terms_data + royalty_sharesmintAndRegisterIpAndAttachPILTermsAndDistributeRoyaltyTokens
license_terms_data only → mintAndRegisterIpAndAttachPILTerms
deriv_data + royalty_sharesmintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens
deriv_data only → mintAndRegisterIpAndMakeDerivative

For RegisterRegistrationRequest (register existing NFT as IP):
license_terms_data + royalty_sharesregisterIpAndAttachPILTermsAndDeployRoyaltyVault
deriv_data + royalty_sharesregisterIpAndMakeDerivativeAndDeployRoyaltyVault
license_terms_data only → registerIpAndAttachPILTerms
deriv_data only → registerIpAndMakeDerivative

2. Smart Multicall Strategy

  • Multicall3: Used when is_use_multicall=True for eligible MintAndRegisterRequest operations (when spg_nft_contract has public minting enabled except mintAndRegisterIpAndAttachPILTermsAndDistributeRoyaltyTokens)
  • Workflow's native multicall: Used for all RegisterRegistrationRequest operations (due to signature requirements) and MintAndRegisterRequest with royalty shares (due to msg.sender limitations)
  • Requests targeting the same workflow contract are automatically aggregated into a single transaction

3. Automatic Royalty Distribution

When royalty_shares are provided, the method automatically handles the two-step process:

  • Register IP and deploy royalty vault
  • Distribute royalty tokens (separate transaction, as it requires the vault address from step 1)

Code Example

# Mix different request types in a single batch
response = client.ip_asset.batch_ip_asset_with_optimized_workflows(
    requests=[
        # Mint new NFT and register with license terms
        MintAndRegisterRequest(
            spg_nft_contract="0x...",
            license_terms_data=[...],
            ip_metadata={...}
        ),
        # Register existing NFT as derivative
        RegisterRegistrationRequest(
            nft_contract="0x...",
            token_id=123,
            deriv_data={...},
            ip_metadata={...}
        ),
        # Mint and register with royalty shares
        MintAndRegisterRequest(
            spg_nft_contract="0x...",
            license_terms_data=[...],
            royalty_shares=[...],
        ),
    ],
    is_use_multicall=True
)

…okenDistributionWorkflows clients, and update SPGNFTImpl client with publicMinting method
…Asset with batch registration methods for optimized workflows
…icense_terms_data utility for improved validation in IPAsset
…ding public minting checks and license terms validation
…and updating TransformedRegistrationRequest structure
…coverage for registration request transformations
…cates and enhance registration request handling with new helper functions
…nsform_request utility and enhancing ExtraData structure
…ansform_request and improving error handling for license terms data
…ating transform_request for improved request handling
…e transformed_request for improved request handling
…ficient IP asset registration and royalty distribution
…t handling and remove contract_call references
…replacing loops with comprehensions and updating comments for clarity
…hOptimizedWorkflows for consistency and accuracy
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.

2 participants