Skip to content

Commit

Permalink
Merge pull request #119 from tonlabs/1.2.2-rc
Browse files Browse the repository at this point in the history
Bugfix of address calculation when entering initial data in dialog mode
  • Loading branch information
d3p authored Jul 19, 2022
2 parents 60ad78f + 265b2ac commit 6a412ae
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 19 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file.

## [1.2.2] - 2022-07-12

### Fixed

- Fixed the address calculation error that occurred when running "everdev contract deploy" and entering initial data in dialog mode.


## [1.2.1] - 2022-06-30

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "everdev",
"version": "1.2.1",
"version": "1.2.2",
"description": "Everscale Dev Environment",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
39 changes: 21 additions & 18 deletions src/controllers/contract/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,27 @@ export const contractDeployCommand: Command = {
) {
let account = await getAccount(terminal, args)
const info = await account.getAccount()
const accountAddress = await account.getAddress()
let accountAddress = await account.getAddress()

const dataParams = account.contract.abi.data ?? []
if (dataParams.length > 0) {
const initData = await resolveParams(
terminal,
`\nDeploying initial data:\n`,
dataParams,
args.data ?? "",
args.preventUi,
)
await account.free()
account = new Account(account.contract, {
client: account.client,
signer: account.signer,
initData,
})

accountAddress = await account.getAddress()
}

if (info.acc_type === AccountType.active) {
throw new Error(`Account ${accountAddress} already deployed.`)
}
Expand All @@ -220,23 +240,6 @@ export const contractDeployCommand: Command = {
)
}
}
const dataParams = account.contract.abi.data ?? []
if (dataParams.length > 0) {
const initData = await resolveParams(
terminal,
`\nDeploying initial data:\n`,
dataParams,
args.data ?? "",
args.preventUi,
)
await account.free()
account = new Account(account.contract, {
client: account.client,
address: await accountAddress,
signer: account.signer,
initData,
})
}

const initFunctionName =
args.function.toLowerCase() === "none"
Expand Down
3 changes: 3 additions & 0 deletions src/controllers/contract/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ function inputLine(terminal: Terminal, prompt: string): Promise<string> {
return new Promise(resolve => {
const standard_input = process.stdin
standard_input.setEncoding("utf-8")
// SO: https://stackoverflow.com/questions/54182732/process-never-ends-when-using-process-stdin-once
standard_input.resume()
standard_input.once("data", function (data) {
standard_input.pause()
resolve(`${data}`.trim())
})
})
Expand Down

0 comments on commit 6a412ae

Please sign in to comment.