-
Notifications
You must be signed in to change notification settings - Fork 31
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
Improve the return type of deployToDevnet #323
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to update this template as well: https://github.com/alephium/alephium-web3/blob/master/packages/cli/templates/base/test/token.test.ts#L110-L145
packages/cli/src/codegen.ts
Outdated
import { ContractInstance, groupOfAddress } from '@alephium/web3' | ||
import { DeployContractExecutionResult } from '@alephium/cli' | ||
|
||
export function loadContractInstanceFromDeployments<T extends ContractInstance>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because there are dependencies in @alephium/cli
that only work in nodejs env, placing this function within @alephium/cli
would lead to frontend issues. So I've moved this function to a separately generated file.
In this PR, I changed the return type of
deployToDevnet
to:But it is a bit different from
loadDeployments
. ForloadDeployments
, we generate the return type through the deployed contracts. FordeployToDevnet
, we don't know the return type until the user callsdeployToDevnet
, so the user needs to do some type conversion manually, here is an example: alephium/nextjs-pages-dapp-template@737cf8f#diff-c44cb9b2c107e64a3654d247df87d052da7c9c4ee019f47ee0f1678fc7d933a7R27-R30