Giter Site home page Giter Site logo

emg110 / algo-validation-agent Goto Github PK

View Code? Open in Web Editor NEW

This project forked from algonaut/algo-validation-agent

0.0 0.0 0.0 763 KB

Client validation library for Algorand transaction inputs

Home Page: https://algonaut.github.io/algo-validation-agent/api/

License: MIT License

TypeScript 72.17% JavaScript 26.50% Shell 1.32%

algo-validation-agent's Introduction

algo-validation-agent

algonaut codecov.io MIT License

A dead simple validation library for inputs into the Algorand JS SDK

Why use this library?

While the existing Algorand JS SDK validates address signatures well, it does not fully validate individual fields or payloads before sending them along to the chain. Integrated with your front-end framework and validation library of choice, you'll be able to prevent bad transactions from reaching the chain when collecting input from your users and give them feedback to course correct.

If you're building javascript SPAs, these validations are useful to offload the larger dependency cost to a backend SDK of your choosing without needing to pull the entire JS SDK into your browser-based app. Basically, you want to validate your form inputs so the chain doesn't have to!

Features

  • Field validators for common transaction actions
  • Payload object validators for asset transactions
  • Minimal dependencies
  • CommonJS, ESmodule, and browser import options

Documentation

API Documentation

Usage

npm install @algonaut/algo-validation-agent

Import the library in your client-side or node application to validate inputs:

import { core } from '@algonaut/algo-validation-agent/dist/algo-validation-agent.cjs';

core.isAlgorandAddress('FOO'); // -> false
core.isAlgorandAddress(
  'CINCNAPB2RLDUCS3EVDLURZZD742TMWRQEZ4CBEWF2QMOYXMH6RWRZEIEA'
); // -> true

Alternatively, you can use the browser-ready bundle provided in the package:

<!-- Minimized -->
<script src="dist/algo-validation-agent.iife.min.js"></script>

<!-- Standard -->
<script src="dist/algo-validation-agent.iife.js"></script>

Contributing

# install dependencies
npm install

# live preview documentation
npm run docs:dev

# run tests and watch file changes
npm run test:watch

# build all files and docs
npm run build:all

License

MIT

algo-validation-agent's People

Contributors

jciruolo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.