Skip to content

Commit

Permalink
fix(Contract): Add error handlinc(decoding) in low lvl contract API (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
nduchak authored May 10, 2019
1 parent dbb1ba0 commit e1fdce0
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions es/ae/contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,16 +215,20 @@ async function contractDeploy (code, source, initState = [], options = {}) {
const { hash, rawTx } = await this.send(tx, opt)
const result = await this.getTxInfo(hash)

return Object.freeze({
result,
owner: ownerId,
transaction: hash,
rawTx,
address: contractId,
call: async (name, args = [], options) => this.contractCall(source, contractId, name, args, options),
callStatic: async (name, args = [], options) => this.contractCallStatic(source, contractId, name, args, options),
createdAt: new Date()
})
if (result.returnType === 'ok') {
return Object.freeze({
result,
owner: ownerId,
transaction: hash,
rawTx,
address: contractId,
call: async (name, args = [], options) => this.contractCall(source, contractId, name, args, options),
callStatic: async (name, args = [], options) => this.contractCallStatic(source, contractId, name, args, options),
createdAt: new Date()
})
} else {
await this.handleCallError(result)
}
}

/**
Expand Down

0 comments on commit e1fdce0

Please sign in to comment.