Skip to content

Commit e39a807

Browse files
Point swap APIs to new endpoint as the old one is now deprecated (#282)
* Point swap APIs to new endpoint as the old one is now deprecated * Update package.json
1 parent 72c77d9 commit e39a807

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

Assets/SequenceSDK/Marketplace/CurrencySwapTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public async Task GetSwapQuoteTest_FailedToFetchPrice()
117117
}
118118
catch (Exception e)
119119
{
120-
Assert.IsTrue(e.Message.Contains("Error fetching swap price"));
120+
Assert.IsTrue(e.Message.Contains("Error fetching swap quote"));
121121
}
122122
}
123123
}

Packages/Sequence-Unity/Sequence/SequenceSDK/Marketplace/CurrencySwap.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,17 @@ public async Task<SwapPrice> GetSwapPrice(Address buyCurrency, Address sellCurre
3535
{
3636
GetSwapPriceRequest args = new GetSwapPriceRequest(buyCurrency, sellCurrency, buyAmount, _chain,
3737
slippagePercent);
38-
string url = BaseUrl.AppendTrailingSlashIfNeeded() + "GetSwapPrice";
38+
string url = BaseUrl.AppendTrailingSlashIfNeeded() + "GetSwapPermit2Price";
3939
try
4040
{
4141
GetSwapPriceResponse response =
4242
await _client.SendRequest<GetSwapPriceRequest, GetSwapPriceResponse>(url, args);
43-
if (response.swapPrice == null)
43+
if (response.swapPermit2Price == null)
4444
{
4545
throw new Exception("No swap path with sufficient liquidity found");
4646
}
47-
OnSwapPriceReturn?.Invoke(response.swapPrice);
48-
return response.swapPrice;
47+
OnSwapPriceReturn?.Invoke(response.swapPermit2Price);
48+
return response.swapPermit2Price;
4949
}
5050
catch (Exception e)
5151
{
@@ -64,13 +64,13 @@ public async Task<SwapPrice[]> GetSwapPrices(Address userWallet, Address buyCurr
6464
{
6565
GetSwapPricesRequest args = new GetSwapPricesRequest(userWallet, buyCurrency, buyAmount, _chain,
6666
slippagePercentage);
67-
string url = BaseUrl.AppendTrailingSlashIfNeeded() + "GetSwapPrices";
67+
string url = BaseUrl.AppendTrailingSlashIfNeeded() + "GetSwapPermit2Prices";
6868
try
6969
{
7070
GetSwapPricesResponse response =
7171
await _client.SendRequest<GetSwapPricesRequest, GetSwapPricesResponse>(url, args);
72-
OnSwapPricesReturn?.Invoke(response.swapPrices);
73-
return response.swapPrices;
72+
OnSwapPricesReturn?.Invoke(response.swapPermit2Prices);
73+
return response.swapPermit2Prices;
7474
}
7575
catch (Exception e)
7676
{
@@ -102,7 +102,7 @@ await AssertWeHaveSufficientBalance(userWallet, buyCurrency, sellCurrency, buyAm
102102

103103
GetSwapQuoteRequest args = new GetSwapQuoteRequest(userWallet, buyCurrency, sellCurrency, buyAmount, _chain,
104104
slippagePercentage, includeApprove);
105-
string url = BaseUrl.AppendTrailingSlashIfNeeded() + "GetSwapQuote";
105+
string url = BaseUrl.AppendTrailingSlashIfNeeded() + "GetSwapQuoteV2";
106106
try
107107
{
108108
GetSwapQuoteResponse response =

Packages/Sequence-Unity/Sequence/SequenceSDK/Marketplace/DataTypes/GetSwapPriceResponse.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ namespace Sequence.Marketplace
66
[Serializable]
77
internal class GetSwapPriceResponse
88
{
9-
public SwapPrice swapPrice;
9+
public SwapPrice swapPermit2Price;
1010

1111
[Preserve]
12-
public GetSwapPriceResponse(SwapPrice swapPrice)
12+
public GetSwapPriceResponse(SwapPrice swapPermit2Price)
1313
{
14-
this.swapPrice = swapPrice;
14+
this.swapPermit2Price = swapPermit2Price;
1515
}
1616
}
1717
}

Packages/Sequence-Unity/Sequence/SequenceSDK/Marketplace/DataTypes/GetSwapPricesResponse.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ namespace Sequence.Marketplace
66
[Serializable]
77
public class GetSwapPricesResponse
88
{
9-
public SwapPrice[] swapPrices;
9+
public SwapPrice[] swapPermit2Prices;
1010

1111
[Preserve]
12-
public GetSwapPricesResponse(SwapPrice[] swapPrices)
12+
public GetSwapPricesResponse(SwapPrice[] swapPermit2Prices)
1313
{
14-
this.swapPrices = swapPrices;
14+
this.swapPermit2Prices = swapPermit2Prices;
1515
}
1616
}
1717
}

Packages/Sequence-Unity/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "xyz.0xsequence.waas-unity",
3-
"version": "4.0.2",
3+
"version": "4.0.3",
44
"displayName": "Sequence Embedded Wallet SDK",
55
"description": "A Unity SDK for Sequence APIs",
66
"unity": "2021.3",

0 commit comments

Comments
 (0)