web3.unity
web3.unity copied to clipboard
Reown. Wallet Registry. Download data of all the wallets.
The Reown Wallet Registry API has been updated. It now supports pagination. There is no API method without pagination as far ask I know ( I might be wrong). Currently we download just the first 100. We need to improve the wallet data downloading procedure to download all the available wallets.
Downloading everything in a loop should do the job.
Below is an example of interacting with the new API from the Reown repo:
private async Task LoadNextPageCoroutine()
{
_isPageLoading = true;
if (_maxWalletsCount != -1 && _nextPageToLoad * _countPerPageRealtime > _maxWalletsCount)
{
_countPerPageRealtime = _maxWalletsCount - _walletsShown;
_reachedMaxWalletsCount = true;
}
if (_countPerPageRealtime == 0)
{
_isPageLoading = false;
return;
}
var getWalletsResponse = await AppKit.ApiController.GetWallets(_nextPageToLoad, _countPerPageRealtime, _searchQuery);
// _noWalletFound.SetActive(response.Count == 0);
if (_maxWalletsCount == -1)
{
_maxWalletsCount = getWalletsResponse.Count;
if (_nextPageToLoad * _countPerPageRealtime > _maxWalletsCount)
{
_countPerPageRealtime = _maxWalletsCount - _walletsShown;
_reachedMaxWalletsCount = true;
}
}
var walletsCount = getWalletsResponse.Data.Length;
var items = new List<VisualElement>(walletsCount);
for (var i = 0; i < walletsCount; i++)
{
var wallet = getWalletsResponse.Data[i];
var item = MakeItem(wallet);
items.Add(item);
View.scrollView.Add(item);
}
_walletsShown += walletsCount;
_nextPageToLoad++;
ConfigureItemPaddings(items);
View.scrollView.ForceUpdate();
_isPageLoading = false;
}