Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add convert to coin method to Token #6581

Closed
gjermundgaraba opened this issue Jun 12, 2024 · 2 comments · Fixed by #6584
Closed

Add convert to coin method to Token #6581

gjermundgaraba opened this issue Jun 12, 2024 · 2 comments · Fixed by #6584
Assignees
Labels
20-transfer type: feature New features, sub-features or integrations

Comments

@gjermundgaraba
Copy link
Contributor

There are multiple places where we do this type of conversation of a Token:

transferAmount, ok := sdkmath.NewIntFromString(token.Amount)
if !ok {
    return errorsmod.Wrapf(types.ErrInvalidAmount, "unable to parse transfer amount (%s) into math.Int", transferAmount)
}
coin := sdk.NewCoin(token.Denom.IBCDenom(), transferAmount)

Suggestion is to create a convenience method on Token to convert it to Coin. Something like this perhaps:

func (t Token) ToCoin() (Coin, error)
@gjermundgaraba gjermundgaraba added 20-transfer type: feature New features, sub-features or integrations labels Jun 12, 2024
@duonghb53
Copy link
Contributor

Can I get to resolve this one?

@DimitrisJim
Copy link
Contributor

sure can @duonghb53, thanks!

@DimitrisJim DimitrisJim moved this to Todo 🏃 in ibc-go Jun 12, 2024
@github-project-automation github-project-automation bot moved this from Todo 🏃 to Done 🥳 in ibc-go Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
20-transfer type: feature New features, sub-features or integrations
Projects
No open projects
Status: Done 🥳
Development

Successfully merging a pull request may close this issue.

3 participants