-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* clean up old stuff * added script to create selectors on release * lint * removed unused imports * spell typos * rm unused file * changeset file
- Loading branch information
Showing
21 changed files
with
94 additions
and
510 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
'rankify-contracts': patch | ||
--- | ||
|
||
# Documentation updated | ||
- All source code signatures now are exported during release to docs/selectors.md | ||
- fixed typos | ||
- Removed obsolete documentation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -276,4 +276,5 @@ bin/ | |
/deployments/hardhat/ | ||
|
||
abi/ | ||
docs/contracts/ | ||
docs/contracts/ | ||
docs/selectors.md |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { task } from 'hardhat/config'; | ||
import getSuperInterface from './getSuperInterface'; | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
import { FunctionFragment, EventFragment } from '@ethersproject/abi'; | ||
|
||
task('generate-selector-docs', 'Generates markdown documentation for all selectors').setAction(async _ => { | ||
// Get all interfaces | ||
const superInterface = getSuperInterface(); | ||
const fragments = superInterface.fragments; | ||
|
||
// Organize fragments by type | ||
const functions = fragments.filter(f => f.type === 'function') as FunctionFragment[]; | ||
const events = fragments.filter(f => f.type === 'event') as EventFragment[]; | ||
|
||
// Generate markdown content | ||
let markdown = '# Contract Interface Reference\n\n'; | ||
|
||
// Functions section | ||
markdown += '## Functions\n\n'; | ||
markdown += '| Selector | Function | Inputs | Outputs |\n'; | ||
markdown += '|----------|----------|---------|----------|\n'; | ||
|
||
functions.forEach(func => { | ||
const selector = superInterface.getSighash(func); | ||
const name = func.name; | ||
const inputs = func.inputs.map(input => `${input.type} ${input.name}`).join(', '); | ||
const outputs = func.outputs?.map(output => output.type).join(', ') || 'void'; | ||
|
||
markdown += `| \`${selector}\` | ${name} | (${inputs}) | ${outputs} |\n`; | ||
}); | ||
|
||
// Events section | ||
markdown += '\n## Events\n\n'; | ||
markdown += '| Topic | Event | Parameters |\n'; | ||
markdown += '|-------|-------|------------|\n'; | ||
|
||
events.forEach(event => { | ||
const topic = superInterface.getEventTopic(event); | ||
const name = event.name; | ||
const params = event.inputs | ||
.map(input => `${input.type} ${input.indexed ? '(indexed) ' : ''}${input.name}`) | ||
.join(', '); | ||
|
||
markdown += `| \`${topic}\` | ${name} | (${params}) |\n`; | ||
}); | ||
|
||
// Save to docs directory | ||
const docsPath = path.join(__dirname, '../docs/selectors.md'); | ||
fs.writeFileSync(docsPath, markdown); | ||
|
||
console.log(`✅ Selector documentation generated at ${docsPath}`); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.