Skip to content

Commit

Permalink
Merge pull request #8 from RemarkableTools/dev
Browse files Browse the repository at this point in the history
Dev to main
  • Loading branch information
axenteoctavian authored Feb 2, 2023
2 parents c524061 + a457e37 commit 074f5ee
Show file tree
Hide file tree
Showing 6 changed files with 401 additions and 139 deletions.
2 changes: 1 addition & 1 deletion src/Mx.NET.SDK/Mx.NET.SDK.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<RepositoryUrl>https://github.com/RemarkableTools/Mx.NET.SDK</RepositoryUrl>
<RepositoryType>GitHub</RepositoryType>
<Company>Remarkable Tools</Company>
<Version>1.0.5</Version>
<Version>1.0.6</Version>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Title>RemarkableTools.Mx</Title>
<PackageReadmeFile>README.md</PackageReadmeFile>
Expand Down
8 changes: 4 additions & 4 deletions src/Mx.NET.SDK/Provider/IMultiversxProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public interface IMultiversxProvider
/// <param name="from">Number of items to skip for the result set</param>
/// <param name="parameters">Parameters for query</param>
/// <returns><see cref="NFTDto"/></returns>
Task<NFTDto[]> GetAccountNFTs(string address, int size = 100, int from = 0, Dictionary<string, string> parameters = null);
Task<AccountNftDto[]> GetAccountNFTs(string address, int size = 100, int from = 0, Dictionary<string, string> parameters = null);

/// <summary>
/// Returns an array of owned NFTs/SFTs for a given address
Expand All @@ -156,7 +156,7 @@ public interface IMultiversxProvider
/// <param name="address">Wallet address in bech32 format</param>
/// <param name="nftIdentifier">Token identifier</param>
/// <returns><see cref="NFTDto"/></returns>
Task<NFTDto> GetAccountNFT(string address, string nftIdentifier);
Task<AccountNftDto> GetAccountNFT(string address, string nftIdentifier);

/// <summary>
/// Returns details about a specific NFT/SFT owned by a given address
Expand All @@ -174,7 +174,7 @@ public interface IMultiversxProvider
/// <param name="from">Number of items to skip for the result set</param>
/// <param name="parameters">Parameters for query</param>
/// <returns><see cref="MetaESDTDto"/></returns>
Task<MetaESDTDto[]> GetAccountMetaESDTs(string address, int size = 100, int from = 0, Dictionary<string, string> parameters = null);
Task<AccountMetaESDTDto[]> GetAccountMetaESDTs(string address, int size = 100, int from = 0, Dictionary<string, string> parameters = null);

/// <summary>
/// Returns an array of owned MetaESDTs for a given address
Expand All @@ -201,7 +201,7 @@ public interface IMultiversxProvider
/// <param name="address">Wallet address in bech32 format</param>
/// <param name="metaEsdtIdentifier">Token identifier</param>
/// <returns><see cref="MetaESDTDto"/></returns>
Task<MetaESDTDto> GetAccountMetaESDT(string address, string metaEsdtIdentifier);
Task<AccountMetaESDTDto> GetAccountMetaESDT(string address, string metaEsdtIdentifier);

/// <summary>
/// Returns details about a specific MetaESDT owned by a given address
Expand Down
52 changes: 26 additions & 26 deletions src/Mx.NET.SDK/Provider/MultiversxProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ public async Task<AccountTokenRoleDto> GetAccountTokenRole(string address, strin
return result;
}

public async Task<NFTDto[]> GetAccountNFTs(string address, int size = 100, int from = 0, Dictionary<string, string> parameters = null)
public async Task<AccountNftDto[]> GetAccountNFTs(string address, int size = 100, int from = 0, Dictionary<string, string> parameters = null)
{
return await GetAccountNFTsCustom<NFTDto>(address, size, from, parameters);
return await GetAccountNFTsCustom<AccountNftDto>(address, size, from, parameters);
}

public async Task<NFT[]> GetAccountNFTsCustom<NFT>(string address, int size = 100, int from = 0, Dictionary<string, string> parameters = null)
Expand All @@ -190,7 +190,7 @@ public async Task<NFT[]> GetAccountNFTsCustom<NFT>(string address, int size = 10
string args = "";
if (parameters != null)
args = $"&{string.Join("&", parameters.Select(e => $"{e.Key}={e.Value}"))}";
var response = await _httpAPIClient.GetAsync($"accounts/{address}/nfts?type={ESDTTokenType.NonFungibleESDT},{ESDTTokenType.SemiFungibleESDT}&from={from}&size={size}{args}");
var response = await _httpAPIClient.GetAsync($"accounts/{address}/nfts?excludeMetaESDT=true&from={from}&size={size}{args}");
var content = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode)
throw new APIException(JsonWrapper.Deserialize<APIExceptionResponse>(content));
Expand All @@ -204,22 +204,22 @@ public async Task<string> GetAccountNFTsCount(string address, Dictionary<string,
string args = "";
if (parameters != null)
args = $"&{string.Join("&", parameters.Select(e => $"{e.Key}={e.Value}"))}";
var response = await _httpAPIClient.GetAsync($"accounts/{address}/nfts/count?type={ESDTTokenType.NonFungibleESDT},{ESDTTokenType.SemiFungibleESDT}{args}");
var response = await _httpAPIClient.GetAsync($"accounts/{address}/nfts/count?excludeMetaESDT=true{args}");
var content = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode)
throw new APIException(JsonWrapper.Deserialize<APIExceptionResponse>(content));

return content;
}

public async Task<NFTDto> GetAccountNFT(string address, string nft)
public async Task<AccountNftDto> GetAccountNFT(string address, string nftIdentifier)
{
return await GetAccountNFTCustom<NFTDto>(address, nft);
return await GetAccountNFTCustom<AccountNftDto>(address, nftIdentifier);
}

public async Task<NFT> GetAccountNFTCustom<NFT>(string address, string nft)
public async Task<NFT> GetAccountNFTCustom<NFT>(string address, string nftIdentifier)
{
var response = await _httpAPIClient.GetAsync($"accounts/{address}/nfts/{nft}");
var response = await _httpAPIClient.GetAsync($"accounts/{address}/nfts/{nftIdentifier}");
var content = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode)
throw new APIException(JsonWrapper.Deserialize<APIExceptionResponse>(content));
Expand All @@ -228,9 +228,9 @@ public async Task<NFT> GetAccountNFTCustom<NFT>(string address, string nft)
return result;
}

public async Task<MetaESDTDto[]> GetAccountMetaESDTs(string address, int size = 100, int from = 0, Dictionary<string, string> parameters = null)
public async Task<AccountMetaESDTDto[]> GetAccountMetaESDTs(string address, int size = 100, int from = 0, Dictionary<string, string> parameters = null)
{
return await GetAccountMetaESDTsCustom<MetaESDTDto>(address, size, from, parameters);
return await GetAccountMetaESDTsCustom<AccountMetaESDTDto>(address, size, from, parameters);
}

public async Task<MetaESDT[]> GetAccountMetaESDTsCustom<MetaESDT>(string address, int size = 100, int from = 0, Dictionary<string, string> parameters = null)
Expand Down Expand Up @@ -261,14 +261,14 @@ public async Task<string> GetAccountMetaESDTsCount(string address, Dictionary<st
return content;
}

public async Task<MetaESDTDto> GetAccountMetaESDT(string address, string nft)
public async Task<AccountMetaESDTDto> GetAccountMetaESDT(string address, string metaEsdtIdentifier)
{
return await GetAccountMetaESDTCustom<MetaESDTDto>(address, nft);
return await GetAccountMetaESDTCustom<AccountMetaESDTDto>(address, metaEsdtIdentifier);
}

public async Task<MetaESDT> GetAccountMetaESDTCustom<MetaESDT>(string address, string nft)
public async Task<MetaESDT> GetAccountMetaESDTCustom<MetaESDT>(string address, string metaEsdtIdentifier)
{
var response = await _httpAPIClient.GetAsync($"accounts/{address}/nfts/{nft}");
var response = await _httpAPIClient.GetAsync($"accounts/{address}/nfts/{metaEsdtIdentifier}");
var content = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode)
throw new APIException(JsonWrapper.Deserialize<APIExceptionResponse>(content));
Expand Down Expand Up @@ -522,14 +522,14 @@ public async Task<NFT> GetNFTCustom<NFT>(string nftIdentifier)
return result;
}

public async Task<MetaESDTDto> GetMetaESDT(string nftIdentifier)
public async Task<MetaESDTDto> GetMetaESDT(string metaEsdtIdentifier)
{
return await GetMetaESDTCustom<MetaESDTDto>(nftIdentifier);
return await GetMetaESDTCustom<MetaESDTDto>(metaEsdtIdentifier);
}

public async Task<MetaESDT> GetMetaESDTCustom<MetaESDT>(string nftIdentifier)
public async Task<MetaESDT> GetMetaESDTCustom<MetaESDT>(string metaEsdtIdentifier)
{
var response = await _httpAPIClient.GetAsync($"nfts/{nftIdentifier}");
var response = await _httpAPIClient.GetAsync($"nfts/{metaEsdtIdentifier}");
var content = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode)
throw new APIException(JsonWrapper.Deserialize<APIExceptionResponse>(content));
Expand All @@ -538,10 +538,10 @@ public async Task<MetaESDT> GetMetaESDTCustom<MetaESDT>(string nftIdentifier)
return result;
}

public async Task<AddressBalanceDto[]> GetNFTAccounts(string identifier, int size = 100, int from = 0)
public async Task<AddressBalanceDto[]> GetNFTAccounts(string nftIdentifier, int size = 100, int from = 0)
{
size = size > 10000 ? 10000 : size;
var response = await _httpAPIClient.GetAsync($"nfts/{identifier}/accounts?from={from}&size={size}");
var response = await _httpAPIClient.GetAsync($"nfts/{nftIdentifier}/accounts?from={from}&size={size}");
var content = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode)
throw new APIException(JsonWrapper.Deserialize<APIExceptionResponse>(content));
Expand All @@ -550,20 +550,20 @@ public async Task<AddressBalanceDto[]> GetNFTAccounts(string identifier, int siz
return result;
}

public async Task<string> GetNFTAccountsCounter(string identifier)
public async Task<string> GetNFTAccountsCounter(string nftIdentifier)
{
var response = await _httpAPIClient.GetAsync($"nfts/{identifier}/accounts/count");
var response = await _httpAPIClient.GetAsync($"nfts/{nftIdentifier}/accounts/count");
var content = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode)
throw new APIException(JsonWrapper.Deserialize<APIExceptionResponse>(content));

return content;
}

public async Task<AddressBalanceDto[]> GetMetaESDTAccounts(string identifier, int size = 100, int from = 0)
public async Task<AddressBalanceDto[]> GetMetaESDTAccounts(string metaEsdtIdentifier, int size = 100, int from = 0)
{
size = size > 10000 ? 10000 : size;
var response = await _httpAPIClient.GetAsync($"nfts/{identifier}/accounts?from={from}&size={size}");
var response = await _httpAPIClient.GetAsync($"nfts/{metaEsdtIdentifier}/accounts?from={from}&size={size}");
var content = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode)
throw new APIException(JsonWrapper.Deserialize<APIExceptionResponse>(content));
Expand All @@ -572,9 +572,9 @@ public async Task<AddressBalanceDto[]> GetMetaESDTAccounts(string identifier, in
return result;
}

public async Task<string> GetMetaESDTAccountsCounter(string identifier)
public async Task<string> GetMetaESDTAccountsCounter(string metaEsdtIdentifier)
{
var response = await _httpAPIClient.GetAsync($"nfts/{identifier}/accounts/count");
var response = await _httpAPIClient.GetAsync($"nfts/{metaEsdtIdentifier}/accounts/count");
var content = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode)
throw new APIException(JsonWrapper.Deserialize<APIExceptionResponse>(content));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static TransactionRequest EGLDTransfer(
}

/// <summary>
/// Create transaction request - EGLD Transfer to Smart Contract with default gas limit
/// Create transaction request - EGLD Transfer to Smart Contract without gas limit
/// </summary>
/// <param name="networkConfig">MultiversX Network Configuration</param>
/// <param name="account">Sender Account</param>
Expand Down
Loading

0 comments on commit 074f5ee

Please sign in to comment.