Skip to content

Commit 8910037

Browse files
committed
fix: override type in CLI to allow wrapping contract calls
1 parent 4827631 commit 8910037

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/contracts/cli/contracts.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ import { IL2Staking } from '../build/types/IL2Staking'
4545
import { Interface } from 'ethers/lib/utils'
4646
import { loadArtifact } from './artifacts'
4747

48+
class WrappedContract {
49+
// The meta-class properties
50+
[key: string]: ContractFunction | any
51+
}
4852
export interface NetworkContracts {
4953
EpochManager: EpochManager
5054
DisputeManager: DisputeManager
@@ -160,7 +164,7 @@ function getWrappedConnect(
160164
// Returns a contract with wrapped calls
161165
// The wrapper will run the tx, wait for confirmation and log the details
162166
function wrapCalls(contract: Contract, contractName: string): Contract {
163-
const wrappedContract = lodash.cloneDeep(contract)
167+
const wrappedContract = lodash.cloneDeep(contract) as WrappedContract
164168

165169
for (const fn of Object.keys(contract.functions)) {
166170
const call: ContractFunction<ContractTransaction> = contract.functions[fn]
@@ -179,7 +183,7 @@ function wrapCalls(contract: Contract, contractName: string): Contract {
179183
wrappedContract[fn] = override
180184
}
181185

182-
return wrappedContract
186+
return wrappedContract as Contract
183187
}
184188

185189
function logContractCall(

0 commit comments

Comments
 (0)