bitcore-wallet-service
Version:
A service for Mutisig HD Bitcoin Wallets
43 lines • 1.54 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BchChain = void 0;
const crypto_wallet_core_1 = require("crypto-wallet-core");
const config_1 = __importDefault(require("../../../config"));
const errordefinitions_1 = require("../../errors/errordefinitions");
const btc_1 = require("../btc");
class BchChain extends btc_1.BtcChain {
constructor() {
super(crypto_wallet_core_1.BitcoreLibCash);
this.sizeEstimationMargin = config_1.default.bch?.sizeEstimationMargin ?? 0.01;
this.inputSizeEstimationMargin = config_1.default.bch?.inputSizeEstimationMargin ?? 2;
}
getSizeSafetyMargin(opts) {
return 0;
}
getInputSizeSafetyMargin(opts) {
return 0;
}
validateAddress(wallet, inaddr, opts) {
const A = crypto_wallet_core_1.BitcoreLibCash.Address;
let addr = {};
try {
addr = new A(inaddr);
}
catch (ex) {
throw errordefinitions_1.Errors.INVALID_ADDRESS;
}
if (!this._isCorrectNetwork(wallet, addr)) {
throw errordefinitions_1.Errors.INCORRECT_ADDRESS_NETWORK;
}
if (!opts.noCashAddr) {
if (addr.toString(true) != inaddr)
throw errordefinitions_1.Errors.ONLY_CASHADDR;
}
return;
}
}
exports.BchChain = BchChain;
//# sourceMappingURL=index.js.map