Skip to content

Commit

Permalink
Merge pull request #9 from Etherna/improve/BNET-24-long-amount-gasprice
Browse files Browse the repository at this point in the history
Fix BNET-24
  • Loading branch information
tmm360 authored Feb 15, 2022
2 parents 9d99aad + 4780b96 commit 02a6218
Show file tree
Hide file tree
Showing 9 changed files with 184 additions and 177 deletions.
22 changes: 11 additions & 11 deletions src/BeeNet/Clients/DebugApi/BeeDebugClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ public BeeDebugClient(HttpClient httpClient, Uri baseUrl, DebugApiVersion apiVer

// Methods.
public async Task<string> BuyPostageBatchAsync(
int amount,
long amount,
int depth,
string? label = null,
bool? immutable = null,
int? gasPrice = null) =>
long? gasPrice = null) =>
CurrentApiVersion switch
{
DebugApiVersion.v1_2_0 => ((JsonElement)(await beeDebugClient_1_2_0.StampsPostAsync(amount, depth, label, immutable, gasPrice).ConfigureAwait(false)).BatchID).ToString(),
Expand All @@ -60,7 +60,7 @@ public async Task<string> BuyPostageBatchAsync(

public async Task<string> CashoutChequeForPeerAsync(
string peerId,
int? gasPrice = null,
long? gasPrice = null,
long? gasLimit = null) =>
CurrentApiVersion switch
{
Expand Down Expand Up @@ -95,17 +95,17 @@ public async Task<MessageResponseDto> DeletePeerAsync(string address) =>

public async Task<string> DeleteTransactionAsync(
string txHash,
int? gasPrice = null) =>
long? gasPrice = null) =>
CurrentApiVersion switch
{
DebugApiVersion.v1_2_0 => (await beeDebugClient_1_2_0.TransactionsDeleteAsync(txHash).ConfigureAwait(false)).TransactionHash,
DebugApiVersion.v1_2_1 => (await beeDebugClient_1_2_1.TransactionsDeleteAsync(txHash).ConfigureAwait(false)).TransactionHash,
DebugApiVersion.v1_2_0 => (await beeDebugClient_1_2_0.TransactionsDeleteAsync(txHash, gasPrice).ConfigureAwait(false)).TransactionHash,
DebugApiVersion.v1_2_1 => (await beeDebugClient_1_2_1.TransactionsDeleteAsync(txHash, gasPrice).ConfigureAwait(false)).TransactionHash,
_ => throw new InvalidOperationException()
};

public async Task<string> DepositIntoChequeBookAsync(
int amount,
int? gasPrice = null) =>
long amount,
long? gasPrice = null) =>
CurrentApiVersion switch
{
DebugApiVersion.v1_2_0 => (await beeDebugClient_1_2_0.ChequebookDepositAsync(amount, gasPrice).ConfigureAwait(false)).TransactionHash,
Expand Down Expand Up @@ -389,7 +389,7 @@ public async Task<VersionDto> SetWelcomeMessageAsync(string welcomeMessage) =>

public async Task<string> TopUpPostageBatchAsync(
string id,
int amount) =>
long amount) =>
CurrentApiVersion switch
{
DebugApiVersion.v1_2_0 => ((JsonElement)(await beeDebugClient_1_2_0.StampsTopupAsync(id, amount).ConfigureAwait(false)).BatchID).ToString(),
Expand All @@ -406,8 +406,8 @@ public async Task<string> TryConnectToPeerAsync(string peerId) =>
};

public async Task<string> WithdrawFromChequeBookAsync(
int amount,
int? gasPrice = null) =>
long amount,
long? gasPrice = null) =>
CurrentApiVersion switch
{
DebugApiVersion.v1_2_0 => (await beeDebugClient_1_2_0.ChequebookDepositAsync(amount, gasPrice).ConfigureAwait(false)).TransactionHash,
Expand Down
18 changes: 9 additions & 9 deletions src/BeeNet/Clients/DebugApi/IBeeDebugClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ public interface IBeeDebugClient
/// <returns>Returns the newly created postage batch ID</returns>
/// <exception cref="BeeNetDebugApiException">A server side error occurred.</exception>
Task<string> BuyPostageBatchAsync(
int amount,
long amount,
int depth,
string? label = null,
bool? immutable = null,
int? gasPrice = null);
long? gasPrice = null);

/// <summary>Cashout the last cheque for the peer</summary>
/// <param name="peerId">Swarm address of peer</param>
Expand All @@ -46,7 +46,7 @@ Task<string> BuyPostageBatchAsync(
/// <exception cref="BeeNetDebugApiException">A server side error occurred.</exception>
Task<string> CashoutChequeForPeerAsync(
string peerId,
int? gasPrice = null,
long? gasPrice = null,
long? gasLimit = null);

/// <summary>Connect to address</summary>
Expand Down Expand Up @@ -74,16 +74,16 @@ Task<string> CashoutChequeForPeerAsync(
/// <exception cref="BeeNetDebugApiException">A server side error occurred.</exception>
Task<string> DeleteTransactionAsync(
string txHash,
int? gasPrice = null);
long? gasPrice = null);

/// <summary>Deposit tokens from overlay address into chequebook</summary>
/// <param name="amount">amount of tokens to deposit</param>
/// <param name="gasPrice">Gas price for transaction</param>
/// <returns>Transaction hash of the deposit transaction</returns>
/// <exception cref="BeeNetDebugApiException">A server side error occurred.</exception>
Task<string> DepositIntoChequeBookAsync(
int amount,
int? gasPrice = null);
long amount,
long? gasPrice = null);

/// <summary>Dilute an existing postage batch.</summary>
/// <param name="id">Batch ID to dilute</param>
Expand Down Expand Up @@ -272,7 +272,7 @@ Task<string> DepositIntoChequeBookAsync(
/// <param name="amount">Amount of BZZ per chunk to top up to an existing postage batch.</param>
/// <returns>Returns the postage batch ID that was topped up</returns>
/// <exception cref="BeeNetDebugApiException">A server side error occurred.</exception>
Task<string> TopUpPostageBatchAsync(string id, int amount);
Task<string> TopUpPostageBatchAsync(string id, long amount);

/// <summary>Try connection to node</summary>
/// <param name="peerId">Swarm address of peer</param>
Expand All @@ -286,7 +286,7 @@ Task<string> DepositIntoChequeBookAsync(
/// <returns>Transaction hash of the withdraw transaction</returns>
/// <exception cref="BeeNetDebugApiException">A server side error occurred.</exception>
Task<string> WithdrawFromChequeBookAsync(
int amount,
int? gasPrice = null);
long amount,
long? gasPrice = null);
}
}
Loading

0 comments on commit 02a6218

Please sign in to comment.