@graphprotocol/graph-cli
Version:
CLI for building for and deploying to The Graph
20 lines (19 loc) • 529 B
JavaScript
export default class EthereumContract {
address;
static identifierName() {
return 'address';
}
constructor(address) {
this.address = address;
this.address = address;
}
validate() {
const pattern = /^(0x)?[0-9a-fA-F]{40}$/;
const errorMessage = "Must be 40 hexadecimal characters, with an optional '0x' prefix.";
const valid = pattern.test(this.address);
return {
valid,
error: valid ? null : errorMessage,
};
}
}