From ecf227e1eebf9ec8db59a18574006fe04b350bbc Mon Sep 17 00:00:00 2001 From: Shogo Hyodo Date: Mon, 18 Mar 2024 15:48:35 +0900 Subject: [PATCH] add nft id validation --- x/collection/msgs.go | 2 +- x/collection/msgs_test.go | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/x/collection/msgs.go b/x/collection/msgs.go index 71f3c2ec9e..4c416335f0 100644 --- a/x/collection/msgs.go +++ b/x/collection/msgs.go @@ -340,7 +340,7 @@ func (m MsgSendNFT) ValidateBasic() error { return ErrEmptyField.Wrap("token ids cannot be empty") } for _, id := range m.TokenIds { - if err := ValidateTokenID(id); err != nil { + if err := ValidateNFTID(id); err != nil { return err } } diff --git a/x/collection/msgs_test.go b/x/collection/msgs_test.go index 9f8ebba60d..236629d1ab 100644 --- a/x/collection/msgs_test.go +++ b/x/collection/msgs_test.go @@ -259,6 +259,13 @@ func TestMsgSendNFT(t *testing.T) { ids: []string{""}, err: collection.ErrInvalidTokenID, }, + "FT ids": { + contractID: "deadbeef", + from: addrs[0], + to: addrs[1], + ids: []string{collection.NewFTID("deadbeef")}, + err: sdkerrors.ErrInvalidRequest.Wrapf("invalid id: %s", collection.NewFTID("deadbeef")), + }, } for name, tc := range testCases {