[#995] neofs-adm: implement deposit-notary command

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2021-11-30 14:57:58 +03:00 committed by Alex Vanin
parent fba8890224
commit 40b51b3586
5 changed files with 201 additions and 32 deletions

View file

@ -156,12 +156,9 @@ func refillGas(cmd *cobra.Command, gasFlag string, createWallet bool) error {
gasStr := viper.GetString(gasFlag)
gasAmount, err := fixedn.Fixed8FromString(gasStr)
gasAmount, err := parseGASAmount(gasStr)
if err != nil {
return fmt.Errorf("invalid GAS amount %s: %w", gasStr, err)
}
if gasAmount <= 0 {
return fmt.Errorf("GAS amount must be positive (got %d)", gasAmount)
return err
}
wCtx, err := newInitializeContext(cmd, viper.GetViper())
@ -184,3 +181,14 @@ func refillGas(cmd *cobra.Command, gasFlag string, createWallet bool) error {
return wCtx.awaitTx()
}
func parseGASAmount(s string) (fixedn.Fixed8, error) {
gasAmount, err := fixedn.Fixed8FromString(s)
if err != nil {
return 0, fmt.Errorf("invalid GAS amount %s: %w", s, err)
}
if gasAmount <= 0 {
return 0, fmt.Errorf("GAS amount must be positive (got %d)", gasAmount)
}
return gasAmount, nil
}