Skip to content

Commit a3ad7ba

Browse files
authored
Updates for 2.2.0 (#3)
1 parent bc2c78f commit a3ad7ba

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

lib/models/Transaction.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ const Transaction = module.exports = class Transaction {
152152
}
153153
}
154154
get abi() {
155-
return this._abi || {};
155+
return this._abi || [];
156156
}
157157
get abiString() {
158158
if (this.type === 2) {
@@ -342,8 +342,10 @@ const Transaction = module.exports = class Transaction {
342342
path: '/' + network.config.apiVersion + network.config.routes.transactionStatus + this.id
343343
}
344344
).then((d) => {
345-
if (d.status === 'Ok') {
346-
this.address = d.data.contractAddress;
345+
if (d.data && d.data.status) {
346+
if (d.data.contractAddress) {
347+
this.address = d.data.contractAddress;
348+
}
347349
resolve(d.data);
348350
} else {
349351
reject(d);
@@ -485,13 +487,15 @@ const Transaction = module.exports = class Transaction {
485487
errors: [],
486488
warnings: []
487489
};
488-
Object.keys(compiled.contracts.source).forEach((k) => {
489-
ret.contracts.push({
490-
contract: k,
491-
bytecode: compiled.contracts.source[k].evm.bytecode.object,
492-
abi: compiled.contracts.source[k].abi
490+
if (compiled.contracts.source) {
491+
Object.keys(compiled.contracts.source).forEach((k) => {
492+
ret.contracts.push({
493+
contract: k,
494+
bytecode: compiled.contracts.source[k].evm.bytecode.object,
495+
abi: compiled.contracts.source[k].abi
496+
});
493497
});
494-
});
498+
}
495499
(compiled.errors || []).forEach((e) => {
496500
if (e.severity === 'warning') {
497501
ret.warnings.push(e);
@@ -531,7 +535,7 @@ const Transaction = module.exports = class Transaction {
531535
'*': ['abi', 'evm.bytecode.object']
532536
}
533537
}
534-
}, input.settings);
538+
}, input.settings || {});
535539
const ret = solc.compileStandardWrapper(JSON.stringify(input), find);
536540
return JSON.parse(ret);
537541
}

0 commit comments

Comments
 (0)