How to use the @truffle/debug-utils.formatPrompt function in @truffle/debug-utils

To help you get started, we’ve selected a few @truffle/debug-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github trufflesuite / truffle / packages / core / lib / debug / interpreter.js View on Github external
} else {
          txSpinner.fail();
          loadFailed = true;
        }
      } else {
        loadFailed = true;
        this.printer.print(
          "Please unload the current transaction before loading a new one."
        );
      }
    }
    if (cmd === "T") {
      if (this.session.view(selectors.session.status.loaded)) {
        await this.session.unload();
        this.printer.print("Transaction unloaded.");
        this.setPrompt(DebugUtils.formatPrompt(this.network));
      } else {
        this.printer.print("No transaction to unload.");
        this.printer.print("");
      }
    }

    // Check if execution has (just now) stopped.
    if (this.session.view(trace.finished) && !alreadyFinished) {
      this.printer.print("");
      //check if transaction failed
      if (!this.session.view(evm.transaction.status)) {
        this.printer.print("Transaction halted with a RUNTIME ERROR.");
        this.printer.print("");
        this.printer.print(
          "This is likely due to an intentional halting expression, like assert(), require() or revert(). It can also be due to out-of-gas exceptions. Please inspect your transaction parameters and contract code to determine the meaning of this error."
        );
github trufflesuite / truffle / packages / core / lib / debug / interpreter.js View on Github external
start(terminate) {
    // if terminate is not passed, return a Promise instead
    if (terminate === undefined) {
      return util.promisify(this.start.bind(this))();
    }

    if (this.session.view(session.status.loaded)) {
      this.printer.printSessionLoaded();
    } else if (this.session.view(session.status.isError)) {
      this.printer.printSessionError();
    } else {
      this.printer.printHelp();
    }

    const prompt = this.session.view(session.status.loaded)
      ? DebugUtils.formatPrompt(this.network, this.txHash)
      : DebugUtils.formatPrompt(this.network);

    this.repl.start({
      prompt,
      interpreter: util.callbackify(this.interpreter.bind(this)),
      ignoreUndefined: true,
      done: terminate
    });
  }
github trufflesuite / truffle / packages / core / lib / debug / interpreter.js View on Github external
// if terminate is not passed, return a Promise instead
    if (terminate === undefined) {
      return util.promisify(this.start.bind(this))();
    }

    if (this.session.view(session.status.loaded)) {
      this.printer.printSessionLoaded();
    } else if (this.session.view(session.status.isError)) {
      this.printer.printSessionError();
    } else {
      this.printer.printHelp();
    }

    const prompt = this.session.view(session.status.loaded)
      ? DebugUtils.formatPrompt(this.network, this.txHash)
      : DebugUtils.formatPrompt(this.network);

    this.repl.start({
      prompt,
      interpreter: util.callbackify(this.interpreter.bind(this)),
      ignoreUndefined: true,
      done: terminate
    });
  }
github trufflesuite / truffle / packages / core / lib / debug / interpreter.js View on Github external
if (this.session.view(selectors.session.status.loaded)) {
        await this.session.reset();
      } else {
        this.printer.print("No transaction loaded.");
        this.printer.print("");
      }
    }
    if (cmd === "t") {
      if (!this.session.view(selectors.session.status.loaded)) {
        let txSpinner = ora(DebugUtils.formatTransactionStartMessage()).start();
        await this.session.load(cmdArgs);
        //if load succeeded
        if (this.session.view(selectors.session.status.success)) {
          txSpinner.succeed();
          //if successful, change prompt
          this.setPrompt(DebugUtils.formatPrompt(this.network, cmdArgs));
        } else {
          txSpinner.fail();
          loadFailed = true;
        }
      } else {
        loadFailed = true;
        this.printer.print(
          "Please unload the current transaction before loading a new one."
        );
      }
    }
    if (cmd === "T") {
      if (this.session.view(selectors.session.status.loaded)) {
        await this.session.unload();
        this.printer.print("Transaction unloaded.");
        this.setPrompt(DebugUtils.formatPrompt(this.network));