@airgap/coinlib-core
Version:
The @airgap/coinlib-core is a protocol agnostic library to prepare, sign and broadcast cryptocurrency transactions.
35 lines • 1.31 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProtocolNetwork = exports.NetworkType = void 0;
var createHash = require("../dependencies/src/create-hash-1.2.0/index");
var sha256hashShort = function (input) {
var hash = createHash('sha256');
hash.update(input);
return hash.digest('base64').slice(0, 10);
};
var NetworkType;
(function (NetworkType) {
NetworkType["MAINNET"] = "MAINNET";
NetworkType["TESTNET"] = "TESTNET";
NetworkType["CUSTOM"] = "CUSTOM";
})(NetworkType = exports.NetworkType || (exports.NetworkType = {}));
var ProtocolNetwork = /** @class */ (function () {
function ProtocolNetwork(name, type, rpcUrl, blockExplorer, extras) {
this.name = name;
this.type = type;
this.rpcUrl = rpcUrl;
this.blockExplorer = blockExplorer;
this.extras = extras;
}
Object.defineProperty(ProtocolNetwork.prototype, "identifier", {
get: function () {
var hashed = sha256hashShort("".concat(this.name, "-").concat(this.rpcUrl));
return "".concat(this.type, "-").concat(hashed);
},
enumerable: false,
configurable: true
});
return ProtocolNetwork;
}());
exports.ProtocolNetwork = ProtocolNetwork;
//# sourceMappingURL=ProtocolNetwork.js.map