Skip to content

Commit

Permalink
Merge pull request #494 from alephium/fix-gen-interfaces-command
Browse files Browse the repository at this point in the history
Fix the gen-interfaces command
  • Loading branch information
Lbqds authored Feb 20, 2025
2 parents 66d9209 + 5e9f21b commit 4ae18e5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/cli/src/gen-interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export async function genInterfaces(artifactDir: string, outDir: string) {
}
if (structs.length > 0) {
const structDefs = genStructs(structs, structNames, contractNames)
await saveToFile(path.join(outPath, '__structs.ral'), structDefs)
await saveToFile(path.join(outPath, 'structs__.ral'), structDefs)
}
}

Expand All @@ -48,11 +48,12 @@ async function saveToFile(filePath: string, content: string) {
}

function genInterface(contract: Contract, structNames: string[], contractNames: string[]) {
const interfaceName = `__I${contract.name}`
const interfaceName = `I${contract.name}__`
const functions: string[] = []
let publicFuncIndex = 0
contract.functions.forEach((funcSig, index) => {
const method = contract.decodedContract.methods[`${index}`]
const methods = contract.decodedContract.methods
methods.forEach((method, index) => {
const funcSig = contract.functions[`${index}`]
if (!method.isPublic) return
const usingAnnotations: string[] = []
if (publicFuncIndex !== index) usingAnnotations.push(`methodIndex = ${index}`)
Expand Down

0 comments on commit 4ae18e5

Please sign in to comment.