es/ae/contract.js
async function contractDeploy (code, source, initState = [], options = {}) {
  const opt = R.merge(this.Ae.defaults, options)
  const callData = await this.contractEncodeCall(source, 'init', initState)
  const ownerId = await this.address()

  const { tx, contractId } = await this.contractCreateTx(R.merge(opt, {
    callData,
    code,
    ownerId
  }))

  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()
  })
}
async function contractDeploy (code, source, initState = [], options = {}) {
  const opt = R.merge(this.Ae.defaults, options)
  const callData = await this.contractEncodeCall(source, 'init', initState)
  const ownerId = await this.address()

  const { tx, contractId } = await this.contractCreateTx(R.merge(opt, {
    callData,
    code,
    ownerId
  }))

  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()
  })
}
async function contractDeploy ( code , source , initState = [ ] , options = { } ) { const opt = R . merge ( this . Ae . defaults , options ) const callData = await this . contractEncodeCall ( source , 'init' , initState ) const ownerId = await this . address ( ) const { tx , contractId } = await this . contractCreateTx ( R . merge ( opt , { callData , code , ownerId } ) ) 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 ( ) } ) }
Deploy contract to the node
@function
@alias module:@aeternity/aepp-sdk/es/ae/contract
@category async
@param {String} code Compiled contract
@param {String} source Contract source code
@param {Array} initState Arguments of contract constructor(init) function
@param {Object} options Transaction options (fee, ttl, gas, amount, deposit)
@return {Promise<Object>} Result object
@example
const deployed = await client.contractDeploy(bytecode, source, init = [], options)
{
owner: OWNER_PUB_KEY,
transaction: TX_HASH,
address: CONTRACT_ADDRESS,
createdAt: Date,
result: DEPLOY_TX_DATA,
call: (fnName, args = [], options) => Call contract function,
callStatic: (fnName, args = [], options) => Static all contract function
}
Deploy contract to the node