Skip to content

Commit

Permalink
fix: replace query errors on the original modules into gRPC ones (Fin…
Browse files Browse the repository at this point in the history
…schia#956)

* Override x/collection query errors with gRPC ones

* Update CHANGELOG.md

* Override x/token query errors with gRPC ones

* Differentiate FTClass and NFTClass

* Update x/collection query unit tests

* Update x/token query unit tests

* Fix integration tests

* Use specific function names
  • Loading branch information
0Tech authored Apr 8, 2023
1 parent d562b43 commit 0c74e6f
Show file tree
Hide file tree
Showing 13 changed files with 396 additions and 68 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Breaking Changes
* (proto) [\#923](https://github.com/line/lbm-sdk/pull/923) deprecate broadcast mode `block`
* (x/collection,token) [\#956](https://github.com/line/lbm-sdk/pull/956) Replace query errors on the original modules into gRPC ones

### Build, CI
* (ci, build) [\#901](https://github.com/line/lbm-sdk/pull/901) Update release pipeline to match non-wasm env
Expand Down
4 changes: 2 additions & 2 deletions simapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,8 @@ func NewSimApp(
upgrade.NewAppModule(app.UpgradeKeeper),
evidence.NewAppModule(app.EvidenceKeeper),
params.NewAppModule(app.ParamsKeeper),
tokenmodule.NewAppModule(appCodec, app.TokenKeeper),
collectionmodule.NewAppModule(appCodec, app.CollectionKeeper),
tokenmodule.NewAppModule(appCodec, app.TokenKeeper, app.AccountKeeper),
collectionmodule.NewAppModule(appCodec, app.CollectionKeeper, app.AccountKeeper),
authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
)

Expand Down
24 changes: 12 additions & 12 deletions x/collection/client/testutil/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,17 +326,17 @@ func (s *IntegrationTestSuite) TestNewQueryCmdNFTSupply() {
"valid query": {
[]string{
s.contractID,
s.ftClassID,
s.nftClassID,
},
true,
&collection.QueryNFTSupplyResponse{
Supply: s.balance.Mul(sdk.NewInt(4)),
Supply: sdk.NewInt(24),
},
},
"extra args": {
[]string{
s.contractID,
s.ftClassID,
s.nftClassID,
"extra",
},
false,
Expand All @@ -352,7 +352,7 @@ func (s *IntegrationTestSuite) TestNewQueryCmdNFTSupply() {
"invalid contract id": {
[]string{
"",
s.ftClassID,
s.nftClassID,
},
false,
nil,
Expand Down Expand Up @@ -401,17 +401,17 @@ func (s *IntegrationTestSuite) TestNewQueryCmdNFTMinted() {
"valid query": {
[]string{
s.contractID,
s.ftClassID,
s.nftClassID,
},
true,
&collection.QueryNFTMintedResponse{
Minted: s.balance.Mul(sdk.NewInt(5)),
Minted: sdk.NewInt(24),
},
},
"extra args": {
[]string{
s.contractID,
s.ftClassID,
s.nftClassID,
"extra",
},
false,
Expand All @@ -427,7 +427,7 @@ func (s *IntegrationTestSuite) TestNewQueryCmdNFTMinted() {
"invalid contract id": {
[]string{
"",
s.ftClassID,
s.nftClassID,
},
false,
nil,
Expand Down Expand Up @@ -476,17 +476,17 @@ func (s *IntegrationTestSuite) TestNewQueryCmdNFTBurnt() {
"valid query": {
[]string{
s.contractID,
s.ftClassID,
s.nftClassID,
},
true,
&collection.QueryNFTBurntResponse{
Burnt: s.balance,
Burnt: sdk.ZeroInt(),
},
},
"extra args": {
[]string{
s.contractID,
s.ftClassID,
s.nftClassID,
"extra",
},
false,
Expand All @@ -502,7 +502,7 @@ func (s *IntegrationTestSuite) TestNewQueryCmdNFTBurnt() {
"invalid contract id": {
[]string{
"",
s.ftClassID,
s.nftClassID,
},
false,
nil,
Expand Down
4 changes: 4 additions & 0 deletions x/collection/expected_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ type (
NewID(ctx sdk.Context) string
HasID(ctx sdk.Context, id string) bool
}

AuthKeeper interface {
HasAccount(sdk.Context, sdk.AccAddress) bool
}
)
Loading

0 comments on commit 0c74e6f

Please sign in to comment.