Skip to content

Commit

Permalink
fix: add nft id validation to MsgSendNFT (#1287)
Browse files Browse the repository at this point in the history
* add nft id validation

* Update CHANGELOG
  • Loading branch information
ulbqb authored Mar 19, 2024
1 parent 4fffc23 commit 5636259
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (x/crisis) [#1167](https://github.com/Finschia/finschia-sdk/pull/1167) Use `CacheContext()` in `AssertInvariants()`
* (chore) [\#1168](https://github.com/Finschia/finschia-sdk/pull/1168) Replace `ExactArgs(0)` with `NoArgs()` in `x/upgrade` module
* (server) [\#1175](https://github.com/Finschia/finschia-sdk/pull/1175) Use go embed for swagger
* (x/collection) [\#1287](https://github.com/Finschia/finschia-sdk/pull/1287) add nft id validation to MsgSendNFT

### Bug Fixes
* chore(deps) [\#1141](https://github.com/Finschia/finschia-sdk/pull/1141) Bump github.com/cosmos/ledger-cosmos-go from 0.12.2 to 0.13.2 to fix ledger signing issue
Expand Down
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 5636259

Please sign in to comment.