diff --git a/cmd/ta/main.go b/cmd/ta/main.go index 0e77485..97e002e 100644 --- a/cmd/ta/main.go +++ b/cmd/ta/main.go @@ -258,6 +258,12 @@ func main() { log.Fatalf("fatal error config file: %s", err) } + planetmintChainID := config.GetString("PLANETMINT_CHAIN_ID") + if planetmintChainID == "" { + log.Fatalf("chain id must not be empty") + } + libConfig.SetChainID(planetmintChainID) + planetmintAddress = config.GetString("PLANETMINT_ACTOR") if err != nil || planetmintAddress == "" { panic("couldn't read configuration") diff --git a/config/config.go b/config/config.go index 0aa6308..3775357 100644 --- a/config/config.go +++ b/config/config.go @@ -6,17 +6,19 @@ const DefaultConfigTemplate = ` FIRMWARE_ESP32={{ .FirmwareESP32 }} FIRMWARE_ESP32C3={{ .FirmwareESP32C3 }} PLANETMINT_ACTOR={{ .PlanetmintActor }} +PLANETMINT_CHAIN_ID={{ .PlanetmintChainID }} SERVICE_BIND={{ .ServiceBind }} SERVICE_PORT={{ .ServicePort }} ` // Config defines TA's top level configuration type Config struct { - FirmwareESP32 string `json:"firmware-esp32" mapstructure:"firmware-esp32"` - FirmwareESP32C3 string `json:"firmware-esp32-c3" mapstructure:"firmware-esp32-c3"` - PlanetmintActor string `json:"planetmint-actor" mapstructure:"planetmint-actor"` - ServiceBind string `json:"service-bind" mapstructure:"service-bind"` - ServicePort int `json:"service-port" mapstructure:"service-port"` + FirmwareESP32 string `json:"firmware-esp32" mapstructure:"firmware-esp32"` + FirmwareESP32C3 string `json:"firmware-esp32-c3" mapstructure:"firmware-esp32-c3"` + PlanetmintActor string `json:"planetmint-actor" mapstructure:"planetmint-actor"` + PlanetmintChainID string `json:"planetmint-chain-id" mapstructure:"planetmint-chain-id"` + ServiceBind string `json:"service-bind" mapstructure:"service-bind"` + ServicePort int `json:"service-port" mapstructure:"service-port"` } // global singleton @@ -28,11 +30,12 @@ var ( // DefaultConfig returns TA's default configuration. func DefaultConfig() *Config { return &Config{ - FirmwareESP32: "./tasmota32-rddl.bin", - FirmwareESP32C3: "./tasmota32c3-rddl.bin", - PlanetmintActor: "plmnt15xuq0yfxtd70l7jzr5hg722sxzcqqdcr8ptpl5", - ServiceBind: "localhost", - ServicePort: 8080, + FirmwareESP32: "./tasmota32-rddl.bin", + FirmwareESP32C3: "./tasmota32c3-rddl.bin", + PlanetmintActor: "plmnt15xuq0yfxtd70l7jzr5hg722sxzcqqdcr8ptpl5", + PlanetmintChainID: "planetmint-testnet-1", + ServiceBind: "localhost", + ServicePort: 8080, } } diff --git a/go.mod b/go.mod index be63a76..43d9180 100644 --- a/go.mod +++ b/go.mod @@ -7,8 +7,8 @@ require ( github.com/cosmos/cosmos-sdk v0.47.5 github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 github.com/gin-gonic/gin v1.9.1 - github.com/planetmint/planetmint-go v0.6.4 - github.com/planetmint/planetmint-go/lib v0.2.0 + github.com/planetmint/planetmint-go v0.6.5 + github.com/planetmint/planetmint-go/lib v0.2.1 github.com/spf13/viper v1.16.0 ) diff --git a/go.sum b/go.sum index e1ddb68..b5f2141 100644 --- a/go.sum +++ b/go.sum @@ -875,10 +875,10 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= -github.com/planetmint/planetmint-go v0.6.4 h1:HoIBoUGrO/izybe5DA7FNtrU/wSu5DjDbRl9/Zp1uGY= -github.com/planetmint/planetmint-go v0.6.4/go.mod h1:DaTMKwaP1MIHF3KtUK3CgBAtjZm2N9MKkBFXWqd2dII= -github.com/planetmint/planetmint-go/lib v0.2.0 h1:dPumX0eGTuUT/aNpyRbpP9UGhM+ebAG+hVzVMP8UWPM= -github.com/planetmint/planetmint-go/lib v0.2.0/go.mod h1:7q34N3wepZr8DPqkft7orZ+RJLBRVwGLcDb43MzkEQM= +github.com/planetmint/planetmint-go v0.6.5 h1:a0sfWdFzuJM5mQZ6EmcAcBzgKyx/+D8gLQNwSVdJS+Y= +github.com/planetmint/planetmint-go v0.6.5/go.mod h1:JvqNW5EOWPoKqMHPemxIB+g/F9/UL5wUMqu8DFCuvpA= +github.com/planetmint/planetmint-go/lib v0.2.1 h1:hfaZWxQMVzFovEOXcWax0HGMnDgBn6WoEZG0OEC6VRg= +github.com/planetmint/planetmint-go/lib v0.2.1/go.mod h1:7q34N3wepZr8DPqkft7orZ+RJLBRVwGLcDb43MzkEQM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=