@@ -5,6 +5,7 @@ import { identity, includes } from 'lodash';
5import { isValidAddress, ETH_ZERO_ADDR, ETH_ZERO_ADDR_SHORT } from './wallet';
5import { isValidAddress, ETH_ZERO_ADDR, ETH_ZERO_ADDR_SHORT } from './wallet';
6import patp2dec from './patp2dec';
6import patp2dec from './patp2dec';
7import { patpStringLength } from './lib';
7import { patpStringLength } from './lib';
8+import { MIN_GALAXY, MAX_GALAXY } from './constants';
9// NOTE: do not use the /g modifier for these regexes
10// NOTE: do not use the /g modifier for these regexes
10// https://stackoverflow.com/a/21373261
11// https://stackoverflow.com/a/21373261
@@ -90,12 +91,12 @@ export const validateGalaxy = m =>
90 let point;
91 let point;
92 point = patp2dec(d);
93 point = patp2dec(d);
93− return point >= 0 && point < 256;
94+ return point >= MIN_GALAXY && point <= MAX_GALAXY;
94 } catch (e) {
95 } catch (e) {
95 return false;
96 return false;
98− error: 'This is not a valid galaxy',
99+ error: 'This is not a valid galaxy.',
101export const validatePoint = m =>
102export const validatePoint = m =>
@@ -108,7 +109,7 @@ export const validatePoint = m =>
108 return false;
109 return false;
111− error: 'This is not a valid point',
112+ error: 'This is not a valid point.',
114export const validateTicket = m =>
115export const validateTicket = m =>
@@ -121,7 +122,7 @@ export const validateTicket = m =>
121 return false;
122 return false;
124− error: 'This is not a valid ticket',
125+ error: 'This is not a valid ticket.',
127export const validateShard = m =>
128export const validateShard = m =>
@@ -134,7 +135,7 @@ export const validateShard = m =>
134 return false;
135 return false;
137− error: 'This is not a valid shard',
138+ error: 'This is not a valid shard.',
140export const validateOneOf = (options = []) => m =>
141export const validateOneOf = (options = []) => m =>
@@ -148,7 +149,7 @@ export const validateHexString = m =>
148 simpleValidatorWrapper({
149 simpleValidatorWrapper({
149 prevMessage: m,
150 prevMessage: m,
150 validator: d => isHexString.test(d),
151 validator: d => isHexString.test(d),
151− error: 'This is not a valid hex string',
152+ error: 'This is not a valid hex string.',
154// @deprecate
155// @deprecate
@@ -156,7 +157,7 @@ export const validateNetworkKey = m =>
156 simpleValidatorWrapper({
157 simpleValidatorWrapper({
157 prevMessage: m,
158 prevMessage: m,
158 validator: d => plain64CharHexValue.test(d),
159 validator: d => plain64CharHexValue.test(d),
159− error: 'This is not a valid network key',
160+ error: 'This is not a valid network key.',
162// @deprecate
163// @deprecate
@@ -164,7 +165,7 @@ export const validateNetworkSeed = m =>
164 simpleValidatorWrapper({
165 simpleValidatorWrapper({
165 prevMessage: m,
166 prevMessage: m,
166 validator: d => plain64CharHexValue.test(d),
167 validator: d => plain64CharHexValue.test(d),
167− error: 'This is not a valid network seed',
168+ error: 'This is not a valid network seed.',
170// Checks if a string is a valid ethereum address
171// Checks if a string is a valid ethereum address
@@ -172,14 +173,14 @@ export const validateEthereumAddress = m =>
172 simpleValidatorWrapper({
173 simpleValidatorWrapper({
173 prevMessage: m,
174 prevMessage: m,
174 validator: d => isValidAddress(d),
175 validator: d => isValidAddress(d),
175− error: 'This is not a valid Ethereum address',
176+ error: 'This is not a valid Ethereum address.',
178export const validateEmail = m =>
179export const validateEmail = m =>
179 simpleValidatorWrapper({
180 simpleValidatorWrapper({
180 prevMessage: m,
181 prevMessage: m,
181 validator: d => emailRegExp.test(d),
182 validator: d => emailRegExp.test(d),
182− error: 'This is not a valid email address',
183+ error: 'This is not a valid email address.',
185export const validateInt = m =>
186export const validateInt = m =>
@@ -194,7 +195,7 @@ export const validateInt = m =>
194 return false;
195 return false;
197− error: 'This is not a valid number',
198+ error: 'This is not a valid number.',
200export const validateExactly = (value, error) => m =>
201export const validateExactly = (value, error) => m =>
@@ -208,7 +209,7 @@ export const validateNotAny = (values = []) => m =>
208 simpleValidatorWrapper({
209 simpleValidatorWrapper({
209 prevMessage: m,
210 prevMessage: m,
210 validator: d => !values.includes(d),
211 validator: d => !values.includes(d),
211− error: `Cannot be ${m.data}`,
212+ error: `Cannot be ${m.data}.`,
214export const validateLength = l => m =>
215export const validateLength = l => m =>
@@ -221,7 +222,7 @@ export const validateLength = l => m =>
221 return false;
222 return false;
224− error: `Must be exactly ${l} characters`,
225+ error: `Must be exactly ${l} characters.`,
227export const validateMaximumLength = l => m =>
228export const validateMaximumLength = l => m =>
@@ -241,7 +242,7 @@ export const validateGreaterThan = l => m =>
241 simpleValidatorWrapper({
242 simpleValidatorWrapper({
242 prevMessage: m,
243 prevMessage: m,
243 validator: d => d > l,
244 validator: d => d > l,
244− error: `Must be at least ${l}`,
245+ error: `Must be at least ${l}.`,
247export const validatePatpByteLength = byteLength => {
248export const validatePatpByteLength = byteLength => {