Request for new hook useContractBlueprint to support dynamic contract instantiation
0xLucca opened this issue · 2 comments
0xLucca commented
Feature Request
Suggestion
Add a new hook useContractBlueprint(codeHash: string, metadata: Record<string, unknown>, chainId?: ChainId) that allows creating new instances of a contract instead of just interacting with a unique deployment.
Motivation
Currently, when working with useInk, there is support for interacting with a specific deployment of a contract using the useContract hook. However, there is no built-in mechanism to create new instances of the contract based on a blueprint or template. This limitation makes it cumbersome for users who want to instantiate multiple instances of the same contract with different parameters.
Use Cases
- Dynamic Contract Instantiation: Users could define a blueprint or template of a contract by providing the codeHash and metadata. They can then utilize the useContractBlueprint hook to create new instances of the contract with varying parameters.
The proposed feature would enhance the flexibility and ease of use of useInk, reducing the need for manual contract instantiation and enabling users to leverage the full potential of the library.
DoubleOTheven commented
0xLucca commented
Hi @DoubleOTheven! Awesome, i will start trying it. Thanks!