Socket
Socket
Sign inDemoInstall

@findeth/abi

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@findeth/abi - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

14

lib/cjs/utils/buffer.js

@@ -7,5 +7,4 @@ "use strict";

exports.toNumber = exports.toBuffer = exports.concat = void 0;
const BUFFER_WIDTH = 32;
var _bigintBuffer = require("bigint-buffer");
const concat = (target, value, position) => {

@@ -18,3 +17,4 @@ return Buffer.concat([target.subarray(0, position !== null && position !== void 0 ? position : target.length), value, target.subarray(position !== null && position !== void 0 ? position : target.length)]);

const toBuffer = value => {
return (0, _bigintBuffer.toBufferBE)(BigInt(value), 32);
const hex = value.toString(16);
return Buffer.from(hex.padStart(BUFFER_WIDTH * 2, '0').slice(0, BUFFER_WIDTH * 2), 'hex');
};

@@ -25,3 +25,9 @@

const toNumber = buffer => {
return (0, _bigintBuffer.toBigIntBE)(buffer);
const hex = buffer.toString('hex');
if (hex.length === 0) {
return BigInt(0);
}
return BigInt(`0x${hex}`);
};

@@ -28,0 +34,0 @@

@@ -1,2 +0,2 @@

import { toBigIntBE, toBufferBE } from 'bigint-buffer';
const BUFFER_WIDTH = 32;
export const concat = (target, value, position) => {

@@ -6,7 +6,14 @@ return Buffer.concat([target.subarray(0, position !== null && position !== void 0 ? position : target.length), value, target.subarray(position !== null && position !== void 0 ? position : target.length)]);

export const toBuffer = value => {
return toBufferBE(BigInt(value), 32);
const hex = value.toString(16);
return Buffer.from(hex.padStart(BUFFER_WIDTH * 2, '0').slice(0, BUFFER_WIDTH * 2), 'hex');
};
export const toNumber = buffer => {
return toBigIntBE(buffer);
const hex = buffer.toString('hex');
if (hex.length === 0) {
return BigInt(0);
}
return BigInt(`0x${hex}`);
};
//# sourceMappingURL=buffer.js.map
{
"name": "@findeth/abi",
"version": "0.2.0",
"version": "0.2.1",
"description": "A tiny Solidity ABI encoder and decoder",

@@ -55,3 +55,2 @@ "author": "Maarten Zuidhoorn <maarten@zuidhoorn.com>",

"dependencies": {
"bigint-buffer": "^1.1.5",
"keccak": "^3.0.0"

@@ -58,0 +57,0 @@ },

@@ -1,2 +0,2 @@

import { toBigIntBE, toBufferBE } from 'bigint-buffer';
const BUFFER_WIDTH = 32;

@@ -12,7 +12,13 @@ export const concat = (target: Buffer, value: Buffer, position?: number): Buffer => {

export const toBuffer = (value: number | bigint): Buffer => {
return toBufferBE(BigInt(value), 32);
const hex = value.toString(16);
return Buffer.from(hex.padStart(BUFFER_WIDTH * 2, '0').slice(0, BUFFER_WIDTH * 2), 'hex');
};
export const toNumber = (buffer: Buffer): bigint => {
return toBigIntBE(buffer);
const hex = buffer.toString('hex');
if (hex.length === 0) {
return BigInt(0);
}
return BigInt(`0x${hex}`);
};

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