src/Stratis.FederatedPeg.Features.FederationGateway/TargetChain/WithdrawalHistoryProvider.cs
/// <summary>
/// Get the history of withdrawals and statuses.
/// </summary>
/// <param name="maximumEntriesToReturn">The maximum number of entries to return.</param>
/// <returns>A <see cref="WithdrawalModel"/> object containing a history of withdrawals and statuses.</returns>
Get the history of withdrawals and statuses.
Get the history of withdrawals and statuses .
public List<WithdrawalModel> GetHistory(int maximumEntriesToReturn)
        {
            var result = new List<WithdrawalModel>();
            IWithdrawal[] withdrawals = this.federationWalletManager.GetWithdrawals().Take(maximumEntriesToReturn).ToArray();
            if (withdrawals.Length > 0)
            {
                ICrossChainTransfer[] transfers = this.crossChainTransferStore.GetAsync(withdrawals.Select(w => w.DepositId).ToArray()).GetAwaiter().GetResult().ToArray();
                for (int i = 0; i < withdrawals.Length; i++)
                {
                    ICrossChainTransfer transfer = transfers[i];
                    var model = new WithdrawalModel();
                    model.withdrawal = withdrawals[i];
                    string status = transfer?.Status.ToString();
                    switch (transfer?.Status)
                    {
                        case CrossChainTransferStatus.FullySigned:
                            if (this.mempoolManager.InfoAsync(model.withdrawal.Id).GetAwaiter().GetResult() != null)
                                status += "+InMempool";
                            break;
                        case CrossChainTransferStatus.Partial:
                            status += " (" + transfer.GetSignatureCount(this.network) + "/" + this.federationGatewaySettings.MultiSigM + ")";
                            break;
                    }
                    model.TransferStatus = status;
                    result.Add(model);
                }
            }
            return result;
        }
public List < WithdrawalModel > GetHistory ( int maximumEntriesToReturn ) { var result = new List < WithdrawalModel > ( ) ; IWithdrawal [ ] withdrawals = this . federationWalletManager . GetWithdrawals ( ) . Take ( maximumEntriesToReturn ) . ToArray ( ) ; if ( withdrawals . Length > 0 ) { ICrossChainTransfer [ ] transfers = this . crossChainTransferStore . GetAsync ( withdrawals . Select ( w => w . DepositId ) . ToArray ( ) ) . GetAwaiter ( ) . GetResult ( ) . ToArray ( ) ; for ( int i = 0 ; i < withdrawals . Length ; i ++ ) { ICrossChainTransfer transfer = transfers [ i ] ; var model = new WithdrawalModel ( ) ; model . withdrawal = withdrawals [ i ] ; string status = transfer ? . Status . ToString ( ) ; switch ( transfer ? . Status ) { case CrossChainTransferStatus . FullySigned : if ( this . mempoolManager . InfoAsync ( model . withdrawal . Id ) . GetAwaiter ( ) . GetResult ( ) != null ) status += " " ; break ; case CrossChainTransferStatus . Partial : status += " " + transfer . GetSignatureCount ( this . network ) + " " + this . federationGatewaySettings . MultiSigM + " " ; break ; } model . TransferStatus = status ; result . Add ( model ) ; } } return result ; }
Get the history of withdrawals and statuses.
Get the history of withdrawals and statuses .
A  object containing a history of withdrawals and statuses.
A object containing a history of withdrawals and statuses .
maximumEntriesToReturn
int
The maximum number of entries to return.
The maximum number of entries to return .