Skip to content

Add convert to coin method to Token #6581

@gjermundgaraba

Description

@gjermundgaraba

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)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions