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

@truffle/abi-utils

Package Overview
Dependencies
Maintainers
14
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@truffle/abi-utils - npm Package Compare versions

Comparing version 0.2.15 to 0.2.16

8

dist/lib/arbitrary.js

@@ -123,3 +123,5 @@ "use strict";

// names that are not blank should be unique
const names = inputs.map(({ name }) => name).filter(name => name !== "");
const names = inputs
.map(({ name }) => name)
.filter(name => name !== "");
return names.length === new Set(names).size;

@@ -181,3 +183,3 @@ })

const ArrayFixed = fc.memo(n => fc
.tuple(Type(n - 1), fc.integer(1, 256))
.tuple(Type(n - 1), fc.integer({ min: 1, max: 256 }))
.map(([type, length]) => `${type}[${length}]`));

@@ -333,3 +335,3 @@ const ArrayDynamic = fc.memo(n => Type(n - 1).map(type => `${type}[]`));

};
const ParameterName = () => fc.frequency({ arbitrary: fakerToArb("{{hacker.noun}}"), weight: 9 }, { arbitrary: fc.constant(""), weight: 1 });
const ParameterName = () => fc.oneof({ arbitrary: fakerToArb("{{hacker.noun}}"), weight: 9 }, { arbitrary: fc.constant(""), weight: 1 });
const EventName = () => fakerToArb("{{hacker.verb}} {{hacker.noun}}", change_case_1.pascalCase);

@@ -336,0 +338,0 @@ const ErrorName = () => fakerToArb("{{hacker.noun}} {{hacker.noun}}", change_case_1.pascalCase);

@@ -22,3 +22,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const jest_fast_check_1 = require("jest-fast-check");
const jest_1 = require("@fast-check/jest");
const abiSchema = __importStar(require("@truffle/contract-schema/spec/abi.spec.json"));

@@ -71,3 +71,3 @@ const jest_json_schema_1 = require("jest-json-schema");

describe(`Arbitrary.${name}`, () => {
jest_fast_check_1.testProp("validates schema", [arbitrary], value => {
jest_1.testProp("validates schema", [arbitrary], value => {
expect(value).toMatchSchema(schema);

@@ -74,0 +74,0 @@ });

@@ -23,11 +23,11 @@ "use strict";

require("jest-extended");
const jest_fast_check_1 = require("jest-fast-check");
const jest_1 = require("@fast-check/jest");
const Arbitrary = __importStar(require("./arbitrary"));
const normalize_1 = require("./normalize");
describe("normalize", () => {
jest_fast_check_1.testProp(`fills in "type" property for function entries`, [Arbitrary.Abi()], looseAbi => {
jest_1.testProp(`fills in "type" property for function entries`, [Arbitrary.Abi()], looseAbi => {
const abi = normalize_1.normalize(looseAbi);
expect(abi).toSatisfyAll(entry => "type" in entry);
});
jest_fast_check_1.testProp(`never includes "payable" or "constant"`, [Arbitrary.Abi()], looseAbi => {
jest_1.testProp(`never includes "payable" or "constant"`, [Arbitrary.Abi()], looseAbi => {
const abi = normalize_1.normalize(looseAbi);

@@ -37,3 +37,3 @@ expect(abi).toSatisfyAll(entry => !("payable" in entry));

});
jest_fast_check_1.testProp(`always includes "outputs" for function entries`, [Arbitrary.Abi()], looseAbi => {
jest_1.testProp(`always includes "outputs" for function entries`, [Arbitrary.Abi()], looseAbi => {
const abi = normalize_1.normalize(looseAbi);

@@ -43,7 +43,7 @@ expect(abi.filter(({ type }) => type === "function")).toSatisfyAll(entry => "outputs" in entry);

});
jest_fast_check_1.testProp(`always includes "stateMutability" for entries that aren't events or errors`, [Arbitrary.Abi()], looseAbi => {
jest_1.testProp(`always includes "stateMutability" for entries that aren't events or errors`, [Arbitrary.Abi()], looseAbi => {
const abi = normalize_1.normalize(looseAbi);
expect(abi.filter(({ type }) => type !== "event" && type !== "error")).toSatisfyAll(entry => "stateMutability" in entry);
});
jest_fast_check_1.testProp("is idempotent", [Arbitrary.Abi()], looseAbi => {
jest_1.testProp("is idempotent", [Arbitrary.Abi()], looseAbi => {
const abi = normalize_1.normalize(looseAbi);

@@ -50,0 +50,0 @@ expect(normalize_1.normalize(abi)).toEqual(abi);

{
"name": "@truffle/abi-utils",
"version": "0.2.15",
"version": "0.2.16",
"description": "Utilities for working with ABIs",

@@ -29,14 +29,15 @@ "license": "MIT",

"faker": "5.5.3",
"fast-check": "2.15.1"
"fast-check": "3.1.1"
},
"devDependencies": {
"@truffle/contract-schema": "^3.4.8",
"@fast-check/jest": "^1.0.1",
"@truffle/contract-schema": "^3.4.9",
"@types/faker": "^5.1.2",
"@types/jest": "27.4.1",
"@types/jest-json-schema": "^2.1.2",
"@types/node": "12.12.21",
"jest": "28.1.3",
"jest-extended": "^0.11.5",
"jest-fast-check": "2.0.0",
"jest-json-schema": "^2.1.0",
"ts-jest": "28.0.6",
"ts-jest": "28.0.7",
"ts-node": "10.7.0",

@@ -53,3 +54,3 @@ "typescript": "^4.1.4"

},
"gitHead": "074c8ac1695d241096843a163a1bc95c34a3a117"
"gitHead": "c0e9b091678b131d3a5e28fa46ff64afbc0e4828"
}

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