1 | "use strict";
|
2 | var __extends = (this && this.__extends) || (function () {
|
3 | var extendStatics = function (d, b) {
|
4 | extendStatics = Object.setPrototypeOf ||
|
5 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
6 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
7 | return extendStatics(d, b);
|
8 | };
|
9 | return function (d, b) {
|
10 | extendStatics(d, b);
|
11 | function __() { this.constructor = d; }
|
12 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
13 | };
|
14 | })();
|
15 | Object.defineProperty(exports, "__esModule", { value: true });
|
16 | var ethereumjs_util_1 = require("ethereumjs-util");
|
17 | var buffer_1 = require("buffer");
|
18 | var transaction_1 = require("./transaction");
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 | var FakeTransaction = (function (_super) {
|
31 | __extends(FakeTransaction, _super);
|
32 | function FakeTransaction(data, opts) {
|
33 | if (data === void 0) { data = {}; }
|
34 | if (opts === void 0) { opts = {}; }
|
35 | var _this = _super.call(this, data, opts) || this;
|
36 | Object.defineProperty(_this, 'from', {
|
37 | enumerable: true,
|
38 | configurable: true,
|
39 | get: function () { return _this.getSenderAddress(); },
|
40 | set: function (val) {
|
41 | if (val) {
|
42 | _this._from = ethereumjs_util_1.toBuffer(val);
|
43 | }
|
44 | },
|
45 | });
|
46 | var txData = data;
|
47 | if (txData.from) {
|
48 | _this.from = ethereumjs_util_1.toBuffer(txData.from);
|
49 | }
|
50 | return _this;
|
51 | }
|
52 | |
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 | FakeTransaction.prototype.hash = function (includeSignature) {
|
59 | if (includeSignature === void 0) { includeSignature = true; }
|
60 | if (includeSignature && this._from && this._from.toString('hex') !== '') {
|
61 |
|
62 | var fakeKey = buffer_1.Buffer.concat([this._from, this._from.slice(0, 12)]);
|
63 | this.sign(fakeKey);
|
64 | }
|
65 | return _super.prototype.hash.call(this, includeSignature);
|
66 | };
|
67 | return FakeTransaction;
|
68 | }(transaction_1.default));
|
69 | exports.default = FakeTransaction;
|
70 |
|
\ | No newline at end of file |