@voire/eth-validation-rules
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

@voire/eth-validation-rules

A bunch of additional VeeValidate rules for eth addresses' validation.

Provided rules

export description
hex If value is a hex string, e.g. ab12AB
hexPrefixed If value is a 0x-prefixed hex string, e.g. 0xab12AB
ethAddress If value is a valid ethereum address, i.e. is a 0x-prefixed hex string and 42 symbols long
nullEthAddress If value is an ethereum zero address, i.e. 0x000..00
notNullEthAddress If value is an ethereum address, but not zero address, e.g. 0xABC..90

All checks are case-insensitive.

Usage

  1. Define validators for the app.
import { defineRule } from 'vee-validate'
import { ethAddress } from '@voire/eth-validation-rules'

// Use any key you find suitable
defineRule('eth_address', ethAddress)
  1. Use it within vee Field's rules
<script setup lang="ts">
import { Field } from 'vee-validate'
</script>

<template>
  <Field name="address" rules="eth_address" />
</template>

See detailed VeeValidate docs about custom rules' defining and usage.

Package Sidebar

Install

npm i @voire/eth-validation-rules

Weekly Downloads

1

Version

1.1.0

License

MIT

Unpacked Size

6.2 kB

Total Files

5

Last publish

Collaborators

  • pyncz