es/channel/index.js
function createContract ({ code, callData, deposit, vmVersion, abiVersion }, sign) {
  return new Promise((resolve, reject) => {
    enqueueAction(
      this,
      (channel, state) => state.handler === handlers.channelOpen,
      (channel, state) => {
        send(channel, {
          jsonrpc: '2.0',
          method: 'channels.update.new_contract',
          params: {
            code,
            call_data: callData,
            deposit,
            vm_version: vmVersion,
            abi_version: abiVersion
          }
        })
        return {
          handler: handlers.awaitingNewContractTx,
          state: {
            sign,
            resolve,
            reject
          }
        }
      }
    )
  })
}
function createContract ({ code, callData, deposit, vmVersion, abiVersion }, sign) {
  return new Promise((resolve, reject) => {
    enqueueAction(
      this,
      (channel, state) => state.handler === handlers.channelOpen,
      (channel, state) => {
        send(channel, {
          jsonrpc: '2.0',
          method: 'channels.update.new_contract',
          params: {
            code,
            call_data: callData,
            deposit,
            vm_version: vmVersion,
            abi_version: abiVersion
          }
        })
        return {
          handler: handlers.awaitingNewContractTx,
          state: {
            sign,
            resolve,
            reject
          }
        }
      }
    )
  })
}
function createContract ( { code , callData , deposit , vmVersion , abiVersion } , sign ) { return new Promise ( ( resolve , reject ) => { enqueueAction ( this , ( channel , state ) => state . handler === handlers . channelOpen , ( channel , state ) => { send ( channel , { jsonrpc : '2.0' , method : 'channels.update.new_contract' , params : { code , call_data : callData , deposit , vm_version : vmVersion , abi_version : abiVersion } } ) return { handler : handlers . awaitingNewContractTx , state : { sign , resolve , reject } } } ) } ) }
Trigger create contract update

The create contract update is creating a contract inside the channel's internal state tree.
The update is a change to be applied on top of the latest state.

That would create a contract with the poster being the owner of it. Poster commits initially
a deposit amount of tokens to the new contract.

@param {Object} options
@param {String} options.code - Api encoded compiled AEVM byte code
@param {String} options.callData - Api encoded compiled AEVM call data for the code
@param {Number} options.deposit - Initial amount the owner of the contract commits to it
@param {Number} options.vmVersion - Version of the AEVM
@param {Number} options.abiVersion - Version of the ABI
@param {Function} sign - Function which verifies and signs create contract transaction
@return {Promise<Object>}
@example channel.createContract({
code: 'cb_HKtpipK4aCgYb17wZ...',
callData: 'cb_1111111111111111...',
deposit: 10,
vmVersion: 3,
abiVersion: 1
}).then(({ accepted, signedTx, address }) => {
if (accepted) {
console.log('New contract has been created')
console.log('Contract address:', address)
} else {
console.log('New contract has been rejected')
}
})
Trigger create contract update