Skip to content

Commit

Permalink
fix: fix missing account number of account creation (#1250)
Browse files Browse the repository at this point in the history
## Description

Closes: #XXXX
This PR fixes the issue that account has no account number since using
`authtypes.NewBaseAccountWithAddress`. To solve it, we should use
`AccountKeeper.NewAccountWithAddress` instead, to make sure account
number is set.

<!-- Add a description of the changes that this PR introduces and the
files that
are the most critical to review. -->

---

### Author Checklist

*All items are required. Please add a note to the item if the item is
not applicable and
please add links to any relevant follow up issues.*

I have...

- [x] included the correct [type
prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json)
in the PR title
- [ ] added `!` to the type prefix if API or client breaking change
- [x] targeted the correct branch (see [PR
Targeting](https://github.com/desmos-labs/desmos/blob/master/CONTRIBUTING.md#pr-targeting))
- [ ] provided a link to the relevant issue or specification
- [ ] followed the guidelines for [building
modules](https://docs.cosmos.network/v0.44/building-modules/intro.html)
- [ ] included the necessary unit and integration
[tests](https://github.com/desmos-labs/desmos/blob/master/CONTRIBUTING.md#testing)
- [ ] added a changelog entry to `CHANGELOG.md`
- [ ] included comments for [documenting Go
code](https://blog.golang.org/godoc)
- [ ] updated the relevant documentation or specification
- [x] reviewed "Files changed" and left comments if necessary
- [ ] confirmed all CI checks have passed

### Reviewers Checklist

*All items are required. Please add a note if the item is not applicable
and please add
your handle next to the items reviewed if you only reviewed selected
items.*

I have...

- [ ] confirmed the correct [type
prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json)
in the PR title
- [ ] confirmed `!` in the type prefix if API or client breaking change
- [ ] confirmed all author checklist items have been addressed
- [ ] reviewed state machine logic
- [ ] reviewed API design and naming
- [ ] reviewed documentation is accurate
- [ ] reviewed tests and test coverage
- [ ] manually tested (if applicable)
  • Loading branch information
dadamu authored Sep 28, 2023
1 parent 31b1fa7 commit d56fbd9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
type: fix
module: x/profiles
pull_request: 1250
description: Fix missing account number of account creation
backward_compatible: true
date: 2023-09-28T08:12:05.365508338Z
3 changes: 1 addition & 2 deletions x/profiles/keeper/msg_server_dtag_transfers.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"

"github.com/desmos-labs/desmos/v6/x/profiles/types"
)
Expand Down Expand Up @@ -154,7 +153,7 @@ func (k MsgServer) AcceptDTagTransferRequest(goCtx context.Context, msg *types.M

senderAcc := k.ak.GetAccount(ctx, add)
if senderAcc == nil {
senderAcc = authtypes.NewBaseAccountWithAddress(add)
senderAcc = k.ak.NewAccountWithAddress(ctx, add)
}

receiverProfile, err = types.NewProfileFromAccount(dTagToTrade, senderAcc, ctx.BlockTime())
Expand Down

0 comments on commit d56fbd9

Please sign in to comment.