UNPKG

1.14 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const client_common_1 = require("@neo-one/client-common");
4const utils_1 = require("../utils");
5class Input extends client_common_1.InputModel {
6 constructor() {
7 super(...arguments);
8 this.equals = utils_1.utils.equals(Input, this, (other) => client_common_1.common.uInt256Equal(this.hash, other.hash) && other.index === this.index);
9 this.toKeyString = utils_1.utils.toKeyString(Input, () => `${this.hashHex}:${this.index}`);
10 }
11 static deserializeWireBase({ reader }) {
12 const hash = reader.readUInt256();
13 const index = reader.readUInt16LE();
14 return new this({ hash, index });
15 }
16 static deserializeWire(options) {
17 return this.deserializeWireBase({
18 context: options.context,
19 reader: new utils_1.BinaryReader(options.buffer),
20 });
21 }
22 serializeJSON(_context) {
23 return {
24 txid: client_common_1.JSONHelper.writeUInt256(this.hash),
25 vout: this.index,
26 };
27 }
28}
29exports.Input = Input;
30
31//# sourceMappingURL=Input.js.map