@abcpros/bitcore-wallet-service
Version:
A service for Mutisig HD Bitcoin Wallets
63 lines • 2.59 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.XpiChain = void 0;
var crypto_wallet_core_1 = require("@abcpros/crypto-wallet-core");
var chronik_client_1 = require("chronik-client");
var btc_1 = require("../btc");
var config = require('../../../config');
var Common = require('../../common');
var Utils = Common.Utils;
var Errors = require('../../errors/errordefinitions');
var chronikClient = new chronik_client_1.ChronikClient(config.supportToken.xpi.chronikClientUrl);
var XpiChain = (function (_super) {
__extends(XpiChain, _super);
function XpiChain() {
var _a, _b, _c, _d;
var _this = _super.call(this, crypto_wallet_core_1.BitcoreLibXpi) || this;
_this.sizeEstimationMargin = (_b = (_a = config.bch) === null || _a === void 0 ? void 0 : _a.sizeEstimationMargin) !== null && _b !== void 0 ? _b : 0.01;
_this.inputSizeEstimationMargin = (_d = (_c = config.bch) === null || _c === void 0 ? void 0 : _c.inputSizeEstimationMargin) !== null && _d !== void 0 ? _d : 2;
return _this;
}
XpiChain.prototype.getSizeSafetyMargin = function (opts) {
return 0;
};
XpiChain.prototype.convertFeePerKb = function (p, feePerKb) {
return [p, Utils.strip(feePerKb * 1e6)];
};
XpiChain.prototype.getInputSizeSafetyMargin = function (opts) {
return 0;
};
XpiChain.prototype.getChronikClient = function () {
return chronikClient;
};
XpiChain.prototype.validateAddress = function (wallet, inaddr, opts) {
var A = crypto_wallet_core_1.BitcoreLibXpi.Address;
var addr = {};
try {
addr = new A(inaddr);
}
catch (ex) {
throw Errors.INVALID_ADDRESS;
}
if (addr.network.toString() != wallet.network) {
throw Errors.INCORRECT_ADDRESS_NETWORK;
}
return;
};
return XpiChain;
}(btc_1.BtcChain));
exports.XpiChain = XpiChain;
//# sourceMappingURL=index.js.map