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

@ethereumjs/util

Package Overview
Dependencies
Maintainers
3
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ethereumjs/util - npm Package Compare versions

Comparing version 8.0.0-rc.1 to 8.0.0

5

dist/account.js

@@ -12,3 +12,2 @@ "use strict";

const internal_1 = require("./internal");
const types_1 = require("./types");
const _0n = BigInt(0);

@@ -29,3 +28,3 @@ class Account {

const { nonce, balance, storageRoot, codeHash } = accountData;
return new Account((0, types_1.isTruthy)(nonce) ? (0, bytes_1.bufferToBigInt)((0, bytes_1.toBuffer)(nonce)) : undefined, (0, types_1.isTruthy)(balance) ? (0, bytes_1.bufferToBigInt)((0, bytes_1.toBuffer)(balance)) : undefined, (0, types_1.isTruthy)(storageRoot) ? (0, bytes_1.toBuffer)(storageRoot) : undefined, (0, types_1.isTruthy)(codeHash) ? (0, bytes_1.toBuffer)(codeHash) : undefined);
return new Account(nonce !== undefined ? (0, bytes_1.bufferToBigInt)((0, bytes_1.toBuffer)(nonce)) : undefined, balance !== undefined ? (0, bytes_1.bufferToBigInt)((0, bytes_1.toBuffer)(balance)) : undefined, storageRoot !== undefined ? (0, bytes_1.toBuffer)(storageRoot) : undefined, codeHash !== undefined ? (0, bytes_1.toBuffer)(codeHash) : undefined);
}

@@ -119,3 +118,3 @@ static fromRlpSerializedAccount(serialized) {

let prefix = '';
if ((0, types_1.isTruthy)(eip1191ChainId)) {
if (eip1191ChainId !== undefined) {
const chainId = (0, bytes_1.bufferToBigInt)((0, bytes_1.toBuffer)(eip1191ChainId));

@@ -122,0 +121,0 @@ prefix = chainId.toString() + '0x';

@@ -45,20 +45,2 @@ /// <reference types="node" />

export declare function toType<T extends TypeOutput>(input: ToBufferInputTypes, outputType: T): TypeOutputReturnType[T];
declare type Falsy = false | '' | 0 | null | undefined | 0n;
/**
* Returns true if a value is falsy
*
* @param value - Value to check for falseness
*
* @deprecated This helper function should only be used temporarily until the monorepo types are explicit enough
*/
export declare function isFalsy(value: unknown): value is Falsy;
/**
* Returns true if a value is truthy
*
* @param value - Value to check for truthiness
*
* @deprecated This helper function should only be used temporarily until the monorepo types are explicit enough
*/
export declare function isTruthy<T>(value: T | Falsy): value is T;
export {};
//# sourceMappingURL=types.d.ts.map

30

dist/types.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isTruthy = exports.isFalsy = exports.toType = exports.TypeOutput = void 0;
exports.toType = exports.TypeOutput = void 0;
const bytes_1 = require("./bytes");

@@ -49,30 +49,2 @@ const internal_1 = require("./internal");

exports.toType = toType;
/**
* Returns true if a value is falsy
*
* @param value - Value to check for falseness
*
* @deprecated This helper function should only be used temporarily until the monorepo types are explicit enough
*/
function isFalsy(value) {
return !!(value === false ||
value === '' ||
value === 0 ||
Number.isNaN(value) ||
value === null ||
typeof value === 'undefined' ||
value === BigInt(0));
}
exports.isFalsy = isFalsy;
/**
* Returns true if a value is truthy
*
* @param value - Value to check for truthiness
*
* @deprecated This helper function should only be used temporarily until the monorepo types are explicit enough
*/
function isTruthy(value) {
return !isFalsy(value);
}
exports.isTruthy = isTruthy;
//# sourceMappingURL=types.js.map
{
"name": "@ethereumjs/util",
"version": "8.0.0-rc.1",
"version": "8.0.0",
"description": "A collection of utility functions for Ethereum",

@@ -5,0 +5,0 @@ "keywords": [

@@ -18,3 +18,2 @@ import { RLP } from '@ethereumjs/rlp'

import { stripHexPrefix } from './internal'
import { isTruthy } from './types'

@@ -42,6 +41,6 @@ import type { BigIntLike, BufferLike } from './types'

return new Account(
isTruthy(nonce) ? bufferToBigInt(toBuffer(nonce)) : undefined,
isTruthy(balance) ? bufferToBigInt(toBuffer(balance)) : undefined,
isTruthy(storageRoot) ? toBuffer(storageRoot) : undefined,
isTruthy(codeHash) ? toBuffer(codeHash) : undefined
nonce !== undefined ? bufferToBigInt(toBuffer(nonce)) : undefined,
balance !== undefined ? bufferToBigInt(toBuffer(balance)) : undefined,
storageRoot !== undefined ? toBuffer(storageRoot) : undefined,
codeHash !== undefined ? toBuffer(codeHash) : undefined
)

@@ -163,3 +162,3 @@ }

let prefix = ''
if (isTruthy(eip1191ChainId)) {
if (eip1191ChainId !== undefined) {
const chainId = bufferToBigInt(toBuffer(eip1191ChainId))

@@ -166,0 +165,0 @@ prefix = chainId.toString() + '0x'

@@ -123,33 +123,1 @@ import { bufferToBigInt, bufferToHex, toBuffer } from './bytes'

}
type Falsy = false | '' | 0 | null | undefined | 0n
/**
* Returns true if a value is falsy
*
* @param value - Value to check for falseness
*
* @deprecated This helper function should only be used temporarily until the monorepo types are explicit enough
*/
export function isFalsy(value: unknown): value is Falsy {
return !!(
value === false ||
value === '' ||
value === 0 ||
Number.isNaN(value) ||
value === null ||
typeof value === 'undefined' ||
value === BigInt(0)
)
}
/**
* Returns true if a value is truthy
*
* @param value - Value to check for truthiness
*
* @deprecated This helper function should only be used temporarily until the monorepo types are explicit enough
*/
export function isTruthy<T>(value: T | Falsy): value is T {
return !isFalsy(value)
}

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