
Research
/Security News
9 Malicious NuGet Packages Deliver Time-Delayed Destructive Payloads
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.
@juanelas/solidity-types-from-json
Advanced tools
Compute solidity types from an arbitrary JS object so that we can use eth_signTypedData (EIP-712) with arbitrary objects
Compute solidity types from an arbitrary JS object so that we can use eth_signTypedData (EIP-712) with arbitrary objects
@juanelas/solidity-types-from-json can be imported to your project with npm:
npm install @juanelas/solidity-types-from-json
Then either require (Node.js CJS):
const solidityTypesFromJson = require('@juanelas/solidity-types-from-json')
or import (JavaScript ES module):
import * as solidityTypesFromJson from '@juanelas/solidity-types-from-json'
The appropriate version for browser or node should be automatically chosen when importing. However, if your bundler does not import the appropriate module version (node esm, node cjs or browser esm), you can force it to use a specific one by just importing one of the followings:
@juanelas/solidity-types-from-json/dist/cjs/index.node: for Node.js CJS module@juanelas/solidity-types-from-json/dist/esm/index.node: for Node.js ESM module@juanelas/solidity-types-from-json/dist/esm/index.browser: for browser ESM moduleIf you are coding TypeScript, types will not be automatically detected when using the specific versions. You can easily get the types in by creating and importing to your TS project a new types declaration file
solidity-types-from-json.d.tswith the following line:declare module '@juanelas/solidity-types-from-json/dist/esm/index.browser' // use the specific module file you are importing
You can also download browser ESM, IIFE and UMD bundles directly from the releases' page and manually add them to your project.
const exampleObject = {
name: 'Alice',
age: 30,
isActive: true,
ethAddress: '0xe688b84b23f322a994A53dbF8E15FA82CDB71127',
address: {
street: '123 Main St',
city: 'Wonderland',
arr: [2, 3],
obj: {
a: 1,
b: false
}
},
scores: [100, 200, 300],
preferences: [
{ key: 'color', value: 'blue' },
{ key: 'size', value: 'medium' }
],
arrAlt: [
{ a: 4, b: true }
]
}
const {mainType, types} = solidityTypesFromJson.jsonToSolidityTypes(exampleObject, { mainTypeName: 'JWT' })
// mainType = 'JWT'
// types = {
// Obj: [{ name: 'a', type: 'uint256' }, { name: 'b', type: 'bool' }],
// Address: [
// { name: 'street', type: 'string' },
// { name: 'city', type: 'string' },
// { name: 'arr', type: 'uint256[]' },
// { name: 'obj', type: 'Obj' }
// ],
// Preference: [
// { name: 'key', type: 'string' },
// { name: 'value', type: 'string' }
// ],
// ArrAltItem: [{ name: 'a', type: 'uint256' }, { name: 'b', type: 'bool' }],
// JWT: [
// { name: 'name', type: 'string' },
// { name: 'age', type: 'uint256' },
// { name: 'isActive', type: 'bool' },
// { name: 'ethAddress', type: 'address' },
// { name: 'address', type: 'Address' },
// { name: 'scores', type: 'uint256[]' },
// { name: 'preferences', type: 'Preference[]' },
// { name: 'arrAlt', type: 'ArrAltItem[]' }
// ]
// }
FAQs
Compute solidity types from an arbitrary JS object so that we can use eth_signTypedData (EIP-712) with arbitrary objects
The npm package @juanelas/solidity-types-from-json receives a total of 0 weekly downloads. As such, @juanelas/solidity-types-from-json popularity was classified as not popular.
We found that @juanelas/solidity-types-from-json demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.