1 | const lodash = require('lodash');
|
2 | const ContractMethod = require('./ContractMethod');
|
3 |
|
4 | class ContractConstructor extends ContractMethod {
|
5 | constructor(cfx, contract, fragment, bytecode) {
|
6 | super(cfx, contract, lodash.defaults(fragment, { name: 'constructor', inputs: [] }));
|
7 |
|
8 | this.bytecode = bytecode;
|
9 | this.decodeOutputs = hex => hex;
|
10 | }
|
11 |
|
12 | get signature() {
|
13 | return this.bytecode;
|
14 | }
|
15 |
|
16 | set signature(hex) {
|
17 | this.bytecode = hex;
|
18 | }
|
19 |
|
20 | call(...args) {
|
21 | if (!this.bytecode) {
|
22 | throw new Error('bytecode is empty');
|
23 | }
|
24 |
|
25 | return super.call(...args);
|
26 | }
|
27 | }
|
28 |
|
29 | module.exports = ContractConstructor;
|