refactor: took hardcoded fields to config
This commit is contained in:
parent
fddc67b40d
commit
b931a8ac18
3 changed files with 12 additions and 5 deletions
|
@ -1,5 +1,7 @@
|
|||
{
|
||||
"ContractCheckSum": "none",
|
||||
"AuthServerPort": 9096,
|
||||
"WalletFile": "none"
|
||||
"WalletFile": "none",
|
||||
"EndpointUrl": "url",
|
||||
"AccountSecret": "one"
|
||||
}
|
|
@ -13,6 +13,8 @@ type Config struct {
|
|||
ContractCheckSum string `json:"ContractCheckSum"`
|
||||
AuthServerPort int `json:"AuthServerPort"`
|
||||
WalletFile string `json:"WalletFile"`
|
||||
EndpointUrl string `json:"EndpointUrl"`
|
||||
AccountSecret string `json:"AccountSecret"`
|
||||
}
|
||||
|
||||
func LoadConfig(pathToJsonConfig string) (Config, error) {
|
||||
|
|
|
@ -37,14 +37,17 @@ func main() {
|
|||
// contract integration
|
||||
fileWallet, _ := wallet.NewWalletFromFile(config.WalletFile)
|
||||
acc := fileWallet.Accounts[0]
|
||||
// FIXME: account password should be in the config
|
||||
if err := acc.Decrypt("one", keys.NEP2ScryptParams()); err != nil {
|
||||
// FIXME: account password should be in the config: FIXED
|
||||
// FIXME: Idk which password and url we should use
|
||||
if err := acc.Decrypt(config.AccountSecret, keys.NEP2ScryptParams()); err != nil {
|
||||
log.Fatal("Wallet decryption failed")
|
||||
}
|
||||
defer fileWallet.Close()
|
||||
|
||||
// FIXME: endpoint url should be in the config
|
||||
rpcClient, _ := rpcclient.New(context.Background(), "url", rpcclient.Options{})
|
||||
// FIXME: endpoint url should be in the config FIXED
|
||||
// FIXME: Idk which password and url we should use
|
||||
// In idea we need an rpc-server(?)
|
||||
rpcClient, _ := rpcclient.New(context.Background(), config.EndpointUrl, rpcclient.Options{})
|
||||
rpcActor, _ := actor.NewSimple(rpcClient, fileWallet.Accounts[0])
|
||||
|
||||
// smart contract check sum
|
||||
|
|
Loading…
Reference in a new issue