@abcpros/bitcore-wallet-service
Version:
A service for Mutisig HD Bitcoin Wallets
57 lines • 2.3 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.BchChain = void 0;
var crypto_wallet_core_1 = require("@abcpros/crypto-wallet-core");
var btc_1 = require("../btc");
var config = require('../../../config');
var Errors = require('../../errors/errordefinitions');
var BchChain = (function (_super) {
__extends(BchChain, _super);
function BchChain() {
var _a, _b, _c, _d;
var _this = _super.call(this, crypto_wallet_core_1.BitcoreLibCash) || 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;
}
BchChain.prototype.getSizeSafetyMargin = function (opts) {
return 0;
};
BchChain.prototype.getInputSizeSafetyMargin = function (opts) {
return 0;
};
BchChain.prototype.validateAddress = function (wallet, inaddr, opts) {
var A = crypto_wallet_core_1.BitcoreLibCash.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;
}
if (!opts.noCashAddr) {
if (addr.toString(true) != inaddr)
throw Errors.ONLY_CASHADDR;
}
return;
};
return BchChain;
}(btc_1.BtcChain));
exports.BchChain = BchChain;
//# sourceMappingURL=index.js.map