Skip to content

Commit bad3054

Browse files
authored
Merge pull request #7 from SIMBAChain/BLK-680_false_export_success_message
fixed incorrect export status bug
2 parents 83c0a5b + eb14bdc commit bad3054

4 files changed

Lines changed: 26 additions & 20 deletions

File tree

build/main/commands/export.js

Lines changed: 7 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@simbachain/truffle",
3-
"version": "3.1.6",
3+
"version": "3.1.7",
44
"description": "Truffle Plugin for SIMBAChain",
55
"main": "build/main/index.js",
66
"typings": "build/main/index.d.ts",
@@ -60,7 +60,7 @@
6060
"node": ">=10"
6161
},
6262
"dependencies": {
63-
"@simbachain/web3-suites": "^2.1.4",
63+
"@simbachain/web3-suites": "^2.1.5",
6464
"@truffle/config": "^1.2.33",
6565
"@types/configstore": "^4.0.0",
6666
"@types/crypto-js": "^3.1.44",
@@ -142,4 +142,4 @@
142142
"**/*.spec.js"
143143
]
144144
}
145-
}
145+
}

src/commands/export.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export const handler = async (args: yargs.Arguments): Promise<any> => {
6767
} else {
6868
interactive = true;
6969
}
70-
70+
7171
const buildDir = SimbaConfig.buildDirectory;
7272
SimbaConfig.log.debug(`buildDir: ${buildDir}`);
7373
let files: string[] = [];
@@ -122,9 +122,11 @@ export const handler = async (args: yargs.Arguments): Promise<any> => {
122122
// use sourceCodeComparer to prevent export of contracts that
123123
// do not have any changes:
124124
const exportStatuses = await sourceCodeComparer.exportStatuses(choices);
125+
const successfulExportMessage = `${chalk.greenBright(`Successfully exported`)}`;
125126

126127
let currentContractName;
127128
if (!primary) {
129+
const attemptedExports: Record<any, any> = {};
128130
let chosen: Record<string, Array<any>>;
129131
if (interactive) {
130132
chosen = await prompt({
@@ -156,18 +158,17 @@ export const handler = async (args: yargs.Arguments): Promise<any> => {
156158
const nonLibsArray = [];
157159
for (let i = 0; i < chosen.contracts.length; i++) {
158160
const contractName = chosen.contracts[i];
161+
attemptedExports[contractName] = exportStatuses[contractName];
159162
if (supplementalInfo[contractName].contractType === "library") {
160163
libsArray.push(contractName);
161164
} else {
162165
nonLibsArray.push(contractName);
163166
}
164167
}
165168
const allContracts = libsArray.concat(nonLibsArray);
166-
const attemptedExports: Record<any, any> = {};
167169
for (let i = 0; i < allContracts.length; i++) {
168170
const singleContractImportData = {} as any;
169171
currentContractName = allContracts[i];
170-
attemptedExports[currentContractName] = exportStatuses[currentContractName];
171172
if (!exportStatuses[currentContractName].newOrChanged) {
172173
continue;
173174
}
@@ -200,6 +201,7 @@ export const handler = async (args: yargs.Arguments): Promise<any> => {
200201
}
201202

202203
if (resp.id) {
204+
attemptedExports[currentContractName].message = successfulExportMessage;
203205
SimbaConfig.log.debug(`entering id exists logic`);
204206
const contractType = supplementalInfo[currentContractName].contractType;
205207
SimbaConfig.log.debug(`contractType: ${contractType}`);
@@ -214,8 +216,9 @@ export const handler = async (args: yargs.Arguments): Promise<any> => {
214216
source_code: sourceCode,
215217
}
216218
SimbaConfig.ProjectConfigStore.set("contracts_info", contractsInfo);
217-
SimbaConfig.log.info(`${chalk.cyanBright(`\nsimba: Saved Contract ${chalk.greenBright(`${currentContractName}`)} to Design ID `)}${chalk.greenBright(`${resp.id}`)}`);
219+
SimbaConfig.log.info(`${chalk.cyanBright(`\nsimba: Successful Export! Saved Contract ${chalk.greenBright(`${currentContractName}`)} to Design ID `)}${chalk.greenBright(`${resp.id}`)}`);
218220
} else {
221+
attemptedExports[currentContractName] = exportStatuses[currentContractName];
219222
SimbaConfig.log.error(`${chalk.red('\nsimba: EXIT : Error exporting contract to SIMBA Chain')}`);
220223
return;
221224
}

0 commit comments

Comments
 (0)