server.src.contractImpl.ContractLifecycleImpl.mustache Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of web3j-openapi-codegen Show documentation
Show all versions of web3j-openapi-codegen Show documentation
web3j-openapi project code generators
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
)
}