11package <package_name>;
22
3+ import org.web3j.crypto.Credentials
34import org.web3j.crypto.WalletUtils
5+ import org.web3j.protocol.http.HttpService
46import org.web3j.protocol.Web3j
57import org.web3j.tx.gas.DefaultGasProvider
68
9+ import <package_name>.generated.contracts.HelloWorld
10+
711/**
812 * <p>This is the generated class for <code>web3j new helloworld --kotlin</code></p>
913 * <p>It deploys the Hello World contract in src/main/solidity/ and prints its address</p>
@@ -23,11 +27,11 @@ class <project_name> {
2327 }
2428
2529 fun start(args: Array<String>) {
26- var credentials:Credentials? = WalletUtils.loadCredentials(Web3App .walletPassword, Web3App .walletPath)
27- var web3j: Web3j? = Web3j.build(org.web3j.protocol.http. HttpService(Web3App .nodeUrl))
30+ var credentials:Credentials? = WalletUtils.loadCredentials(this .walletPassword, this .walletPath)
31+ var web3j: Web3j? = Web3j.build(HttpService(this .nodeUrl))
2832 println("Deploying HelloWorld contract ...")
29- var helloWorld: org.web3j.generated.contracts. HelloWorld? = org.web3j.generated.contracts. HelloWorld.deploy(web3j, credentials, DefaultGasProvider(), "Hello Blockchain World!").send()
30- println("Contract address: " + helloWorld.getContractAddress() )
31- println("Greeting method result: " + helloWorld.greeting().send())
33+ var helloWorld: HelloWorld? = HelloWorld.deploy(web3j, credentials, DefaultGasProvider(), "Hello Blockchain World!").send()
34+ println("Contract address: " + helloWorld?.contractAddress )
35+ println("Greeting method result: " + helloWorld? .greeting()? .send())
3236 }
33- }
37+ }
0 commit comments