dethcrypto / dethcrypto/TypeChain

generate-types doesn't recognize deployer.then as a function

Open
#513 0 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
2.8k
Forks
376
PR merge metrics
No merged PRs in 30d

Description

This code is generated after the run of `typechain --target=truffle-v5 'build/contracts/*.json'` from examples. This code generates these types for the Deployer
```
interface Deployer {
link(
library: Truffle.Contract,
destination: Truffle.Contract
): Deployer;
link(
library: Truffle.Contract,
destinations: Array>
): Deployer;
deploy(c: ContractNew, ...args: T): Deployer;
}
```
unfortunately function `then(param: () => Promise): void;` is't part of that. Therefore migration script that waits until deployer is ready and only after that doing logic would yield an error during compilation time.
Example of such script:
```
module.exports = function (deployer, network, accounts) {
const [alice, bob] = accounts;

deployer.then(async () => {
await deployer.deploy(Contract, {from: bob});
const contractInstance = await Contract.deployed();
await contractInstance.transferOwnership(alice, {from: bob});

});
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.