@broxus/js-core
Version:
MobX-based JavaScript Core library
17 lines (16 loc) • 448 B
JavaScript
import { Address } from 'everscale-inpage-provider';
export function isTvmAddress(value, allowMasterChain = true) {
if (value == null) {
return false;
}
if (value instanceof Address) {
return true;
}
if (typeof value === 'string') {
if (allowMasterChain) {
return /^(?:0|-1):[0-9a-fA-F]{64}$/.test(value);
}
return /^0:[0-9a-fA-F]{64}$/.test(value);
}
return false;
}