Registry / messaging / grpc-validation

grpc-validation

JSON →
library1.0.2jsnpmunverified

A small Node.js library for gRPC-based request validation in payment/order systems. Current stable version is 1.0.2. The package provides two main functions: getIssue for registering accounts (returning key/secret) and getValidateOrder for validating order objects against a remote gRPC service. Note that the package does not use Protocol Buffer validation but rather a proprietary gRPC API. It is not actively maintained, has no TypeScript definitions, and no tests visible. Alternatives with better validation support include @grpc/proto-loader and protobuf-validate.

npm install grpc-validation
INSTALL
IMPORT
SIG · GRPC-VALIDATION
G
grpc-validation
messagingjavascriptv1.0.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

getIssue
import { getIssue } from 'grpc-validation'
ESM import (if project supports ESM). In CommonJS, use require().
getValidateOrder
import { getValidateOrder } from 'grpc-validation'
Same as getIssue, available as named export.
default import (whole module)
import * as gv from 'grpc-validation'
import gv from 'grpc-validation'
No default export; must use named imports or namespace import.

Registers an account via getIssue and validates an order object using getValidateOrder with key and secret from environment variables.

const { getIssue, getValidateOrder } = require('grpc-validation'); // Register an account to obtain key and secret getIssue() .then(res => { console.log('Success:', res); // res.Data = [key, secret] for Code 0 }) .catch(err => console.error('Error:', err)); // Validate an order object const obj = { amount: '1', appId: '333:333', callBack: 'http://example.com/callback', coinName: 'eth', contractAddress: '0xB8c77482e45F1F44dE1745F52C74426C631bDD52', fee: '0', isForce: false, memo: '', nonce: '1', outOrderId: 'a9de5568-653f-45f1-a152-dadb98cfd476', sfrom: '333', toAddress: '0x009045bd93Cc7f8EA55a80741e8754dB5B1167a2', tokenName: 'bnb-erc20' }; getValidateOrder({ obj, key: process.env.KEY ?? '', secret: process.env.SECRET ?? '' }) .then(res => { if (res.Code === 0) { console.log('Validation succeeded.'); } else { console.log('Validation failed:', res.Data); } }) .catch(err => console.error('Error:', err));
Debug
Known issues
gotchaNo TypeScript definitions; use require() or @types/grpc-validation does not exist.
fix
Use JavaScript files and JSDoc comments, or create a custom .d.ts file.
affects: >=1.0.0
gotchaThe package relies on an external gRPC service (default host/port: localhost:50051). Must have the service running locally or change configuration.
fix
Start the corresponding gRPC server or modify the hardcoded address inside node_modules/grpc-validation/src/index.js.
affects: >=1.0.0
gotchaNo error handling for network failures; getIssue and getValidateOrder may throw unhandled promise rejections if the gRPC service is unreachable.
fix
Always attach .catch() to promises.
affects: >=1.0.0
gotchaThe returned data format may be inconsistent: getIssue returns an array with index-based access (not named properties).
fix
Access via array indices: res.Data[0] for key, res.Data[1] for secret.
affects: >=1.0.0
gotchaNo input validation; passing invalid obj fields may cause silent failures or timeouts.
fix
Manually validate the order object before calling getValidateOrder.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'grpc'
The package depends on the 'grpc' npm package as a peer dependency but does not list it in package.json.
fix
Install grpc manually: npm install grpc
TypeError: getIssue is not a function
Incorrect import: likely using default import instead of named import.
fix
Use const { getIssue } = require('grpc-validation'); or import { getIssue } from 'grpc-validation';
UnhandledPromiseRejectionWarning: Error: 14 UNAVAILABLE: Name resolution failed
The gRPC server is not running or is unreachable.
fix
Ensure the gRPC server is running on localhost:50051 (or update the address in the source).
Upgrade
Version history
1.0.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
15 hits · last 30 days
node
14
OpenAI (training)
1
Resources
grpc-validation — npm install grpc-validation · libregistry