-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from bandprotocol/tss-support-request-feeds-sig…
…nature [TSS] Implement to support request feeds signature
- Loading branch information
Showing
22 changed files
with
584 additions
and
276 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package main | ||
|
||
import ( | ||
"os" | ||
"time" | ||
|
||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/spf13/viper" | ||
) | ||
|
||
type ChainConfig struct { | ||
ChainID string `yaml:"chain_id" mapstructure:"chain_id"` | ||
RPC string `yaml:"rpc" mapstructure:"rpc"` | ||
Fee string `yaml:"fee" mapstructure:"fee"` | ||
Timeout time.Duration `yaml:"timeout" mapstructure:"timeout"` | ||
} | ||
|
||
type RequestConfig struct { | ||
OracleScriptID int `yaml:"oracle_script_id" mapstructure:"oracle_script_id"` | ||
Calldata string `yaml:"calldata" mapstructure:"calldata"` | ||
Mnemonic string `yaml:"mnemonic" mapstructure:"mnemonic"` | ||
} | ||
|
||
type Config struct { | ||
Chain ChainConfig `yaml:"chain" mapstructure:"chain"` | ||
Request RequestConfig `yaml:"request" mapstructure:"request"` | ||
LogLevel string `yaml:"log_level" mapstructure:"log_level"` | ||
SDK *sdk.Config | ||
} | ||
|
||
func GetConfig(name string) (Config, error) { | ||
viper.SetConfigType("yaml") | ||
viper.SetConfigName(name) | ||
viper.AddConfigPath("./requester/configs") | ||
|
||
if err := viper.ReadInConfig(); err != nil { | ||
return Config{}, err | ||
} | ||
|
||
var config Config | ||
if err := viper.Unmarshal(&config); err != nil { | ||
return Config{}, err | ||
} | ||
|
||
config.SDK = sdk.GetConfig() | ||
|
||
return config, nil | ||
} | ||
|
||
func GetEnv(key, fallback string) string { | ||
if value, ok := os.LookupEnv(key); ok { | ||
return value | ||
} | ||
return fallback | ||
} |
Oops, something went wrong.