cosmos / b9-checkers-academy-draft

32 stars 41 forks source link

banktypes.NewSupply not declared by package #31

Closed stevenferrer closed 2 years ago

stevenferrer commented 2 years ago

Hi hi, I'd like to first thank the Cosmos team for creating such a wonderful learning resource like this. It's such a great help for understanding the Cosmos ecosystem.

As for my issue, I'm currently in the game wager part of the cosmos tutorial but I encountered a minor issue where banktypes.NewSupply is not declared by the bank module types.

I'm using Cosmos SDK v0.45.4 but the tutorial is still using v0.42.6 so I assume that something has changed between the two versions.

func getBankGenesis() *banktypes.GenesisState {
    ...
    supply := banktypes.NewSupply(coins[0].Coins.Add(coins[1].Coins...).Add(coins[2].Coins...))

    ...
}

I'd appreciate any pointer that you could give so I can proceed with the rest of the cosmos tutorial. Thank you!

xavierlepretre commented 2 years ago

I wonder if this will just work:

supply := &banktypes.Supply({ Total: coins[0].Coins.Add(coins[1].Coins...).Add(coins[2].Coins...) })

Thank you for the kind words.

stevenferrer commented 2 years ago

Hi @xavierlepretre,

I can confirm that your suggestion worked. I also had to update the tests due to some change in the event count emitted.

image

After updating it, all the tests are now passing. Thanks a lot for your help! I'm closing this issue now.