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

@onflow/rlp

Package Overview
Dependencies
Maintainers
11
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@onflow/rlp - npm Package Compare versions

Comparing version 1.1.0-alpha.2 to 1.1.0

12

CHANGELOG.md
# @onflow/rlp
## 1.1.0
### Minor Changes
- [#1577](https://github.com/onflow/fcl-js/pull/1577) [`d9a49531`](https://github.com/onflow/fcl-js/commit/d9a495316cd03ed0de99e0f01d1b8850a1f0eec4) Thanks [@chasefleming](https://github.com/chasefleming)! - Add npmignore file for build
### Patch Changes
- [#1663](https://github.com/onflow/fcl-js/pull/1663) [`62dfafa9`](https://github.com/onflow/fcl-js/commit/62dfafa9c7adc3933822b0d3171d6eb025f1719e) Thanks [@nialexsan](https://github.com/nialexsan)! - Upgrade jest to v29.5 and update tests accordingly. Change build to transpile with ESM modules.
- [#1658](https://github.com/onflow/fcl-js/pull/1658) [`2512b5c5`](https://github.com/onflow/fcl-js/commit/2512b5c53dff708fca97cd8afdbb1f4a46b2f106) Thanks [@nialexsan](https://github.com/nialexsan)! - Align jest version
## 1.1.0-alpha.2

@@ -4,0 +16,0 @@

54

dist/rlp.js

@@ -21,11 +21,8 @@ 'use strict';

**/
function encode(input) {
if (Array.isArray(input)) {
var output = [];
for (var i = 0; i < input.length; i++) {
output.push(encode(input[i]));
}
var buf = buffer.Buffer.concat(output);

@@ -38,2 +35,3 @@ return buffer.Buffer.concat([encodeLength(buf.length, 192), buf]);

}
/**

@@ -44,3 +42,2 @@ * Parse integers. Check if there is no leading zeros

*/
function safeParseInt(v, base) {

@@ -50,6 +47,4 @@ if (v.slice(0, 2) === "00") {

}
return parseInt(v, base);
}
function encodeLength(len, offset) {

@@ -65,2 +60,3 @@ if (len < 56) {

}
/**

@@ -81,4 +77,2 @@ * Built on top of rlp library, removing the BN dependency for the flow.

**/
function decode(input, stream) {

@@ -88,21 +82,16 @@ if (stream === void 0) {

}
if (!input || input.length === 0) {
return buffer.Buffer.from([]);
}
var inputBuffer = toBuffer(input);
var decoded = _decode(inputBuffer);
if (stream) {
return decoded;
}
if (decoded.remainder.length !== 0) {
throw new Error("invalid remainder");
}
return decoded.data;
}
/**

@@ -113,3 +102,2 @@ * Get the length of the RLP input

*/
function getLength(input) {

@@ -119,6 +107,4 @@ if (!input || input.length === 0) {

}
var inputBuffer = toBuffer(input);
var firstByte = inputBuffer[0];
if (firstByte <= 0x7f) {

@@ -140,4 +126,4 @@ return inputBuffer.length;

}
/** Decode an input with RLP */
function _decode(input) {

@@ -147,3 +133,2 @@ var length, llength, data, innerRemainder, d;

var firstByte = input[0];
if (firstByte <= 0x7f) {

@@ -158,4 +143,4 @@ // a single byte whose value is in the [0x00, 0x7f] range, that byte is its own RLP encoding.

// The range of the first byte is [0x80, 0xb7]
length = firstByte - 0x7f; // set 0x80 null to 0
length = firstByte - 0x7f;
// set 0x80 null to 0
if (firstByte === 0x80) {

@@ -166,7 +151,5 @@ data = buffer.Buffer.from([]);

}
if (length === 2 && data[0] < 0x80) {
throw new Error("invalid rlp encoding: byte must be less 0x80");
}
return {

@@ -180,7 +163,5 @@ data: data,

data = input.slice(llength, length + llength);
if (data.length < length) {
throw new Error("invalid RLP");
}
return {

@@ -194,3 +175,2 @@ data: data,

innerRemainder = input.slice(1, length);
while (innerRemainder.length) {

@@ -201,3 +181,2 @@ d = _decode(innerRemainder);

}
return {

@@ -212,13 +191,9 @@ data: decoded,

var totalLength = llength + length;
if (totalLength > input.length) {
throw new Error("invalid rlp: total length is larger than the data");
}
innerRemainder = input.slice(llength, totalLength);
if (innerRemainder.length === 0) {
throw new Error("invalid rlp, List has a invalid length");
}
while (innerRemainder.length) {

@@ -229,3 +204,2 @@ d = _decode(innerRemainder);

}
return {

@@ -238,4 +212,2 @@ data: decoded,

/** Check if a string is prefixed by 0x */
function isHexPrefixed(str) {

@@ -245,4 +217,2 @@ return str.slice(0, 2) === "0x";

/** Removes 0x from a given String */
function stripHexPrefix(str) {

@@ -252,8 +222,5 @@ if (typeof str !== "string") {

}
return isHexPrefixed(str) ? str.slice(2) : str;
}
/** Transform an integer into its hexadecimal value */
function intToHex(integer) {

@@ -263,3 +230,2 @@ if (integer < 0) {

}
var hex = integer.toString(16);

@@ -269,4 +235,2 @@ return hex.length % 2 ? "0" + hex : hex;

/** Pad a string to be even */
function padToEven(a) {

@@ -276,4 +240,2 @@ return a.length % 2 ? "0" + a : a;

/** Transform an integer into a Buffer */
function intToBuffer(integer) {

@@ -283,5 +245,4 @@ var hex = intToHex(integer);

}
/** Transform anything into a Buffer */
function toBuffer(v) {

@@ -309,3 +270,2 @@ if (!buffer.Buffer.isBuffer(v)) {

}
return v;

@@ -312,0 +272,0 @@ }

@@ -18,11 +18,8 @@ import { Buffer } from 'buffer';

**/
function encode(input) {
if (Array.isArray(input)) {
var output = [];
for (var i = 0; i < input.length; i++) {
output.push(encode(input[i]));
}
var buf = Buffer.concat(output);

@@ -35,2 +32,3 @@ return Buffer.concat([encodeLength(buf.length, 192), buf]);

}
/**

@@ -41,3 +39,2 @@ * Parse integers. Check if there is no leading zeros

*/
function safeParseInt(v, base) {

@@ -47,6 +44,4 @@ if (v.slice(0, 2) === "00") {

}
return parseInt(v, base);
}
function encodeLength(len, offset) {

@@ -62,2 +57,3 @@ if (len < 56) {

}
/**

@@ -78,4 +74,2 @@ * Built on top of rlp library, removing the BN dependency for the flow.

**/
function decode(input, stream) {

@@ -85,21 +79,16 @@ if (stream === void 0) {

}
if (!input || input.length === 0) {
return Buffer.from([]);
}
var inputBuffer = toBuffer(input);
var decoded = _decode(inputBuffer);
if (stream) {
return decoded;
}
if (decoded.remainder.length !== 0) {
throw new Error("invalid remainder");
}
return decoded.data;
}
/**

@@ -110,3 +99,2 @@ * Get the length of the RLP input

*/
function getLength(input) {

@@ -116,6 +104,4 @@ if (!input || input.length === 0) {

}
var inputBuffer = toBuffer(input);
var firstByte = inputBuffer[0];
if (firstByte <= 0x7f) {

@@ -137,4 +123,4 @@ return inputBuffer.length;

}
/** Decode an input with RLP */
function _decode(input) {

@@ -144,3 +130,2 @@ var length, llength, data, innerRemainder, d;

var firstByte = input[0];
if (firstByte <= 0x7f) {

@@ -155,4 +140,4 @@ // a single byte whose value is in the [0x00, 0x7f] range, that byte is its own RLP encoding.

// The range of the first byte is [0x80, 0xb7]
length = firstByte - 0x7f; // set 0x80 null to 0
length = firstByte - 0x7f;
// set 0x80 null to 0
if (firstByte === 0x80) {

@@ -163,7 +148,5 @@ data = Buffer.from([]);

}
if (length === 2 && data[0] < 0x80) {
throw new Error("invalid rlp encoding: byte must be less 0x80");
}
return {

@@ -177,7 +160,5 @@ data: data,

data = input.slice(llength, length + llength);
if (data.length < length) {
throw new Error("invalid RLP");
}
return {

@@ -191,3 +172,2 @@ data: data,

innerRemainder = input.slice(1, length);
while (innerRemainder.length) {

@@ -198,3 +178,2 @@ d = _decode(innerRemainder);

}
return {

@@ -209,13 +188,9 @@ data: decoded,

var totalLength = llength + length;
if (totalLength > input.length) {
throw new Error("invalid rlp: total length is larger than the data");
}
innerRemainder = input.slice(llength, totalLength);
if (innerRemainder.length === 0) {
throw new Error("invalid rlp, List has a invalid length");
}
while (innerRemainder.length) {

@@ -226,3 +201,2 @@ d = _decode(innerRemainder);

}
return {

@@ -235,4 +209,2 @@ data: decoded,

/** Check if a string is prefixed by 0x */
function isHexPrefixed(str) {

@@ -242,4 +214,2 @@ return str.slice(0, 2) === "0x";

/** Removes 0x from a given String */
function stripHexPrefix(str) {

@@ -249,8 +219,5 @@ if (typeof str !== "string") {

}
return isHexPrefixed(str) ? str.slice(2) : str;
}
/** Transform an integer into its hexadecimal value */
function intToHex(integer) {

@@ -260,3 +227,2 @@ if (integer < 0) {

}
var hex = integer.toString(16);

@@ -266,4 +232,2 @@ return hex.length % 2 ? "0" + hex : hex;

/** Pad a string to be even */
function padToEven(a) {

@@ -273,4 +237,2 @@ return a.length % 2 ? "0" + a : a;

/** Transform an integer into a Buffer */
function intToBuffer(integer) {

@@ -280,5 +242,4 @@ var hex = intToHex(integer);

}
/** Transform anything into a Buffer */
function toBuffer(v) {

@@ -306,3 +267,2 @@ if (!Buffer.isBuffer(v)) {

}
return v;

@@ -309,0 +269,0 @@ }

{
"name": "@onflow/rlp",
"version": "1.1.0-alpha.2",
"version": "1.1.0",
"description": "Port of ethereumjs/rlp",

@@ -16,3 +16,3 @@ "license": "MPL-2.0",

"devDependencies": {
"@onflow/fcl-bundle": "^1.3.0-alpha.0",
"@onflow/fcl-bundle": "^1.3.0",
"jest": "^29.5.0"

@@ -19,0 +19,0 @@ },

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 too big to display

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