Skip to content

Commit

Permalink
Merge branch 'main' into ink-v5
Browse files Browse the repository at this point in the history
  • Loading branch information
goastler authored Jul 3, 2024
2 parents af7f3e6 + 7add351 commit 773d620
Showing 1 changed file with 0 additions and 27 deletions.
27 changes: 0 additions & 27 deletions dev/scripts/src/contract/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,33 +93,6 @@ async function importContract(pathToAbis: string, pathToOutput: string) {
if (verbose) console.log(`Replacing \n\t${match}\nwith\n\t${result}\nin ${filePath}`)
return `${result}`
})
// eslint-disable-next-line no-useless-escape
replaced = replaced.replace(/\n(.*)\n(\s*)\/\/\s*@ts-ignore/g, (match, p1, p2) => {
// don't replace if already ignored by eslint
if (p1.includes('eslint-disable-next-line')) return match
const result = `\n${p1}\n${p2}// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n${p2}// @ts-ignore`
if (verbose) console.log(`Replacing \n\t${match}\nwith\n\t${result}\nin ${filePath}`)
return result
})

// replace EventRecord with EventRecord[]
// eslint-disable-next-line no-useless-escape
replaced = replaced.replace(/: EventRecord\)/g, (match) => {
const result = `: EventRecord[])`
if (verbose) console.log(`Replacing \n\t${match}\nwith\n\t${result}\nin ${filePath}`)
return result
})

// replace EventRecord incorrect imports
// eslint-disable-next-line no-useless-escape
replaced = replaced.replace(
/import\s+type\s+\{\s*EventRecord\s*\}\s+from\s+['"]@polkadot\/api\/submittable["']/g,
(match) => {
const result = `import type { EventRecord } from '@polkadot/types/interfaces'`
if (verbose) console.log(`Replacing \n\t${match}\nwith\n\t${result}\nin ${filePath}`)
return result
}
)

fs.writeFileSync(filePath, replaced)
}
Expand Down

0 comments on commit 773d620

Please sign in to comment.