@@ -8,7 +8,9 @@ export interface Prop {
88}
99
1010export interface Item {
11- props : Prop [ ]
11+ metadata : {
12+ props : Prop [ ]
13+ } | null
1214 id : string
1315}
1416
@@ -22,16 +24,18 @@ const fetchTokensBatch = async (id: string): Promise<Item[]> => {
2224 id_gt: "${ id } "
2325 }, first: 1000) {
2426 id
25- props {
26- label
27- value
27+ metadata {
28+ props {
29+ label
30+ value
31+ }
2832 }
2933 }
3034 }
3135 ` ,
3236 }
3337 const response = await fetch (
34- 'https://api.thegraph.com/subgraphs/name/greenlucid/ legacy-curate-xdai ' ,
38+ 'https://api.studio. thegraph.com/query/61738/ legacy-curate-gnosis/version/latest ' ,
3539 {
3640 method : 'POST' ,
3741 body : JSON . stringify ( subgraphQuery ) ,
@@ -79,13 +83,13 @@ export default async function getTokens(): Promise<TokenInfo[]> {
7983
8084 const tokens : Map < string , TokenInfo > = new Map ( )
8185 for ( const token of tokensFromSubgraph ) {
82- const caipAddress = token . props . find ( ( p ) => p . label === 'Address' )
86+ const caipAddress = token ?. metadata ? .props . find ( ( p ) => p . label === 'Address' )
8387 ?. value as string
84- const name = token . props . find ( ( p ) => p . label === 'Name' ) ?. value as string
85- const symbol = token . props . find ( ( p ) => p . label === 'Symbol' )
88+ const name = token ?. metadata ? .props . find ( ( p ) => p . label === 'Name' ) ?. value as string
89+ const symbol = token ?. metadata ? .props . find ( ( p ) => p . label === 'Symbol' )
8690 ?. value as string
87- const logo = token . props . find ( ( p ) => p . label === 'Logo' ) ?. value as string
88- const decimals = token . props . find ( ( p ) => p . label === 'Decimals' )
91+ const logo = token ?. metadata ? .props . find ( ( p ) => p . label === 'Logo' ) ?. value as string
92+ const decimals = token ?. metadata ? .props . find ( ( p ) => p . label === 'Decimals' )
8993 ?. value as string
9094
9195 const [ namespace ] = caipAddress . split ( ':' )
0 commit comments