diff --git a/package.json b/package.json index 7316eb4..15fec4e 100644 --- a/package.json +++ b/package.json @@ -107,10 +107,10 @@ "icon": "$(add)" }, { - "command": "cosmy-wasmy.addAllContracts", - "title": "%cosmy-wasmy.addAllContracts.title%", + "command": "cosmy-wasmy.addContractsAll", + "title": "%cosmy-wasmy.addContractsAll.title%", "category": "Cosmy Wasmy", - "icon": "$(cloud-download)" + "icon": "$(expand-all)" }, { "command": "cosmy-wasmy.deleteContract", @@ -652,7 +652,7 @@ "group": "navigation" }, { - "command": "cosmy-wasmy.addAllContracts", + "command": "cosmy-wasmy.addContractsAll", "when": "view == contract", "group": "navigation" }, diff --git a/package.nls.json b/package.nls.json index 28b008f..30e2789 100644 --- a/package.nls.json +++ b/package.nls.json @@ -8,7 +8,7 @@ "cosmy-wasmy.sendTokens.title": "Send Tokens", "cosmy-wasmy.refreshAccount.title": "Refresh Account View", "cosmy-wasmy.addContract.title": "Import Contract", - "cosmy-wasmy.addAllContracts.title": "Import All Contracts", + "cosmy-wasmy.addContractsAll.title": "Import Contracts - All", "cosmy-wasmy.deleteContract.title": "Delete Contract", "cosmy-wasmy.updateContractAdmin.title": "Update Admin", "cosmy-wasmy.clearContractAdmin.title": "Clear Admin", diff --git a/src/commands/contract.ts b/src/commands/contract.ts index b90ccb5..9675652 100644 --- a/src/commands/contract.ts +++ b/src/commands/contract.ts @@ -75,12 +75,9 @@ export class ContractCmds { } private static registerAddAllContractsCmd(context: vscode.ExtensionContext, contractViewProvider: ContractDataProvider) { - let disposable = vscode.commands.registerCommand('cosmy-wasmy.addAllContracts', () => { - CosmwasmAPI.GetAllContracts().then(contracts => { - console.log("done") - }) + let disposable = vscode.commands.registerCommand('cosmy-wasmy.addContractsAll', () => { if (global.workspaceChain.chainEnvironment == "localnet") { - + importAllContracts(); } else { vscode.window.showErrorMessage(vscode.l10n.t("Sorry! This command is only available for localnet chains")); @@ -88,7 +85,11 @@ export class ContractCmds { }); context.subscriptions.push(disposable); - function importContract(contractAddr: string) { + function importAllContracts() { + CosmwasmAPI.GetAllContracts().then(contracts => { + console.log("done") + }) + if (!Contract.ContractAddressExists(context.globalState, contractAddr)) { vscode.window.withProgress({ location: vscode.ProgressLocation.Notification,