Skip to content

Commit b6a7a98

Browse files
refactor: transport selection logic (#1007)
1 parent fc1fe4d commit b6a7a98

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

packages/data/src/viem.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,6 @@ export default class SemaphoreViem {
9393
constructor(networkOrEthereumURL: ViemNetwork | string = defaultNetwork, options: ViemOptions = {}) {
9494
requireString(networkOrEthereumURL, "networkOrEthereumURL")
9595

96-
if (options.transport) {
97-
// Transport is provided directly
98-
} else if (!networkOrEthereumURL.startsWith("http")) {
99-
// Default to http transport if no transport is provided and network is not a URL
100-
options.transport = http()
101-
}
102-
10396
if (options.apiKey) {
10497
requireString(options.apiKey, "apiKey")
10598
}
@@ -118,11 +111,11 @@ export default class SemaphoreViem {
118111
}
119112

120113
let transport: Transport
121-
122114
if (options.transport) {
123115
transport = options.transport
116+
} else if (!networkOrEthereumURL.startsWith("http")) {
117+
transport = http()
124118
} else {
125-
// If no transport is provided, use http transport with the URL
126119
transport = http(networkOrEthereumURL)
127120
}
128121

0 commit comments

Comments
 (0)