Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: migrate-subgraph #56

Merged
merged 3 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 2 additions & 2 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"
spec: '@yarnpkg/plugin-workspace-tools'
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"
spec: '@yarnpkg/plugin-interactive-tools'

yarnPath: .yarn/releases/yarn-3.3.1.cjs
12 changes: 7 additions & 5 deletions packages/site/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,18 @@ const Index = () => {
useEffect(() => {
const fetchData = async () => {
const response = await axios.post(
'https://api.thegraph.com/subgraphs/name/kleros/legacy-curate-xdai',
'https://api.studio.thegraph.com/query/61738/legacy-curate-gnosis/version/latest',
{
query: `
{
litems(first:1000, where:{registry:"0xfdb66ad9576842945431c27fe8cb5ef8ed5cb8bb", status_in:[Registered], disputed:false})
{
itemID
key0
key1
key2
metadata {
key0
key1
key2
}
}
}
`,
Expand Down Expand Up @@ -187,7 +189,7 @@ const Index = () => {
</Subtext>
<SearchResultList>
{filteredPackages.map((pkg) => {
const isVerified = packages.some((item) => item.key0 === pkg.name);
const isVerified = packages.some((item) => item?.metadata?.key0 === pkg.name);
return (
<SearchResultItem
key={pkg.name}
Expand Down
64 changes: 38 additions & 26 deletions packages/snap/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,34 +51,46 @@ const fetchGraphQLData = async (variables: {
query($targetAddress: String!, $domain: String!) {
addressTags: litems(where:{
registry:"0x66260c69d03837016d88c9877e61e08ef74c59f2",
key0_starts_with_nocase: $targetAddress,
key0_ends_with_nocase: $targetAddress,
metadata_: {
key0_starts_with_nocase: $targetAddress,
key0_ends_with_nocase: $targetAddress,
},
status_in:[Registered, ClearingRequested]
}, first: 1) {
key0
key1
key2
key3
metadata {
key0
key1
key2
key3
}
}
contractDomains: litems(where:{
registry:"0x957a53a994860be4750810131d9c876b2f52d6e1",
key0_starts_with_nocase: $targetAddress,
key0_ends_with_nocase: $targetAddress,
key1: $domain,
metadata_: {
key0_starts_with_nocase: $targetAddress,
key0_ends_with_nocase: $targetAddress,
key1: $domain,
},
status_in:[Registered, ClearingRequested]
}, first: 1) {
key0
key1
metadata {
key0
key1
}
}
tokens: litems(where:{
registry:"0x70533554fe5c17caf77fe530f77eab933b92af60",
key0_starts_with_nocase: $targetAddress,
key0_ends_with_nocase: $targetAddress,
metadata_: {
key0_starts_with_nocase: $targetAddress,
key0_ends_with_nocase: $targetAddress,
},
status_in:[Registered, ClearingRequested]
}, first: 1) {
key0
key1
key2
metadata {
key0
key1
key2
}
}
}
`;
Expand All @@ -87,7 +99,7 @@ const fetchGraphQLData = async (variables: {

try {
const response = await fetch(
'https://api.thegraph.com/subgraphs/name/kleros/legacy-curate-xdai',
'https://api.studio.thegraph.com/query/61738/legacy-curate-gnosis/version/latest',
{
method: 'POST',
headers: {
Expand Down Expand Up @@ -119,26 +131,26 @@ const fetchGraphQLData = async (variables: {

const parsedAddressTag: AddressTag | undefined = result.data.addressTags[0]
? {
caipAddress: mdEscape(result.data.addressTags[0].key0),
publicName: mdEscape(result.data.addressTags[0].key1),
projectName: mdEscape(result.data.addressTags[0].key2),
infoLink: mdEscape(result.data.addressTags[0].key3),
caipAddress: mdEscape(result.data.addressTags[0]?.metadata?.key0),
publicName: mdEscape(result.data.addressTags[0]?.metadata?.key1),
projectName: mdEscape(result.data.addressTags[0]?.metadata?.key2),
infoLink: mdEscape(result.data.addressTags[0]?.metadata?.key3),
}
: undefined;

const parsedContractDomain: ContractDomain | undefined = result.data
.contractDomains[0]
? {
caipAddress: mdEscape(result.data.contractDomains[0].key0),
domain: mdEscape(result.data.contractDomains[0].key1),
caipAddress: mdEscape(result.data.contractDomains[0]?.metadata?.key0),
domain: mdEscape(result.data.contractDomains[0]?.metadata?.key1),
}
: undefined;

const parsedToken: Token | undefined = result.data.tokens[0]
? {
caipAddress: mdEscape(result.data.tokens[0].key0),
name: mdEscape(result.data.tokens[0].key1),
symbol: mdEscape(result.data.tokens[0].key2),
caipAddress: mdEscape(result.data.tokens[0]?.metadata?.key0),
name: mdEscape(result.data.tokens[0]?.metadata?.key1),
symbol: mdEscape(result.data.tokens[0]?.metadata?.key2),
}
: undefined;

Expand Down
Loading