export async function startSolidityDebugger()

in src/commands/DebuggerCommands.ts [19:58]


  export async function startSolidityDebugger() {
    Telemetry.sendEvent('DebuggerCommands.startSolidityDebugger.commandStarted');
    const workingDirectory = getWorkingDirectory();
    if (!workingDirectory) {
      return;
    }
    const debugNetwork = new DebugNetwork(workingDirectory);
    await debugNetwork.load();
    const contractBuildDir = debugNetwork.getTruffleConfiguration()!.contracts_build_directory;
    const debugNetworkOptions = debugNetwork.getNetwork()!.options;
    const web3 = new Web3Wrapper(debugNetworkOptions);
    const providerUrl = web3.getProviderUrl();

    if (debugNetwork.isLocalNetwork()) {
      // if local service then provide last transactions to choose
      const transactionProvider = new TransactionProvider(web3, contractBuildDir);
      const txHashesAsQuickPickItems = await getQuickPickItems(transactionProvider);

      const txHashSelection = await showQuickPick(txHashesAsQuickPickItems, {
        ignoreFocusOut: true,
        placeHolder: 'Enter the transaction hash to debug',
      });

      const txHash = txHashSelection.label;
      const config = generateDebugAdapterConfig(txHash, workingDirectory, providerUrl);
      debug.startDebugging(undefined, config).then(() => {
          Telemetry.sendEvent('DebuggerCommands.startSolidityDebugger.commandFinished');
        });
    } else {
      // if remote network then require txHash
      const placeHolder = 'Type the transaction hash you want to debug (0x...)';
      const txHash = await showInputBox({ placeHolder });
      if (txHash) {
        const config = generateDebugAdapterConfig(txHash, workingDirectory, providerUrl);
        debug.startDebugging(undefined, config).then(() => {
          Telemetry.sendEvent('DebuggerCommands.startSolidityDebugger.commandFinished');
        });
      }
    }
  }