Skip to content

Commit

Permalink
fix(ACI): Fix address type transformation when decoding data (#335)
Browse files Browse the repository at this point in the history
  • Loading branch information
nduchak authored Apr 16, 2019
1 parent 034f8cc commit e37cdfc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions es/contract/aci.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
* @example import ContractACI from '@aeternity/aepp-sdk/es/contract/aci'
*/
import AsyncInit from '../utils/async-init'
import { decode, encode } from '../tx/builder/helpers'
import { decode } from '../tx/builder/helpers'
import { aeEncodeKey } from '../utils/crypto'
import { toBytes } from '../utils/bytes'

const SOPHIA_TYPES = [
'int',
Expand Down Expand Up @@ -116,7 +118,7 @@ function transformDecodedData (aci, result, { skipTransformDecoded = false } = {
case SOPHIA_TYPES.bool:
return !!result.value
case SOPHIA_TYPES.address:
return encode(Buffer.from(result.value, 'hex'), 'ak')
return aeEncodeKey(toBytes(result.value, true))
case SOPHIA_TYPES.map:
const [keyT, ...valueT] = generic.split(',')
return result.value
Expand Down

0 comments on commit e37cdfc

Please sign in to comment.