You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.
Create a state management system to allow a user to easily instantiate a ContractPromise with an ABI and address (like with the existing useContract() hook) and save that in state to be accessed in other views. Currently users must create a custom Context for each contract like this. It would be nice if useink would do this for them.
Suggestion
Add a ContractRegistryContext that has a Record<T, contract>.
Change the existing hook useContract(abi, address) to useNewContract(abi, address)
Create a setter function in ContractRegistryContext to allow a user to store the contract in state via a name of type T
Add a hook to access contracts useContract(name: T) that returns the contract or undefined
Motivation
Users must create their own Provider to share contract client instances across files. This is time consuming and extra code we can avoid...
Use Cases
Setting up multiple contractPromise instances and using them on multiple pages by sharing them via state in the Provider
The text was updated successfully, but these errors were encountered:
DoubleOTheven
changed the title
Add ContractRegistry Context that maintains state for all contract client instances
Add ContractProvider to maintain a single instance of each ContractPromise
Apr 12, 2023
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Feature Request
Create a state management system to allow a user to easily instantiate a ContractPromise with an ABI and address (like with the existing
useContract()
hook) and save that in state to be accessed in other views. Currently users must create a custom Context for each contract like this. It would be nice if useink would do this for them.Suggestion
ContractRegistryContext
that has aRecord<T, contract>
.useContract(abi, address)
touseNewContract(abi, address)
T
useContract(name: T)
that returns the contract or undefinedMotivation
Users must create their own Provider to share contract client instances across files. This is time consuming and extra code we can avoid...
Use Cases
Setting up multiple contractPromise instances and using them on multiple pages by sharing them via state in the Provider
The text was updated successfully, but these errors were encountered: