Skip to content

Commit

Permalink
extracted out predicted address printing
Browse files Browse the repository at this point in the history
  • Loading branch information
eguajardo committed Jul 23, 2024
1 parent 2d9c783 commit 6e85841
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions cosmwasm/submit-proposal.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ const predictAndUpdateAddress = (client, contractConfig, chainConfig, options, c
return instantiate2AddressForProposal(client, contractConfig, options).then((contractAddress) => {
updateContractConfig(contractConfig, chainConfig, 'address', contractAddress);

printInfo(`Predicted address for ${chainName === 'none' ? '' : chainName.concat(' ')}${contractName}. Address`, contractAddress);
return contractAddress;
});
};
Expand Down Expand Up @@ -111,7 +110,7 @@ const instantiate = (client, wallet, config, options, chainName) => {
};

const main = async (options) => {
const { env, proposalType } = options;
const { env, proposalType, contractName } = options;
const config = loadConfig(env);

await prepareWallet(options)
Expand All @@ -125,7 +124,18 @@ const main = async (options) => {
const chains = getChains(config, options);

return chains.reduce((promise, chain) => {
return promise.then(() => instantiate(client, wallet, config, options, chain.toLowerCase()));
return promise.then(() =>
instantiate(client, wallet, config, options, chain.toLowerCase()).then((contractAddress) => {
if (contractAddress) {
printInfo(
`Predicted address for ${
chain.toLowerCase() === 'none' ? '' : chain.toLowerCase().concat(' ')
}${contractName}. Address`,
contractAddress,
);
}
}),
);
}, Promise.resolve());
}

Expand Down

0 comments on commit 6e85841

Please sign in to comment.