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

feat!: update Denom regex to support more DID characters #9699

Merged
merged 11 commits into from
Sep 27, 2021
4 changes: 2 additions & 2 deletions types/coin.go
Original file line number Diff line number Diff line change
Expand Up @@ -633,8 +633,8 @@ func (coins Coins) Sort() Coins {

var (
// Denominations can be 3 ~ 128 characters long and support letters, followed by either
// a letter, a number or a separator ('/').
reDnmString = `[a-zA-Z][a-zA-Z0-9/-]{2,127}`
// a letter, a number or a separator ('/', ':', '.', '_' or '-').
reDnmString = `[a-zA-Z][a-zA-Z0-9/:._-]{2,127}`
reDecAmt = `[[:digit:]]+(?:\.[[:digit:]]+)?|\.[[:digit:]]+`
reSpc = `[[:space:]]*`
reDnm *regexp.Regexp
Expand Down
1 change: 1 addition & 0 deletions types/coin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ func (s *coinTestSuite) TestCoinIsValid() {
{sdk.Coin{loremIpsum, sdk.OneInt()}, false},
{sdk.Coin{"ibc/7F1D3FCF4AE79E1554D670D1AD949A9BA4E4A3C76C63093E17E446A46061A7A2", sdk.OneInt()}, true},
{sdk.Coin{"atOm", sdk.OneInt()}, true},
{sdk.Coin{"x:y-z.1_2", sdk.OneInt()}, true},
{sdk.Coin{" ", sdk.OneInt()}, false},
}

Expand Down