All Downloads are FREE. Search and download functionalities are using the official Maven repository.

server.src.contractImpl.ContractLifecycleImpl.mustache Maven / Gradle / Ivy

There is a newer version: 4.8.4
Show newest version
package {{packageName}}.server.{{lowerCaseContractName}}

import {{packageName}}.core.{{lowerCaseContractName}}.{{capitalizedContractName}}Lifecycle
import {{packageName}}.core.{{lowerCaseContractName}}.model.{{capitalizedContractName}}DeployParameters
import {{packageName}}.wrappers.{{capitalizedContractName}}
import org.web3j.protocol.Web3j
import org.web3j.protocol.core.methods.response.TransactionReceipt
import org.web3j.tx.TransactionManager
import org.web3j.tx.gas.ContractGasProvider
import javax.annotation.processing.Generated
import javax.ws.rs.Consumes
import javax.ws.rs.Produces
import javax.ws.rs.core.MediaType
import org.glassfish.jersey.server.ExtendedUriInfo

@Generated
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
class {{capitalizedContractName}}LifecycleImpl(
    private val web3j: Web3j,
    private val transactionManager: TransactionManager,
    private val defaultGasProvider: ContractGasProvider,
    private val uriInfo: ExtendedUriInfo
) : {{capitalizedContractName}}Lifecycle {

    override fun deploy{{deployParameters}}: TransactionReceipt {
        val {{decapitalizedContractName}} = {{capitalizedContractName}}.deploy(
            web3j,
            transactionManager,
            defaultGasProvider
            {{parameters}}
        ).send()

        return {{decapitalizedContractName}}.transactionReceipt.get()
    }

    override fun load(contractAddress: String) =
        {{capitalizedContractName}}ResourceImpl(
            {{capitalizedContractName}}.load(contractAddress, web3j, transactionManager, defaultGasProvider),
            uriInfo
        )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy