Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@harmony-js/utils

Package Overview
Dependencies
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@harmony-js/utils - npm Package Compare versions

Comparing version 0.0.21 to 0.0.22

0

dist/chain.d.ts

@@ -0,0 +0,0 @@ export declare const enum ChainType {

@@ -0,0 +0,0 @@ export * from './validators';

@@ -0,0 +0,0 @@ import BN from 'bn.js';

@@ -0,0 +0,0 @@ export declare const enum AssertType {

3

dist/utils.js

@@ -23,2 +23,5 @@ "use strict";

isBlockNumber: [validators_1.isBlockNumber],
isBech32Address: [validators_1.isBech32Address],
isBech32TestNetAddress: [validators_1.isBech32TestNetAddress],
isValidAddress: [validators_1.isValidAddress],
};

@@ -25,0 +28,0 @@ function validateArgs(args, requiredArgs, optionalArgs) {

@@ -114,2 +114,14 @@ export declare const isKeyString: {

};
export declare const isBech32Address: {
(raw: string): boolean;
validator: string;
};
export declare const isBech32TestNetAddress: {
(raw: string): boolean;
validator: string;
};
export declare const isValidAddress: {
(address: string): boolean;
validator: string;
};
//# sourceMappingURL=validators.d.ts.map

@@ -144,2 +144,24 @@ "use strict";

exports.isBlockNumber.validator = 'isBlockNumber';
exports.isBech32Address = function (raw) {
return !!raw.match(/^hmy1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{38}/);
};
exports.isBech32Address.validator = 'isBech32Address';
exports.isBech32TestNetAddress = function (raw) {
return !!raw.match(/^thmy1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{38}/);
};
exports.isBech32TestNetAddress.validator = 'isBech32TestNetAddress';
exports.isValidAddress = function (address) {
if (!exports.isString(address)) {
throw new Error(address + " is not string");
}
if (exports.isAddress(address) ||
exports.isBech32Address(address) ||
exports.isBech32TestNetAddress(address)) {
return true;
}
else {
return false;
}
};
exports.isValidAddress.validator = 'isValidAddress';
//# sourceMappingURL=validators.js.map

4

package.json
{
"name": "@harmony-js/utils",
"version": "0.0.21",
"version": "0.0.22",
"description": "utils for harmony",

@@ -24,3 +24,3 @@ "main": "dist/index.js",

},
"gitHead": "7a51fd2bcccc294bd32f991181f755fdbc88f6e8"
"gitHead": "5c53415c333ab12d727fc1808be2e603d40489e0"
}

@@ -13,2 +13,5 @@ import {

isAddress,
isBech32Address,
isBech32TestNetAddress,
isValidAddress,
isHash,

@@ -37,2 +40,5 @@ isBlockNumber,

isBlockNumber: [isBlockNumber],
isBech32Address: [isBech32Address],
isBech32TestNetAddress: [isBech32TestNetAddress],
isValidAddress: [isValidAddress],
};

@@ -39,0 +45,0 @@

@@ -162,1 +162,27 @@ export const isKeyString = (keyString: string, lengh: number): boolean => {

isBlockNumber.validator = 'isBlockNumber';
export const isBech32Address = (raw: string): boolean => {
return !!raw.match(/^hmy1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{38}/);
};
isBech32Address.validator = 'isBech32Address';
export const isBech32TestNetAddress = (raw: string): boolean => {
return !!raw.match(/^thmy1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{38}/);
};
isBech32TestNetAddress.validator = 'isBech32TestNetAddress';
export const isValidAddress = (address: string): boolean => {
if (!isString(address)) {
throw new Error(`${address} is not string`);
}
if (
isAddress(address) ||
isBech32Address(address) ||
isBech32TestNetAddress(address)
) {
return true;
} else {
return false;
}
};
isValidAddress.validator = 'isValidAddress';

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc