Skip to content

Commit

Permalink
Update lib dependency to v0.2.1 (#13)
Browse files Browse the repository at this point in the history
* Introduce `ChainID` variable for lib

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
  • Loading branch information
jmastr committed Nov 29, 2023
1 parent 3291842 commit 7bb7d98
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 16 deletions.
6 changes: 6 additions & 0 deletions cmd/ta/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
23 changes: 13 additions & 10 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
}
}

Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down

0 comments on commit 7bb7d98

Please sign in to comment.