es/ae/contract.js
async function contractCall (source, address, name, args = [], options = {}) {
  const opt = R.merge(this.Ae.defaults, options)

  const tx = await this.contractCallTx(R.merge(opt, {
    callerId: await this.address(),
    contractId: address,
    callData: await this.contractEncodeCall(source, name, args)
  }))

  const { hash, rawTx } = await this.send(tx, opt)
  const result = await this.getTxInfo(hash)

  if (result.returnType === 'ok') {
    return {
      hash,
      rawTx,
      result,
      decode: (type) => this.contractDecodeData(type, result.returnValue)
    }
  } else {
    await this.handleCallError(result)
  }
}
async function contractCall (source, address, name, args = [], options = {}) {
  const opt = R.merge(this.Ae.defaults, options)

  const tx = await this.contractCallTx(R.merge(opt, {
    callerId: await this.address(),
    contractId: address,
    callData: await this.contractEncodeCall(source, name, args)
  }))

  const { hash, rawTx } = await this.send(tx, opt)
  const result = await this.getTxInfo(hash)

  if (result.returnType === 'ok') {
    return {
      hash,
      rawTx,
      result,
      decode: (type) => this.contractDecodeData(type, result.returnValue)
    }
  } else {
    await this.handleCallError(result)
  }
}
async function contractCall ( source , address , name , args = [ ] , options = { } ) { const opt = R . merge ( this . Ae . defaults , options ) const tx = await this . contractCallTx ( R . merge ( opt , { callerId : await this . address ( ) , contractId : address , callData : await this . contractEncodeCall ( source , name , args ) } ) ) const { hash , rawTx } = await this . send ( tx , opt ) const result = await this . getTxInfo ( hash ) if ( result . returnType === 'ok' ) { return { hash , rawTx , result , decode : ( type ) => this . contractDecodeData ( type , result . returnValue ) } } else { await this . handleCallError ( result ) } }
Call contract function
@function
@alias module:@aeternity/aepp-sdk/es/ae/contract
@category async
@param {String} source Contract source code
@param {String} address Contract address
@param {String} name Name of function to call
@param {Array} args Argument's for call function
@param {Object} options Transaction options (fee, ttl, gas, amount, deposit)
@return {Promise<Object>} Result object
@example
const callResult = await client.contractCall(source, address, fnName, args = [], options)
{
hash: TX_HASH,
result: TX_DATA,
decode: (type) => Decode call result
}
Call contract function