@@ -23,6 +23,20 @@ func (suite *KeeperTestSuite) TestAdminMsgs() {
2323 suite .Require ().NoError (err )
2424 suite .Require ().Equal (suite .TestAccs [0 ].String (), queryRes .AuthorityMetadata .Admin )
2525
26+ // Test getting denoms from admin
27+ adminRes , err := suite .queryClient .DenomsFromAdmin (suite .Ctx .Context (), & types.QueryDenomsFromAdminRequest {
28+ Admin : suite .TestAccs [0 ].String (),
29+ })
30+ suite .Require ().NoError (err )
31+ suite .Require ().Equal ([]string {suite .defaultDenom }, adminRes .Denoms )
32+
33+ // Veriry that the other account has no denoms
34+ adminRes , err = suite .queryClient .DenomsFromAdmin (suite .Ctx .Context (), & types.QueryDenomsFromAdminRequest {
35+ Admin : suite .TestAccs [1 ].String (),
36+ })
37+ suite .Require ().NoError (err )
38+ suite .Require ().Nil (adminRes .Denoms )
39+
2640 // Test minting to admins own account
2741 _ , err = suite .msgServer .Mint (suite .Ctx , types .NewMsgMint (suite .TestAccs [0 ].String (), sdk .NewInt64Coin (suite .defaultDenom , 10 )))
2842 addr0bal += 10
@@ -57,6 +71,20 @@ func (suite *KeeperTestSuite) TestAdminMsgs() {
5771 suite .Require ().NoError (err )
5872 suite .Require ().Equal (suite .TestAccs [1 ].String (), queryRes .AuthorityMetadata .Admin )
5973
74+ // Test query from admin returns the correct denoms. The old admin should have no denoms
75+ adminRes , err = suite .queryClient .DenomsFromAdmin (suite .Ctx .Context (), & types.QueryDenomsFromAdminRequest {
76+ Admin : suite .TestAccs [0 ].String (),
77+ })
78+ suite .Require ().NoError (err )
79+ suite .Require ().Nil (adminRes .Denoms )
80+
81+ // The new admin should have the default denom
82+ adminRes , err = suite .queryClient .DenomsFromAdmin (suite .Ctx .Context (), & types.QueryDenomsFromAdminRequest {
83+ Admin : suite .TestAccs [1 ].String (),
84+ })
85+ suite .Require ().NoError (err )
86+ suite .Require ().Equal ([]string {suite .defaultDenom }, adminRes .Denoms )
87+
6088 // Make sure old admin can no longer do actions
6189 _ , err = suite .msgServer .Burn (suite .Ctx , types .NewMsgBurn (suite .TestAccs [0 ].String (), sdk .NewInt64Coin (suite .defaultDenom , 5 )))
6290 suite .Require ().Error (err )
@@ -75,6 +103,26 @@ func (suite *KeeperTestSuite) TestAdminMsgs() {
75103 })
76104 suite .Require ().NoError (err )
77105 suite .Require ().Equal ("" , queryRes .AuthorityMetadata .Admin )
106+
107+ // Make sure retrieving denoms by admin works with empty admin
108+ adminRes , err = suite .queryClient .DenomsFromAdmin (suite .Ctx .Context (), & types.QueryDenomsFromAdminRequest {
109+ Admin : "" ,
110+ })
111+ suite .Require ().NoError (err )
112+ suite .Require ().Equal ([]string {suite .defaultDenom }, adminRes .Denoms )
113+
114+ // Make sure the other accounts are not admins
115+ adminRes , err = suite .queryClient .DenomsFromAdmin (suite .Ctx .Context (), & types.QueryDenomsFromAdminRequest {
116+ Admin : suite .TestAccs [0 ].String (),
117+ })
118+ suite .Require ().NoError (err )
119+ suite .Require ().Nil (adminRes .Denoms )
120+
121+ adminRes , err = suite .queryClient .DenomsFromAdmin (suite .Ctx .Context (), & types.QueryDenomsFromAdminRequest {
122+ Admin : suite .TestAccs [1 ].String (),
123+ })
124+ suite .Require ().NoError (err )
125+ suite .Require ().Nil (adminRes .Denoms )
78126}
79127
80128// TestMintDenom ensures the following properties of the MintMessage:
0 commit comments