Skip to content

Commit

Permalink
add nft id validation
Browse files Browse the repository at this point in the history
  • Loading branch information
ulbqb committed Mar 18, 2024
1 parent 3e087f8 commit 10af857
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion x/collection/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
7 changes: 7 additions & 0 deletions x/collection/msgs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 10af857

Please sign in to comment.