Reputation: 1
I am using the sdk coins module, and anytime I try to mint a coin with a symbol in it that is uppercase, it fails and gives me an invalid tx error. I was hoping you might be able to shed some light on why this might be. Here is the link to the cosmos sdk code around where everything blows up. I'm looking at the sdk code, and it seems like the regex should allow capital and lowercase letter symbols https://github.com/cosmos/cosmos-sdk/blob/a6c3c5d0909cc5ab0426129503d8585c3af430ce/types/coin.go#L601
We are able to call a function before we mint coins to accept uppercase regex, however this is not configurable at the blockchain level and causes issues because we have many places in the codebase where we mint and burn coins. This should be configurable at the blockchain level so we don't have to set the regex string anytime we want to mint and burn coins on cosmos.
Upvotes: 0
Views: 259
Reputation: 795
You can set a custom validation rule in the command binary like seen here:
func main() {
cdc := app.MakeCodec()
sdk.CoinDenomRegex = func() string {
return validation.ReDnmString
}
This example imports RegEx rules from an external file here that only allows default rules plus all emojis.
The exact format might have been updated with this PR, but the concept should be the same by overwriting the default regex in /cmd/{binary}/main.go
.
Upvotes: 1