diff --git a/examples/contracts/SomeOtherLibrary/SomeOtherLibrary.sol b/examples/contracts/SomeOtherLibrary/SomeOtherLibrary.sol new file mode 100644 index 0000000..7814a57 --- /dev/null +++ b/examples/contracts/SomeOtherLibrary/SomeOtherLibrary.sol @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: SEE LICENSE IN LICENSE +pragma solidity ^0.8.6; + +contract SomeOtherLibrary { + /// @dev This function uses `keccak256(..)` to hash text. + /// @notice Hash returned. + /// @param someText Any text that you want to hash. + /// @return The hash that was sent as a parameter. + function someFunction(string memory someText) internal pure returns(bytes32) { + return keccak256(bytes(someText)); + } + /// @dev This function uses `sha256(..)` to hash text. + /// @notice Hash returned. + /// @param someText Any text that you want to hash. + /// @return hash The hash that was sent as a parameter. + function someOtherFunction(string memory someText) internal pure returns(bytes32 hash) { + return sha256(bytes(someText)); + } +} \ No newline at end of file diff --git a/examples/docs/contracts/SomeOtherLibrary/SomeOtherLibrary.json b/examples/docs/contracts/SomeOtherLibrary/SomeOtherLibrary.json new file mode 100644 index 0000000..c9a5c35 --- /dev/null +++ b/examples/docs/contracts/SomeOtherLibrary/SomeOtherLibrary.json @@ -0,0 +1,43 @@ +{ + "methods": {}, + "events": {}, + "errors": {}, + "internalMethods": { + "someFunction(string)": { + "code": "function someFunction(string someText) internal pure returns (bytes32)", + "inputs": { + "someText": { + "type": "string", + "description": "Any text that you want to hash." + } + }, + "outputs": { + "_0": { + "type": "bytes32", + "description": "The hash that was sent as a parameter." + } + }, + "details": "This function uses `keccak256(..)` to hash text.", + "notice": "Hash returned." + }, + "someOtherFunction(string)": { + "code": "function someOtherFunction(string someText) internal pure returns (bytes32 hash)", + "inputs": { + "someText": { + "type": "string", + "description": "Any text that you want to hash." + } + }, + "outputs": { + "hash": { + "type": "bytes32", + "description": "The hash that was sent as a parameter." + } + }, + "details": "This function uses `sha256(..)` to hash text.", + "notice": "Hash returned." + } + }, + "path": "SomeOtherLibrary", + "name": "SomeOtherLibrary" +} \ No newline at end of file diff --git a/examples/docs/contracts/SomeOtherLibrary/SomeOtherLibrary.md b/examples/docs/contracts/SomeOtherLibrary/SomeOtherLibrary.md new file mode 100644 index 0000000..bd140d0 --- /dev/null +++ b/examples/docs/contracts/SomeOtherLibrary/SomeOtherLibrary.md @@ -0,0 +1,66 @@ +# SomeOtherLibrary + + + + + + + + + + + + +## Internal Methods + +### someFunction + +```solidity +function someFunction(string someText) internal pure returns (bytes32) +``` + +Hash returned. +*This function uses `keccak256(..)` to hash text.* + + + + +#### Parameters + +| Name | Type | Description | +|---|---|---| +| someText | string | Any text that you want to hash. | + +#### Returns + +| Name | Type | Description | +|---|---|---| +| _0 | bytes32 | The hash that was sent as a parameter. | + +### someOtherFunction + +```solidity +function someOtherFunction(string someText) internal pure returns (bytes32 hash) +``` + +Hash returned. +*This function uses `sha256(..)` to hash text.* + + + + +#### Parameters + +| Name | Type | Description | +|---|---|---| +| someText | string | Any text that you want to hash. | + +#### Returns + +| Name | Type | Description | +|---|---|---| +| hash | bytes32 | The hash that was sent as a parameter. | + + + + diff --git a/src/index.ts b/src/index.ts index 4a1c435..b69ca89 100644 --- a/src/index.ts +++ b/src/index.ts @@ -260,7 +260,10 @@ async function generateDocumentation(hre: HardhatRuntimeEnvironment): Promise