File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change 1
- import { Chain , Transport } from "viem"
1
+ import { Chain , PublicClient , Transport } from "viem"
2
2
3
3
export type EthersNetwork =
4
4
| "mainnet"
@@ -65,4 +65,5 @@ export type ViemOptions = {
65
65
transport ?: Transport // Transport from viem
66
66
chain ?: Chain // Chain from viem
67
67
apiKey ?: string
68
+ publicClient ?: PublicClient
68
69
}
Original file line number Diff line number Diff line change @@ -117,7 +117,6 @@ export default class SemaphoreViem {
117
117
throw new Error ( `Network '${ networkOrEthereumURL } ' needs a Semaphore contract address` )
118
118
}
119
119
120
- // Create the public client
121
120
let transport : Transport
122
121
123
122
if ( options . transport ) {
@@ -131,10 +130,12 @@ export default class SemaphoreViem {
131
130
this . _options = options
132
131
133
132
// Create the public client
134
- this . _client = createPublicClient ( {
135
- transport,
136
- chain : options . chain as Chain
137
- } )
133
+ this . _client =
134
+ options . publicClient ??
135
+ createPublicClient ( {
136
+ transport,
137
+ chain : options . chain as Chain
138
+ } )
138
139
139
140
// Create the contract instance
140
141
this . _contract = getContract ( {
You can’t perform that action at this time.
0 commit comments