Skip to content
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

Merged
merged 9 commits into from
Feb 29, 2024
Merged

Conversation

Lbqds
Copy link
Member

@Lbqds Lbqds commented Feb 28, 2024

In this PR, I changed the return type of deployToDevnet to:

{
  deployerAddress: string,
  contracts: Record<string, DeployContractExecutionResult>,
  scripts:Record<string, RunScriptResult>
}[]

But it is a bit different from loadDeployments. For loadDeployments, we generate the return type through the deployed contracts. For deployToDevnet, we don't know the return type until the user calls deployToDevnet, so the user needs to do some type conversion manually, here is an example: alephium/nextjs-pages-dapp-template@737cf8f#diff-c44cb9b2c107e64a3654d247df87d052da7c9c4ee019f47ee0f1678fc7d933a7R27-R30

Copy link
Member

@polarker polarker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import { ContractInstance, groupOfAddress } from '@alephium/web3'
import { DeployContractExecutionResult } from '@alephium/cli'

export function loadContractInstanceFromDeployments<T extends ContractInstance>(
Copy link
Member Author

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.

@polarker polarker merged commit 2bf4ce4 into master Feb 29, 2024
8 checks passed
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