PHP WebShell

Текущая директория: /usr/lib/node_modules/bitgo/node_modules/@stacks/transactions/node_modules/@stacks/network/dist

Просмотр файла: network.umd.development.js

(function (global, factory) {
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@stacks/common')) :
  typeof define === 'function' && define.amd ? define(['exports', '@stacks/common'], factory) :
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['@stacks/network'] = {}, global.common));
}(this, (function (exports, common) { 'use strict';

  function _inheritsLoose(subClass, superClass) {
    subClass.prototype = Object.create(superClass.prototype);
    subClass.prototype.constructor = subClass;
    subClass.__proto__ = superClass;
  }

  var StacksMainnet = /*#__PURE__*/function () {
    function StacksMainnet() {
      var _this = this;

      this.version = common.TransactionVersion.Mainnet;
      this.chainId = common.ChainID.Mainnet;
      this.coreApiUrl = 'https://stacks-node-api.mainnet.stacks.co';
      this.bnsLookupUrl = 'https://core.blockstack.org';
      this.broadcastEndpoint = '/v2/transactions';
      this.transferFeeEstimateEndpoint = '/v2/fees/transfer';
      this.accountEndpoint = '/v2/accounts';
      this.contractAbiEndpoint = '/v2/contracts/interface';
      this.readOnlyFunctionCallEndpoint = '/v2/contracts/call-read';

      this.isMainnet = function () {
        return _this.version === common.TransactionVersion.Mainnet;
      };

      this.getBroadcastApiUrl = function () {
        return "" + _this.coreApiUrl + _this.broadcastEndpoint;
      };

      this.getTransferFeeEstimateApiUrl = function () {
        return "" + _this.coreApiUrl + _this.transferFeeEstimateEndpoint;
      };

      this.getAccountApiUrl = function (address) {
        return "" + _this.coreApiUrl + _this.accountEndpoint + "/" + address + "?proof=0";
      };

      this.getAbiApiUrl = function (address, contract) {
        return "" + _this.coreApiUrl + _this.contractAbiEndpoint + "/" + address + "/" + contract;
      };

      this.getReadOnlyFunctionCallApiUrl = function (contractAddress, contractName, functionName) {
        return "" + _this.coreApiUrl + _this.readOnlyFunctionCallEndpoint + "/" + contractAddress + "/" + contractName + "/" + encodeURIComponent(functionName);
      };

      this.getInfoUrl = function () {
        return _this.coreApiUrl + "/v2/info";
      };

      this.getBlockTimeInfoUrl = function () {
        return _this.coreApiUrl + "/extended/v1/info/network_block_times";
      };

      this.getPoxInfoUrl = function () {
        return _this.coreApiUrl + "/v2/pox";
      };

      this.getStackerInfoUrl = function (contractAddress, contractName) {
        return "" + _this.coreApiUrl + _this.readOnlyFunctionCallEndpoint + "\n    " + contractAddress + "/" + contractName + "/get-stacker-info";
      };
    }

    var _proto = StacksMainnet.prototype;

    _proto.getNameInfo = function getNameInfo(fullyQualifiedName) {
      var nameLookupURL = this.bnsLookupUrl + "/v1/names/" + fullyQualifiedName;
      return common.fetchPrivate(nameLookupURL).then(function (resp) {
        if (resp.status === 404) {
          throw new Error('Name not found');
        } else if (resp.status !== 200) {
          throw new Error("Bad response status: " + resp.status);
        } else {
          return resp.json();
        }
      }).then(function (nameInfo) {
        if (nameInfo.address) {
          return Object.assign({}, nameInfo, {
            address: nameInfo.address
          });
        } else {
          return nameInfo;
        }
      });
    };

    return StacksMainnet;
  }();
  var StacksTestnet = /*#__PURE__*/function (_StacksMainnet) {
    _inheritsLoose(StacksTestnet, _StacksMainnet);

    function StacksTestnet() {
      var _this2;

      _this2 = _StacksMainnet.apply(this, arguments) || this;
      _this2.version = common.TransactionVersion.Testnet;
      _this2.chainId = common.ChainID.Testnet;
      _this2.coreApiUrl = 'https://stacks-node-api.testnet.stacks.co';
      return _this2;
    }

    return StacksTestnet;
  }(StacksMainnet);
  var StacksMocknet = /*#__PURE__*/function (_StacksMainnet2) {
    _inheritsLoose(StacksMocknet, _StacksMainnet2);

    function StacksMocknet() {
      var _this3;

      _this3 = _StacksMainnet2.apply(this, arguments) || this;
      _this3.version = common.TransactionVersion.Testnet;
      _this3.chainId = common.ChainID.Testnet;
      _this3.coreApiUrl = 'http://localhost:3999';
      return _this3;
    }

    return StacksMocknet;
  }(StacksMainnet);

  exports.StacksMainnet = StacksMainnet;
  exports.StacksMocknet = StacksMocknet;
  exports.StacksTestnet = StacksTestnet;

  Object.defineProperty(exports, '__esModule', { value: true });

})));
//# sourceMappingURL=network.umd.development.js.map

Выполнить команду


Для локальной разработки. Не используйте в интернете!