
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
solidity-structure
Advanced tools
Parse structure of ethereum solidity contract, including enums,constructor, structs. Based on Solidity Parser library from ConsenSys.
The goal of it is to take Solidity code as input and return an object as output that can be used to describe all parts of Solidity smart contract.
npm install solidity-structure
const SolidityStructure = require("solidity-structure");
// Parse Solidity code as a string:
let result = SolidityStructure.parse("contract { ... }");
// Or, parse a file:
let result = SolidityStructure.parseFile("./path/to/file.sol");
(suppose solidity-structure package installed globally )
user@host:/solidity-structure MyContract.sol > contract-structure.json
Solidity contract HasConstructor
pragma solidity ^0.4.4;
/**
* Contract with constructor
*/
contract WithConstructor {
/**
* My constructor long long description
* @dev my constructor short description
* @param uintParam Description of item 1
* @param uintParam2
*/
function WithConstructor ( uint uintParam, string stringParam, uint uintParam2) {
//empty
}
}
Structure of constructor
{
name: 'WithConstructor',
title: 'my constructor short description',
description: 'My constructor long long description',
paramsSeq: [
'uintParam',
'stringParam',
'uintParam2'
],
params: {
uintParam: {
name : 'uintParam',
description: 'Description of item 1',
type: 'uint',
typeHint: null
},
stringParam: {
name: 'stringParam',
type: 'string'
},
uintParam2: {
name : 'uintParam2',
description: '',
type: 'uint',
typeHint: null
},
}
}
Solidity contract HasEnum
pragma solidity ^0.4.4;
/**
* Contract has enum
*/
contract HasEnum {
/**
* My enum lon long description
* @dev my enum short description
* @param item1 Description of item 1
* @param item2
* @param item4 Item 4 some description
*/
enum MyEnum {
item1,
item2,
item3,
item4
}
}
Structure of enum
{
MyEnum: {
name: 'MyEnum',
title: 'my enum short description',
description: 'My enum lon long description',
members: [
'item1',
'item2',
'item3',
'item4'
],
params: {
item1: {
description: 'Description of item 1'
},
item2: {
description : ''
},
item4: {
description: 'Item 4 some description'
}
}
}
}
Other examples can be found in tests
FAQs
Structure of ethereum contract in solidity language
We found that solidity-structure demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.