Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/data/src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Chain, Transport } from "viem"
import { Chain, PublicClient, Transport } from "viem"

export type EthersNetwork =
| "mainnet"
Expand Down Expand Up @@ -65,4 +65,5 @@ export type ViemOptions = {
transport?: Transport // Transport from viem
chain?: Chain // Chain from viem
apiKey?: string
publicClient?: PublicClient
}
11 changes: 6 additions & 5 deletions packages/data/src/viem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ export default class SemaphoreViem {
throw new Error(`Network '${networkOrEthereumURL}' needs a Semaphore contract address`)
}

// Create the public client
let transport: Transport

if (options.transport) {
Expand All @@ -131,10 +130,12 @@ export default class SemaphoreViem {
this._options = options

// Create the public client
this._client = createPublicClient({
transport,
chain: options.chain as Chain
})
this._client =
options.publicClient ??
createPublicClient({
transport,
chain: options.chain as Chain
})

// Create the contract instance
this._contract = getContract({
Expand Down