File tree Expand file tree Collapse file tree 1 file changed +19
-13
lines changed Expand file tree Collapse file tree 1 file changed +19
-13
lines changed Original file line number Diff line number Diff line change 1
- import { ethers , type BrowserProvider , keccak256 } from 'ethers'
1
+ import {
2
+ ethers ,
3
+ type BrowserProvider ,
4
+ keccak256 ,
5
+ BaseContractMethod ,
6
+ } from 'ethers'
2
7
import { TransactionResponse } from '@ethersproject/abstract-provider'
3
8
import { keys , mergeAll } from 'ramda'
4
9
@@ -135,18 +140,19 @@ export const execute: ExecuteFunction = async <
135
140
? [ ...( args || [ ] ) , opts . overrides . overrides ]
136
141
: args
137
142
const singleMethod = opts . static
138
- ? contract [ opts . method ] . staticCall
139
- : contract [ opts . method ]
140
- const overloadedMethod = ( ( name ) =>
141
- opts . static ? contract [ name ] . staticCall : contract [ name ] ) (
142
- String (
143
- keys ( contract ) . find (
144
- ( fn : string | number | unknown ) =>
145
- fn === `${ opts . method } (${ opts . interface } )`
146
- )
147
- )
148
- )
149
- const method = singleMethod ?? overloadedMethod
143
+ ? ( contract [ opts . method ] as undefined | BaseContractMethod ) ?. staticCall
144
+ : ( contract [ opts . method ] as undefined | BaseContractMethod )
145
+ const overloadedMethod = singleMethod
146
+ ? undefined
147
+ : ( ( name ) => ( opts . static ? contract [ name ] . staticCall : contract [ name ] ) ) (
148
+ String (
149
+ keys ( contract ) . find (
150
+ ( fn : string | number | unknown ) =>
151
+ fn === `${ opts . method } (${ opts . interface } )`
152
+ )
153
+ )
154
+ )
155
+ const method = singleMethod ?? ( overloadedMethod as BaseContractMethod )
150
156
const res = await ( argsOverrided === undefined
151
157
? method ( )
152
158
: method . apply ( N , argsOverrided )
You can’t perform that action at this time.
0 commit comments