Skip to content

Commit 0150f01

Browse files
Merge pull request #62 from okbg/master
Fix broken Kotlin template
2 parents 6eb7f9e + a3e1ea0 commit 0150f01

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/main/resources/project/Kotlin.template

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
package <package_name>;
22

3+
import org.web3j.crypto.Credentials
34
import org.web3j.crypto.WalletUtils
5+
import org.web3j.protocol.http.HttpService
46
import org.web3j.protocol.Web3j
57
import 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

Comments
 (0)