text: var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
      function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
      return new (P || (P = Promise))(function (resolve, reject) {
          function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
          function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
          function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
          step((generator = generator.apply(thisArg, _arguments || [])).next());
      });
  };
  /* eslint-disable @typescript-eslint/no-non-null-assertion */
  import { tx, u } from "@cityofzion/neon-core";
  import { getVerificationSignatureForSmartContract } from "./common";
  /**
   * Adds attributes to the override object for mintTokens invocations.
   * @param config - Configuration object.
   * @return Configuration object.
   */
  export function addAttributeIfExecutingAsSmartContract(config) {
      var _a;
      return __awaiter(this, void 0, void 0, function* () {
          if (!config.sendingFromSmartContract) {
              return config;
          }
          (_a = config.tx) === null || _a === void 0 ? void 0 : _a.addAttribute(tx.TxAttrUsage.Script, u.reverseHex(config.sendingFromSmartContract));
          return config;
      });
  }
  /**
   * Adds the contractState to invocations sending from the contract's balance.
   * @param config - Configuration object.
   * @return Configuration object.
   */
  export function addSignatureIfExecutingAsSmartContract(config) {
      return __awaiter(this, void 0, void 0, function* () {
          if (!config.sendingFromSmartContract) {
              return config;
          }
          const witness = yield getVerificationSignatureForSmartContract(config.url, config.sendingFromSmartContract);
          config.tx.addWitness(witness);
          return config;
      });
  }
  //# sourceMappingURL=smartcontract.js.map