Skip to content

Make a more ergonomic way of creating simple sdk.Coins #10332

Open
@ValarDragon

Description

Summary

Often due to compatibility issues, you have to make an SDK.Coins from a single Sdk.Coin, specified by raw parameters. This is especially true within tests. At the moment, the most common ways to do this that I'm aware of are:

myCoins := sdk.Coins{sdk.NewInt64Coin(myDenom, 1000)}
myCoins := sdk.NewCoins(sdk.NewInt64Coin(myDenom, 1000)
myCoins := sdk.NewCoins(sdk.NewCoin(myDenom, sdk.NewInt(1000))

At least in Osmosis, such lines are all over the codebase. They're long, and lots of boilerplate. Can we make a more ergonomic way to do this? Perhaps:

sdk.NewInt64Coins(denoms..., ints...)
sdk.NewInt64Coins(myDenom, 1000)

For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions