Skip to content

Commit 53e2527

Browse files
committed
feat: use pkce login for windows
1 parent 0bd9955 commit 53e2527

33 files changed

+279
-290
lines changed

Assets/Runner/Scripts/Spawnable.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ protected virtual void Awake()
5151
#if UNITY_EDITOR
5252
if (PrefabUtility.IsPartOfNonAssetPrefabInstance(gameObject))
5353
#endif
54-
m_Transform.SetParent(LevelManager.Instance.transform);
54+
m_Transform.SetParent(LevelManager.Instance.transform);
5555
}
5656
}
5757

Assets/Shared/Scripts/AudioManager.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ public class AudioManager : AbstractSingleton<AudioManager>
1515

1616
[SerializeField] private AudioSource m_EffectSource;
1717

18-
[SerializeField]
19-
[Min(0f)]
20-
private float m_MinSoundInterval = 0.1f;
18+
[SerializeField] [Min(0f)] private float m_MinSoundInterval = 0.1f;
2119

2220
[SerializeField] private SoundIDClipPair[] m_Sounds;
2321

Assets/Shared/Scripts/AutoExpandGridLayoutGroup.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ public override void CalculateLayoutInputVertical()
115115
var minRows = 0;
116116
if (m_Constraint == Constraint.FixedColumnCount)
117117
{
118-
119118
minRows = Mathf.CeilToInt(rectChildren.Count / (float)m_ConstraintCount - 0.001f);
120119
}
121120
else if (m_Constraint == Constraint.FixedRowCount)

Assets/Shared/Scripts/ClickableView.cs

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,15 @@ public class ClickableView : MonoBehaviour, IPointerClickHandler, IBeginDragHand
88
{
99
public delegate void OnClickAction();
1010

11-
public event OnClickAction OnClick;
11+
private bool m_IsDragging;
1212

1313
private ScrollRect m_ParentScrollRect;
14-
private bool m_IsDragging;
1514

1615
private void Awake()
1716
{
1817
m_ParentScrollRect = GetComponentInParent<ScrollRect>();
1918
}
2019

21-
public void ClearAllSubscribers()
22-
{
23-
OnClick = null;
24-
}
25-
26-
public void OnPointerClick(PointerEventData eventData)
27-
{
28-
if (!m_IsDragging)
29-
{
30-
OnClick?.Invoke();
31-
}
32-
}
33-
3420
public void OnBeginDrag(PointerEventData eventData)
3521
{
3622
m_IsDragging = true;
@@ -47,5 +33,17 @@ public void OnEndDrag(PointerEventData eventData)
4733
m_IsDragging = false;
4834
m_ParentScrollRect?.OnEndDrag(eventData);
4935
}
36+
37+
public void OnPointerClick(PointerEventData eventData)
38+
{
39+
if (!m_IsDragging) OnClick?.Invoke();
40+
}
41+
42+
public event OnClickAction OnClick;
43+
44+
public void ClearAllSubscribers()
45+
{
46+
OnClick = null;
47+
}
5048
}
5149
}

Assets/Shared/Scripts/Domain/CancelListingUseCase.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,19 @@ public class CancelListingUseCase
1717

1818
private readonly OrderbookApi m_OrderbookApi = new(new Configuration { BasePath = Config.BASE_URL });
1919

20-
private CancelListingUseCase() { }
20+
private CancelListingUseCase()
21+
{
22+
}
2123

2224
public static CancelListingUseCase Instance => s_Instance.Value;
2325

2426
/// <summary>
25-
/// Cancels the specified listing.
27+
/// Cancels the specified listing.
2628
/// </summary>
2729
/// <param name="listingId">The unique identifier of the listing to cancel.</param>
2830
/// <param name="confirmListing">
29-
/// If true, the function will poll the listing endpoint to confirm that the listing status
30-
/// has changed to "CANCELLED". If false, the function will not verify the listing status.
31+
/// If true, the function will poll the listing endpoint to confirm that the listing status
32+
/// has changed to "CANCELLED". If false, the function will not verify the listing status.
3133
/// </param>
3234
public async UniTask CancelListing(string listingId, bool confirmListing = true)
3335
{
@@ -63,7 +65,7 @@ public async UniTask CancelListing(string listingId, bool confirmListing = true)
6365
}
6466

6567
/// <summary>
66-
/// Handles API exceptions by logging relevant details.
68+
/// Handles API exceptions by logging relevant details.
6769
/// </summary>
6870
private static void HandleApiException(ApiException e)
6971
{
@@ -74,4 +76,4 @@ private static void HandleApiException(ApiException e)
7476
if (errorModel != null) throw new Exception(errorModel.message);
7577
}
7678
}
77-
}
79+
}

Assets/Shared/Scripts/Domain/CreateOrderUseCase.cs

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,31 +21,33 @@ public class CreateOrderUseCase
2121

2222
private readonly OrderbookApi m_OrderbookApi = new(new Configuration { BasePath = Config.BASE_URL });
2323

24-
private CreateOrderUseCase() { }
24+
private CreateOrderUseCase()
25+
{
26+
}
2527

2628
public static CreateOrderUseCase Instance => s_Instance.Value;
2729

2830
/// <summary>
29-
/// Creates a new listing for the specified NFT.
31+
/// Creates a new listing for the specified NFT.
3032
/// </summary>
3133
/// <param name="contractAddress">The address of the NFT's contract.</param>
3234
/// <param name="contractType">The type of the contract (e.g., "ERC721" or "ERC1155").</param>
3335
/// <param name="tokenId">The ID of the NFT.</param>
3436
/// <param name="price">
35-
/// The sale price of the NFT, represented as a string amount in IMR (scaled by 10^18).
37+
/// The sale price of the NFT, represented as a string amount in IMR (scaled by 10^18).
3638
/// </param>
3739
/// <param name="amountToSell">
38-
/// The quantity of the NFT to sell. "1" for ERC721 tokens and a higher number for ERC1155 tokens.
40+
/// The quantity of the NFT to sell. "1" for ERC721 tokens and a higher number for ERC1155 tokens.
3941
/// </param>
4042
/// <param name="buyContractAddress">
41-
/// The contract address of the token used to purchase the NFT.
43+
/// The contract address of the token used to purchase the NFT.
4244
/// </param>
4345
/// <param name="confirmListing">
44-
/// If true, the function will continuously poll the marketplace endpoint to ensure the listing status
45-
/// updates to "ACTIVE" upon creation. If false, the function will not verify the listing status.
46+
/// If true, the function will continuously poll the marketplace endpoint to ensure the listing status
47+
/// updates to "ACTIVE" upon creation. If false, the function will not verify the listing status.
4648
/// </param>
4749
/// <returns>
48-
/// A <see cref="UniTask{String}"/> that returns the listing ID if the sale is successfully created.
50+
/// A <see cref="UniTask{String}" /> that returns the listing ID if the sale is successfully created.
4951
/// </returns>
5052
public async UniTask<string> CreateListing(
5153
string contractAddress, string contractType, string tokenId,
@@ -54,11 +56,11 @@ public async UniTask<string> CreateListing(
5456
try
5557
{
5658
if (contractType == "ERC721" && amountToSell != "1")
57-
{
58-
throw new ArgumentException("Invalid arguments: 'amountToSell' must be '1' when listing an ERC721.");
59-
}
59+
throw new ArgumentException(
60+
"Invalid arguments: 'amountToSell' must be '1' when listing an ERC721.");
6061

61-
var listingData = await PrepareListing(contractAddress, contractType, tokenId, price, amountToSell, buyContractAddress);
62+
var listingData = await PrepareListing(contractAddress, contractType, tokenId, price, amountToSell,
63+
buyContractAddress);
6264

6365
await SignAndSubmitApproval(listingData);
6466

@@ -78,7 +80,7 @@ public async UniTask<string> CreateListing(
7880
}
7981

8082
/// <summary>
81-
/// Prepares a listing for the specified NFT and purchase details.
83+
/// Prepares a listing for the specified NFT and purchase details.
8284
/// </summary>
8385
private async UniTask<PrepareListing200Response> PrepareListing(
8486
string contractAddress, string contractType, string tokenId,
@@ -95,7 +97,7 @@ private async UniTask<PrepareListing200Response> PrepareListing(
9597
}
9698

9799
/// <summary>
98-
/// Creates the appropriate sell request based on the contract type.
100+
/// Creates the appropriate sell request based on the contract type.
99101
/// </summary>
100102
private static PrepareListingRequestSell CreateSellRequest(
101103
string contractType, string contractAddress, string tokenId, string amountToSell)
@@ -109,7 +111,7 @@ private static PrepareListingRequestSell CreateSellRequest(
109111
}
110112

111113
/// <summary>
112-
/// Signs and submits approval if required by the listing.
114+
/// Signs and submits approval if required by the listing.
113115
/// </summary>
114116
private async UniTask SignAndSubmitApproval(PrepareListing200Response listingData)
115117
{
@@ -132,7 +134,7 @@ private async UniTask SignAndSubmitApproval(PrepareListing200Response listingDat
132134
}
133135

134136
/// <summary>
135-
/// Signs the listing with the user's wallet.
137+
/// Signs the listing with the user's wallet.
136138
/// </summary>
137139
private async UniTask<string> SignListing(PrepareListing200Response listingData)
138140
{
@@ -148,7 +150,7 @@ private async UniTask<string> SignListing(PrepareListing200Response listingData)
148150
}
149151

150152
/// <summary>
151-
/// Finalises the listing and returns the listing ID.
153+
/// Finalises the listing and returns the listing ID.
152154
/// </summary>
153155
private async UniTask<string> ListAsset(string signature, PrepareListing200Response listingData)
154156
{
@@ -162,7 +164,7 @@ private async UniTask<string> ListAsset(string signature, PrepareListing200Respo
162164
}
163165

164166
/// <summary>
165-
/// Handles API exceptions by logging relevant details.
167+
/// Handles API exceptions by logging relevant details.
166168
/// </summary>
167169
private static void HandleApiException(ApiException e)
168170
{
@@ -173,4 +175,4 @@ private static void HandleApiException(ApiException e)
173175
if (errorModel != null) throw new Exception(errorModel.message);
174176
}
175177
}
176-
}
178+
}

Assets/Shared/Scripts/Domain/FulfilOrderUseCase.cs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,23 @@ public class FulfilOrderUseCase
1717

1818
private readonly OrderbookApi m_OrderbookApi = new(new Configuration { BasePath = Config.BASE_URL });
1919

20-
private FulfilOrderUseCase() { }
20+
private FulfilOrderUseCase()
21+
{
22+
}
2123

2224
public static FulfilOrderUseCase Instance => s_Instance.Value;
2325

2426
/// <summary>
25-
/// Executes an order by fulfilling a listing and optionally confirming its status.
27+
/// Executes an order by fulfilling a listing and optionally confirming its status.
2628
/// </summary>
2729
/// <param name="listingId">The unique identifier of the listing to fulfil.</param>
2830
/// <param name="fees">The taker fees</param>
2931
/// <param name="confirmListing">
30-
/// If true, the function will poll the listing endpoint to confirm that the listing status
31-
/// has changed to "FILLED". If false, the function will not verify the listing status.
32+
/// If true, the function will poll the listing endpoint to confirm that the listing status
33+
/// has changed to "FILLED". If false, the function will not verify the listing status.
3234
/// </param>
33-
public async UniTask ExecuteOrder(string listingId, List<FulfillOrderRequestTakerFeesInner> fees, bool confirmListing = true)
35+
public async UniTask ExecuteOrder(string listingId, List<FulfillOrderRequestTakerFeesInner> fees,
36+
bool confirmListing = true)
3437
{
3538
try
3639
{
@@ -42,7 +45,6 @@ public async UniTask ExecuteOrder(string listingId, List<FulfillOrderRequestTake
4245
var createListingResponse = await m_OrderbookApi.FulfillOrderAsync(request);
4346

4447
if (createListingResponse.Actions.Count > 0)
45-
{
4648
foreach (var transaction in createListingResponse.Actions)
4749
{
4850
var transactionHash = await Passport.Instance.ZkEvmSendTransaction(new TransactionRequest
@@ -53,7 +55,6 @@ public async UniTask ExecuteOrder(string listingId, List<FulfillOrderRequestTake
5355
});
5456
Debug.Log($"Transaction hash: {transactionHash}");
5557
}
56-
}
5758

5859
if (confirmListing) await OrderbookUseCase.Instance.ConfirmListingStatus(listingId, "FILLED");
5960
}
@@ -65,7 +66,7 @@ public async UniTask ExecuteOrder(string listingId, List<FulfillOrderRequestTake
6566
}
6667

6768
/// <summary>
68-
/// Handles API exceptions by logging relevant details.
69+
/// Handles API exceptions by logging relevant details.
6970
/// </summary>
7071
private static void HandleApiException(ApiException e)
7172
{
@@ -76,4 +77,4 @@ private static void HandleApiException(ApiException e)
7677
if (errorModel != null) throw new Exception(errorModel.message);
7778
}
7879
}
79-
}
80+
}

Assets/Shared/Scripts/Domain/GetTokenBalanceUseCase.cs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,27 @@ public class GetTokenBalanceUseCase
1515

1616
private readonly OrderbookApi m_OrderbookApi = new(new Configuration { BasePath = Config.BASE_URL });
1717

18-
private GetTokenBalanceUseCase() { }
18+
private GetTokenBalanceUseCase()
19+
{
20+
}
1921

2022
public static GetTokenBalanceUseCase Instance => s_Instance.Value;
2123

2224
/// <summary>
23-
/// Gets the user's ERC20 token balance
25+
/// Gets the user's ERC20 token balance
2426
/// </summary>
2527
public async UniTask<string> GetBalance()
2628
{
2729
var result = await m_OrderbookApi.TokenBalanceAsync(
28-
walletAddress: SaveManager.Instance.WalletAddress,
29-
contractAddress: Contract.TOKEN
30+
SaveManager.Instance.WalletAddress,
31+
Contract.TOKEN
3032
);
3133
var rounded = Math.Round(Convert.ToDecimal(result.Quantity), 2);
3234
return rounded.ToString("F2");
3335
}
3436

3537
/// <summary>
36-
/// Gets the user's IMX balance
38+
/// Gets the user's IMX balance
3739
/// </summary>
3840
public async UniTask<string> GetImxBalance()
3941
{
@@ -51,13 +53,14 @@ public async UniTask<string> GetImxBalance()
5153
}
5254

5355
/// <summary>
54-
/// Gets the user's USDC balance
56+
/// Gets the user's USDC balance
5557
/// </summary>
5658
public async UniTask<string> GetUsdcBalance()
5759
{
5860
var web3 = new Web3(Config.RPC_URL);
5961

60-
var abi = @"[{'constant':true,'inputs':[{'name':'account','type':'address'}],'name':'balanceOf','outputs':[{'name':'','type':'uint256'}],'payable':false,'stateMutability':'view','type':'function'}]";
62+
var abi =
63+
@"[{'constant':true,'inputs':[{'name':'account','type':'address'}],'name':'balanceOf','outputs':[{'name':'','type':'uint256'}],'payable':false,'stateMutability':'view','type':'function'}]";
6164

6265
var contract = web3.Eth.GetContract(abi, Contract.USDC);
6366

@@ -70,4 +73,4 @@ public async UniTask<string> GetUsdcBalance()
7073
return quantity.ToString("F2");
7174
}
7275
}
73-
}
76+
}

Assets/Shared/Scripts/Domain/OrderbookUseCase.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,20 @@ public class OrderbookUseCase
99
{
1010
private static readonly Lazy<OrderbookUseCase> s_Instance = new(() => new OrderbookUseCase());
1111

12-
private OrderbookUseCase() { }
12+
private OrderbookUseCase()
13+
{
14+
}
1315

1416
public static OrderbookUseCase Instance => s_Instance.Value;
1517

1618
/// <summary>
17-
/// Confirms the status of a listing by repeatedly polling until it matches the specified status or the operation times out.
19+
/// Confirms the status of a listing by repeatedly polling until it matches the specified status or the operation times
20+
/// out.
1821
/// </summary>
1922
/// <param name="listingId">The unique identifier of the listing.</param>
2023
/// <param name="desiredStatus">The target status to be matched (e.g., "ACTIVE", "FILLED" or "CANCELLED").</param>
2124
/// <returns>
22-
/// A <see cref="UniTask"/> that completes when the listing reaches the desired status or the operation times out.
25+
/// A <see cref="UniTask" /> that completes when the listing reaches the desired status or the operation times out.
2326
/// </returns>
2427
public async UniTask ConfirmListingStatus(string listingId, string desiredStatus)
2528

@@ -63,4 +66,4 @@ public async UniTask ConfirmListingStatus(string listingId, string desiredStatus
6366
}
6467
}
6568
}
66-
}
69+
}

0 commit comments

Comments
 (0)