Skip to content

Update Jupiter endpoints #55

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all 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
10 changes: 5 additions & 5 deletions src/Solana.Unity.Dex/Jupiter/JupiterDex.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class JupiterDexAg: IDexAggregator
/// Public constructor; Create the JupiterDexAg instance with the account to use for the aggregator.
/// </summary>
/// <param name="endpoint"></param>
public JupiterDexAg(string endpoint = "https://quote-api.jup.ag/v6")
public JupiterDexAg(string endpoint = "https://api.jup.ag/")
{
_endpoint = endpoint;
_httpClient = new HttpClient();
Expand All @@ -56,7 +56,7 @@ public JupiterDexAg(string endpoint = "https://quote-api.jup.ag/v6")
/// </summary>
/// <param name="account"></param>
/// <param name="endpoint"></param>
public JupiterDexAg(PublicKey account, string endpoint = "https://quote-api.jup.ag/v6")
public JupiterDexAg(PublicKey account, string endpoint = "https://api.jup.ag/")
{
_account = account;
_endpoint = endpoint;
Expand Down Expand Up @@ -108,7 +108,7 @@ public async Task<SwapQuoteAg> GetSwapQuote(
var queryString = string.Join("&", queryParams.Select(kv => $"{kv.Key}={kv.Value}"));

// Construct the request URL
var apiUrl = _endpoint + "/quote?" + queryString;
var apiUrl = _endpoint + "/swap/v1/quote?" + queryString;

using var httpReq = new HttpRequestMessage(HttpMethod.Get, apiUrl);

Expand Down Expand Up @@ -141,7 +141,7 @@ public async Task<Transaction> Swap(
userPublicKey ??= _account;

// Construct the request URL
var apiUrl = _endpoint + "/swap";
var apiUrl = _endpoint + "/swap/v1/swap";

var req = new SwapRequest()
{
Expand Down Expand Up @@ -222,4 +222,4 @@ public async Task<TokenData> GetTokenByMint(string mint)
IList<TokenData> tokens = await GetTokens(TokenListType.All);
return tokens.First(t => string.Equals(t.Mint, mint, StringComparison.CurrentCultureIgnoreCase));
}
}
}