Skip to content

Commit

Permalink
Fixed issue where deployWithName would try to deploy to an account wh…
Browse files Browse the repository at this point in the history
…ich wasn't yet set up on the blockchain.
  • Loading branch information
thekevinbrown committed May 6, 2019
1 parent 683a156 commit 349df87
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/contracts/contractDeployer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ export class ContractDeployer {
*
* ```typescript
* // Deploy the `mycontract` contract to the account with name `mycontractname`
* ContractDeployer.deployToAccount<MyContractTypeDef>('mycontract', 'mycontractname');
* ContractDeployer.deployWithName<MyContractTypeDef>('mycontract', 'mycontractname');
* ```
*
* @note Generating a random private key is not safe
* @note Generating a random private key is not safe in the cryptographic sense. It can be used for testing.
* @author Mitch Pierias <github.com/MitchPierias>
* @param contractIdentifier Contract identifier, typically the contract filename minus the extension
* @param accountName Account name
Expand All @@ -126,8 +126,11 @@ export class ContractDeployer {
) {
// Generate a random private key
const privateKey = await ecc.unsafeRandomKey();

// Initialize account with name
const account = new Account(accountName, privateKey);
await AccountManager.setupAccount(account);

// Call the deployToAccount method with the account
return await ContractDeployer.deployToAccount<T>(contractIdentifier, account);
}
Expand Down

0 comments on commit 349df87

Please sign in to comment.