diff --git a/cmd/siac/main.go b/cmd/siac/main.go index 65e1ffc693fcde32eeb30b80f817e36f8a1f71c0..99a722d4ebecdbe3bf9512dc781838ad18df297d 100644 --- a/cmd/siac/main.go +++ b/cmd/siac/main.go @@ -141,8 +141,8 @@ func main() { } // initialize client root.PersistentFlags().StringVarP(&httpClient.Address, "addr", "a", "localhost:9980", "which host/port to communicate with (i.e. the host/port siad is listening on)") - root.PersistentFlags().StringVarP(&httpClient.Password, "apipassword", "x", apiPassword, "the password for the API's http authentication") - root.PersistentFlags().StringVarP(&httpClient.UserAgent, "useragent", "u", "Sia-Agent", "the useragent used by siac to connect to the daemon's API") + root.PersistentFlags().StringVarP(&httpClient.Password, "apipassword", "", apiPassword, "the password for the API's http authentication") + root.PersistentFlags().StringVarP(&httpClient.UserAgent, "useragent", "", "Sia-Agent", "the useragent used by siac to connect to the daemon's API") // run if err := root.Execute(); err != nil { diff --git a/cmd/siac/walletcmd.go b/cmd/siac/walletcmd.go index 6767a73b0ba442417e550cbead13d5c788aace44..3c127df400d091fbc07af512adb2f3045645e3b8 100644 --- a/cmd/siac/walletcmd.go +++ b/cmd/siac/walletcmd.go @@ -255,7 +255,7 @@ func walletinitcmd() { die(err) } } - er, err := httpClient.WalletInitPost(password, "english", initForce) + er, err := httpClient.WalletInitPost(password, initForce) if err != nil { die("Error when encrypting wallet:", err) } @@ -282,7 +282,7 @@ func walletinitseedcmd() { die(err) } } - err = httpClient.WalletInitSeedPost(seed, password, "english", initForce) + err = httpClient.WalletInitSeedPost(seed, password, initForce) if err != nil { die("Could not initialize wallet from seed:", err) } @@ -316,7 +316,7 @@ func walletloadseedcmd() { if err != nil { die("Reading password failed:", err) } - err = httpClient.WalletSeedPost(seed, password, "english") + err = httpClient.WalletSeedPost(seed, password) if err != nil { die("Could not add seed:", err) } @@ -457,7 +457,7 @@ func walletsweepcmd() { die("Reading seed failed:", err) } - swept, err := httpClient.WalletSweepPost(seed, "english") + swept, err := httpClient.WalletSweepPost(seed) if err != nil { die("Could not sweep seed:", err) } @@ -533,7 +533,7 @@ func walletunlockcmd() { password := os.Getenv("SIA_WALLET_PASSWORD") if password != "" && !initPassword { fmt.Println("Using SIA_WALLET_PASSWORD environment variable") - err := httpClient.WalletUnlockPost(password, "english") + err := httpClient.WalletUnlockPost(password) if err != nil { fmt.Println("Automatic unlock failed!") } else { @@ -545,7 +545,7 @@ func walletunlockcmd() { if err != nil { die("Reading password failed:", err) } - err = httpClient.WalletUnlockPost(password, "english") + err = httpClient.WalletUnlockPost(password) if err != nil { die("Could not unlock wallet:", err) } diff --git a/node/api/client/host.go b/node/api/client/host.go index 87ee757d079b34a1f7cc43252969cc367c4b6123..ddb9dd26c01e5dc7ae76f63b01b741ea2326fc27 100644 --- a/node/api/client/host.go +++ b/node/api/client/host.go @@ -14,7 +14,7 @@ import ( // API. It is primarily used as a helper struct to ensure type safety. type HostParam string -var ( +const ( // HostParamCollateralBudget is the collateral budget of the host in // hastings. HostParamCollateralBudget = HostParam("collateralbudget") diff --git a/node/api/client/wallet.go b/node/api/client/wallet.go index dbb96f8c314479f8181ff882a40665c22b0a89a5..754e25107037507a547468fb4df88c0a286db0f7 100644 --- a/node/api/client/wallet.go +++ b/node/api/client/wallet.go @@ -35,9 +35,8 @@ func (c *Client) WalletChangePasswordPost(currentPassword, newPassword string) ( // WalletInitPost uses the /wallet/init endpoint to initialize and encrypt a // wallet -func (c *Client) WalletInitPost(password, dictionary string, force bool) (wip api.WalletInitPOST, err error) { +func (c *Client) WalletInitPost(password string, force bool) (wip api.WalletInitPOST, err error) { values := url.Values{} - values.Set("dictionary", dictionary) values.Set("encryptionpassword", password) values.Set("force", strconv.FormatBool(force)) err = c.post("/wallet/init", values.Encode(), &wip) @@ -46,10 +45,9 @@ func (c *Client) WalletInitPost(password, dictionary string, force bool) (wip ap // WalletInitSeedPost uses the /wallet/init/seed endpoint to initialize and // encrypt a wallet using a given seed. -func (c *Client) WalletInitSeedPost(seed, password, dictionary string, force bool) (err error) { +func (c *Client) WalletInitSeedPost(seed, password string, force bool) (err error) { values := url.Values{} values.Set("seed", seed) - values.Set("dictionary", dictionary) values.Set("encryptionpassword", password) values.Set("force", strconv.FormatBool(force)) err = c.post("/wallet/init/seed", values.Encode(), nil) @@ -70,10 +68,9 @@ func (c *Client) WalletLockPost() (err error) { // WalletSeedPost uses the /wallet/seed endpoint to add a seed to the wallet's list // of seeds. -func (c *Client) WalletSeedPost(seed, password, dictionary string) (err error) { +func (c *Client) WalletSeedPost(seed, password string) (err error) { values := url.Values{} values.Set("seed", seed) - values.Set("dictionary", dictionary) values.Set("encryptionpassword", password) err = c.post("/wallet/seed", values.Encode(), nil) return @@ -131,10 +128,9 @@ func (c *Client) WalletSiagKeyPost(keyfiles, password string) (err error) { // WalletSweepPost uses the /wallet/sweep/seed endpoint to sweep a seed into // the current wallet. -func (c *Client) WalletSweepPost(seed, dictionary string) (wsp api.WalletSweepPOST, err error) { +func (c *Client) WalletSweepPost(seed string) (wsp api.WalletSweepPOST, err error) { values := url.Values{} values.Set("seed", seed) - values.Set("dictionary", dictionary) err = c.post("/wallet/sweep/seed", values.Encode(), &wsp) return } @@ -149,10 +145,9 @@ func (c *Client) WalletTransactionsGet(startHeight types.BlockHeight, endHeight // WalletUnlockPost uses the /wallet/unlock endpoint to unlock the wallet with // a given encryption key. Per default this key is the seed. -func (c *Client) WalletUnlockPost(password, dictionary string) (err error) { +func (c *Client) WalletUnlockPost(password string) (err error) { values := url.Values{} values.Set("encryptionpassword", password) - values.Set("dictionary", dictionary) err = c.post("/wallet/unlock", values.Encode(), nil) return } diff --git a/siatest/testnode.go b/siatest/testnode.go index effa8887d1fa31f6725e4f3e5e45c8a5aa8fe4ee..646608a4f13213baef5275b1b6490c99c608197d 100644 --- a/siatest/testnode.go +++ b/siatest/testnode.go @@ -58,14 +58,14 @@ func NewCleanNode(nodeParams node.NodeParams) (*TestNode, error) { tn := &TestNode{*s, *c, ""} // Init wallet - wip, err := tn.WalletInitPost("", "english", false) + wip, err := tn.WalletInitPost("", false) if err != nil { return nil, err } tn.primarySeed = wip.PrimarySeed // Unlock wallet - if err := tn.WalletUnlockPost(tn.primarySeed, "english"); err != nil { + if err := tn.WalletUnlockPost(tn.primarySeed); err != nil { return nil, err }