This repository has been archived by the owner on Aug 30, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a5b231c
commit 90a040d
Showing
4 changed files
with
139 additions
and
69 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,23 @@ | ||
import type { IProfile } from "../types/Profile"; | ||
const { GridClient, Nodes } = window.configs?.grid3_client ?? {}; | ||
|
||
export default function findNodes(filters: any) { | ||
const nodes = new Nodes( | ||
"https://graphql.dev.grid.tf/graphql", | ||
"https://gridproxy.dev.grid.tf" | ||
); | ||
export default function findNodes( | ||
filters: any, | ||
profile: IProfile | ||
): Promise<number[]> { | ||
return new Promise(async (res) => { | ||
const { networkEnv } = profile; | ||
const grid = new GridClient("" as any, "", "", null); | ||
|
||
return nodes.filterNodes(filters); | ||
const { graphql, rmbProxy } = grid.getDefaultUrls(networkEnv as any); | ||
const nodes = new Nodes(graphql, rmbProxy); | ||
|
||
try { | ||
const items = await nodes.filterNodes(filters); | ||
const resNodes = items.map((node) => node.nodeId) as number[]; | ||
res(resNodes); | ||
} catch { | ||
res([]); | ||
} | ||
}); | ||
} |