-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use makeContractStore? #28
Comments
Edit: I misunderstood the question. I don't think you're able to call the store from other contracts as far as I'm aware? The store returns a web3 contract https://web3js.readthedocs.io/en/v1.2.11/web3-eth-contract.html Try including the following block: onMount(async () => {
const contract = makeContractStore(.....);
const symbol = await $contract.methods.symbol().call();
console.log(symbol);
}) |
@pythonicode is correct, if you create a contract store locally, you can only use it inside that file.
|
Thank you. Yes the goal was to re-use the contract object elsewhere. I did try to create a store with only the contract within but ran into some issues, specifically setting the store. Thank you for clarifying the intent behind this function |
In the meantime this part is improving, here is a small example how to create your own contract store form a separate file that can be imported everywhere:
And in svelte file:
|
Hello, after I create a store using makeContractStore(ABI, address) I'm unable to call this Contract object from another component in my app. Could you provide an example of how to call and use a contract method from this store? Thank you.
The text was updated successfully, but these errors were encountered: