-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
39 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System; | ||
using Cysharp.Threading.Tasks; | ||
using Immutable.Orderbook.Api; | ||
using Immutable.Orderbook.Client; | ||
|
||
namespace HyperCasual.Runner | ||
{ | ||
public class GetTokenBalanceUseCase | ||
{ | ||
private static readonly Lazy<GetTokenBalanceUseCase> s_Instance = new(() => new GetTokenBalanceUseCase()); | ||
|
||
private readonly OrderbookApi m_OrderbookApi = new(new Configuration { BasePath = Config.BASE_URL }); | ||
|
||
private GetTokenBalanceUseCase() { } | ||
|
||
public static GetTokenBalanceUseCase Instance => s_Instance.Value; | ||
|
||
/// <summary> | ||
/// Gets the user's ERC20 token balance | ||
/// </summary> | ||
public async UniTask<string> GetBalance() | ||
{ | ||
var result = await m_OrderbookApi.TokenBalanceAsync( | ||
walletAddress: SaveManager.Instance.WalletAddress, | ||
contractAddress: Contract.TOKEN | ||
); | ||
return result.Quantity; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters