31 lines
667 B
Go
31 lines
667 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
|
|
"github.com/FISCO-BCOS/go-sdk/client"
|
|
"github.com/FISCO-BCOS/go-sdk/conf"
|
|
table "github.com/sulenn/trustie-fisco-bcos/contract" // import tabletest
|
|
)
|
|
|
|
func main() {
|
|
configs, err := conf.ParseConfigFile("config.toml")
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
config := &configs[0]
|
|
|
|
client, err := client.Dial(config)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
address, tx, instance, err := table.DeployOpenSource(client.GetTransactOpts(), client)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
fmt.Println("contract address: ", address.Hex()) // the address should be saved
|
|
fmt.Println("transaction hash: ", tx.Hash().Hex())
|
|
_ = instance
|
|
}
|