@ecash/lib
Version:
Library for eCash transaction building
37 lines • 1.12 kB
JavaScript
;
// Copyright (c) 2024 The Bitcoin developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
Object.defineProperty(exports, "__esModule", { value: true });
exports.WriterLength = void 0;
/**
* Writer implementation which only measures the length of the serialized
* output but doesn't actually store any byte data.
**/
class WriterLength {
constructor() {
this.length = 0;
}
/** Write a single byte */
putU8(_value) {
this.length++;
}
/** Write a 2-byte little-endian integer (uint16_t) */
putU16(_value, _endian) {
this.length += 2;
}
/** Write a 4-byte little-endian integer (uint32_t) */
putU32(_value, _endian) {
this.length += 4;
}
/** Write an 8-byte little-endian integer (uint64_t) */
putU64(_value, _endian) {
this.length += 8;
}
/** Write the given bytes */
putBytes(bytes) {
this.length += bytes.length;
}
}
exports.WriterLength = WriterLength;
//# sourceMappingURL=writerlength.js.map