From a3bae3260f5f99ad89f45449bb88cc6976ba2be7 Mon Sep 17 00:00:00 2001 From: linhpn99 Date: Mon, 22 Jul 2024 21:38:07 +0700 Subject: [PATCH 1/2] use error correctly --- gno.land/pkg/sdk/vm/msgs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gno.land/pkg/sdk/vm/msgs.go b/gno.land/pkg/sdk/vm/msgs.go index e5616fa2395..c7dcf3da4aa 100644 --- a/gno.land/pkg/sdk/vm/msgs.go +++ b/gno.land/pkg/sdk/vm/msgs.go @@ -57,7 +57,7 @@ func (msg MsgAddPackage) ValidateBasic() error { return ErrInvalidPkgPath("missing package path") } if !msg.Deposit.IsValid() { - return std.ErrTxDecode("invalid deposit") + return std.ErrInvalidCoins("invalid deposit") } // XXX validate files. return nil From ff3ad2350f15e897488baa4cbf2ea261695a2899 Mon Sep 17 00:00:00 2001 From: linhpn99 Date: Fri, 26 Jul 2024 08:28:54 +0700 Subject: [PATCH 2/2] change to amt.String() --- gno.land/pkg/sdk/vm/msgs.go | 2 +- tm2/pkg/sdk/bank/msgs.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gno.land/pkg/sdk/vm/msgs.go b/gno.land/pkg/sdk/vm/msgs.go index c7dcf3da4aa..d650c23f382 100644 --- a/gno.land/pkg/sdk/vm/msgs.go +++ b/gno.land/pkg/sdk/vm/msgs.go @@ -57,7 +57,7 @@ func (msg MsgAddPackage) ValidateBasic() error { return ErrInvalidPkgPath("missing package path") } if !msg.Deposit.IsValid() { - return std.ErrInvalidCoins("invalid deposit") + return std.ErrInvalidCoins(msg.Deposit.String()) } // XXX validate files. return nil diff --git a/tm2/pkg/sdk/bank/msgs.go b/tm2/pkg/sdk/bank/msgs.go index d87656b8b7b..378af29f544 100644 --- a/tm2/pkg/sdk/bank/msgs.go +++ b/tm2/pkg/sdk/bank/msgs.go @@ -39,7 +39,7 @@ func (msg MsgSend) ValidateBasic() error { return std.ErrInvalidAddress("missing recipient address") } if !msg.Amount.IsValid() { - return std.ErrInvalidCoins("send amount is invalid: " + msg.Amount.String()) + return std.ErrInvalidCoins(msg.Amount.String()) } if !msg.Amount.IsAllPositive() { return std.ErrInsufficientCoins("send amount must be positive")