@@ -27,16 +27,10 @@ export async function deployContract(
27
27
constructorArgs : any [ ] = [ ] ,
28
28
config : DeployContractConfig = { }
29
29
) : Promise < GetContractReturnType > {
30
- const {
31
- walletClient : configWalletClient ,
32
- publicClient : configPublicClient ,
33
- confirmations,
34
- ...deployContractParameters
35
- } = config ;
30
+ const { client, confirmations, ...deployContractParameters } = config ;
36
31
const [ publicClient , walletClient , contractArtifact ] = await Promise . all ( [
37
- configPublicClient ?? getPublicClient ( network . provider ) ,
38
- configWalletClient ??
39
- getDefaultWalletClient ( network . provider , network . name ) ,
32
+ client ?. public ?? getPublicClient ( network . provider ) ,
33
+ client ?. wallet ?? getDefaultWalletClient ( network . provider , network . name ) ,
40
34
artifacts . readArtifact ( contractName ) ,
41
35
] ) ;
42
36
@@ -120,15 +114,10 @@ export async function sendDeploymentTransaction(
120
114
contract : GetContractReturnType ;
121
115
deploymentTransaction : GetTransactionReturnType ;
122
116
} > {
123
- const {
124
- walletClient : configWalletClient ,
125
- publicClient : configPublicClient ,
126
- ...deployContractParameters
127
- } = config ;
117
+ const { client, ...deployContractParameters } = config ;
128
118
const [ publicClient , walletClient , contractArtifact ] = await Promise . all ( [
129
- configPublicClient ?? getPublicClient ( network . provider ) ,
130
- configWalletClient ??
131
- getDefaultWalletClient ( network . provider , network . name ) ,
119
+ client ?. public ?? getPublicClient ( network . provider ) ,
120
+ client ?. wallet ?? getDefaultWalletClient ( network . provider , network . name ) ,
132
121
artifacts . readArtifact ( contractName ) ,
133
122
] ) ;
134
123
@@ -202,8 +191,8 @@ export async function getContractAt(
202
191
config : GetContractAtConfig = { }
203
192
) : Promise < GetContractReturnType > {
204
193
const [ publicClient , walletClient , contractArtifact ] = await Promise . all ( [
205
- config . publicClient ?? getPublicClient ( network . provider ) ,
206
- config . walletClient ??
194
+ config . client ?. public ?? getPublicClient ( network . provider ) ,
195
+ config . client ?. wallet ??
207
196
getDefaultWalletClient ( network . provider , network . name ) ,
208
197
artifacts . readArtifact ( contractName ) ,
209
198
] ) ;
@@ -225,8 +214,10 @@ async function innerGetContractAt(
225
214
const viem = await import ( "viem" ) ;
226
215
const contract = viem . getContract ( {
227
216
address,
228
- publicClient,
229
- walletClient,
217
+ client : {
218
+ public : publicClient ,
219
+ wallet : walletClient ,
220
+ } ,
230
221
abi : contractAbi ,
231
222
} ) ;
232
223
0 commit comments