Skip to content

Commit bcec1e4

Browse files
committed
fix: replace 'any' types with proper TypeScript types in verify-debug scripts
- Add proper interfaces for artifact structure in decode-creation-args.ts - Replace any[] with typed tuple for event args in read-immutables-from-event.ts - Fixes all pnpm lint:ts warnings
1 parent 91d5212 commit bcec1e4

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

packages/horizon/scripts/verify-debug/decode-creation-args.ts

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,24 @@ async function main() {
5959
await decode(argsData, artifact)
6060
}
6161

62-
async function decode(argsData: string, artifact: any) {
63-
const ctor = (artifact.abi as any[]).find((x) => x.type === 'constructor')
64-
const types = ctor?.inputs?.map((i: any) => i.type) ?? []
62+
interface AbiInput {
63+
type: string
64+
name?: string
65+
}
66+
67+
interface AbiConstructor {
68+
type: string
69+
inputs?: AbiInput[]
70+
}
71+
72+
interface Artifact {
73+
abi: AbiConstructor[]
74+
bytecode: string
75+
}
76+
77+
async function decode(argsData: string, artifact: Artifact) {
78+
const ctor = artifact.abi.find((x) => x.type === 'constructor')
79+
const types = ctor?.inputs?.map((i) => i.type) ?? []
6580
if (types.length === 0) {
6681
if (argsData === '0x' || argsData.length <= 2) {
6782
console.log('Constructor has no params. Args: []')
@@ -76,7 +91,7 @@ async function decode(argsData: string, artifact: any) {
7691
const coder = ethers.AbiCoder.defaultAbiCoder()
7792
const decoded = coder.decode(types, argsData)
7893
// Pretty-print as JSON array so you can reuse directly
79-
const printable = decoded.map((v: any) => (typeof v === 'bigint' ? v.toString() : v))
94+
const printable = decoded.map((v) => (typeof v === 'bigint' ? v.toString() : v))
8095
console.log('Constructor types:', types)
8196
console.log('Decoded args JSON:', JSON.stringify(printable))
8297
}

packages/horizon/scripts/verify-debug/read-immutables-from-event.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ async function main() {
4343
graphTokenGateway,
4444
graphProxyAdmin,
4545
graphCuration,
46-
] = ev.args as any[]
46+
] = ev.args as [string, string, string, string, string, string, string, string, string, string]
4747

4848
console.log({
4949
address,

0 commit comments

Comments
 (0)