Skip to content

Commit c23db4e

Browse files
fix(sushi): use parameterized GraphQL variables in findToken
Build the find-token request with a parameterized GraphQL query and variables instead of interpolating args.search into the query string. This treats the input as data rather than query syntax and removes the manual JSON escaping. No change to the returned result shape. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 0fe026b commit c23db4e

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

typescript/agentkit/src/action-providers/sushi/sushiDataActionProvider.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,17 @@ Important notes:
5656
"Content-Type": "application/json",
5757
Accept: "application/json",
5858
},
59-
body: `{"query":"query { tokenList(chainId: ${chainId}, first: 10, search: \\"${args.search}\\") { address symbol name decimals } }"}`,
59+
body: JSON.stringify({
60+
query: `query FindToken($chainId: Int!, $search: String!) {
61+
tokenList(chainId: $chainId, first: 10, search: $search) {
62+
address
63+
symbol
64+
name
65+
decimals
66+
}
67+
}`,
68+
variables: { chainId, search: args.search },
69+
}),
6070
});
6171

6272
const response = await request.json();

0 commit comments

Comments
 (0)