chaingate
Version:
A complete TypeScript library for connecting to and making transactions on different blockchains
31 lines • 1.22 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.BitcoinCashWallet = void 0;
const UtxoWallet_1 = require("../../abstract/UtxoWallet/UtxoWallet");
const BitcoinCashPreparedTransaction_1 = require("./BitcoinCashPreparedTransaction");
Object.defineProperty(global, '_bitcoreCash', {
get() {
return undefined;
},
set() { },
configurable: true,
});
class BitcoinCashWallet extends UtxoWallet_1.UtxoWallet {
constructor(utils, transports) {
super(utils, transports, {
bech32: 'bc',
pubKeyHash: 0x00,
scriptHash: 0x05,
wif: 0x80,
});
}
async getAddress(addressType = 'cashaddr') {
return this.utils.publicKeyToAddress(await this.getPublicKey(), addressType);
}
async createTransfer(toAddress, amount) {
const privateKeyProvider = await this.transports.getPrivateKeyProvider(this.utils.currencyInfo.id);
return new BitcoinCashPreparedTransaction_1.BitcoinCashPreparedTransaction(this.utils, await this.getAddress(), toAddress, amount, privateKeyProvider);
}
}
exports.BitcoinCashWallet = BitcoinCashWallet;
//# sourceMappingURL=BitcoinCashWallet.js.map