Skip to content

Commit fc4db2c

Browse files
committed
feat: add option to specify subgraph URL in subgraph library
1 parent bc8f349 commit fc4db2c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

packages/subgraph/src/subgraph.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,15 @@ export default class Subgraph {
3131
* Initializes the subgraph object with one of the supported networks.
3232
* @param network Supported Semaphore network.
3333
*/
34-
constructor(network: Network = "arbitrum") {
35-
checkParameter(network, "network", "string")
34+
constructor(networkOrSubgraphURL: Network | string = "arbitrum") {
35+
checkParameter(networkOrSubgraphURL, "networkOrSubgraphURL", "string")
3636

37-
this._url = getURL(network)
37+
if (networkOrSubgraphURL.startsWith("http")) {
38+
this._url = networkOrSubgraphURL
39+
return
40+
}
41+
42+
this._url = getURL(networkOrSubgraphURL as Network)
3843
}
3944

4045
/**

0 commit comments

Comments
 (0)