/// <summary>
        /// Retrieves all records having the given transaction ID, including duplicates
        /// that were rejected or produced errors during execution.  Typically there is
        /// only one record per transaction, but in some cases, deliberate or accidental
        /// there may be more than one for a given transaction ID.
        /// </summary>
        /// <param name="transaction">
        /// Transaction identifier of the record
        /// </param>
        /// <param name="configure">
        /// Optional callback method providing an opportunity to modify
        /// the execution configuration for just this method call.
        /// It is executed prior to submitting the request to the network.
        /// </param>
        /// <returns>
        /// An collection of all the transaction records known to the system
        /// at the time of query having the identified transaction id.
        /// </returns>
        public async Task <ReadOnlyCollection <TransactionRecord> > GetAllTransactionRecordsAsync(TxId transaction, Action <IContext>?configure = null)
        {
            await using var context = CreateChildContext(configure);
            var transactionId = new TransactionID(transaction);

            // For the public version of this method, we do not know
            // if the transaction in question has come to consensus so
            // we need to get the receipt first (and wait if necessary).
            // The Receipt status returned does notmatter in this case.
            // We may be retrieving a failed record (the status would not equal OK).
            await WaitForConsensusReceipt(context, transactionId).ConfigureAwait(false);

            var response = await ExecuteQueryInContextAsync(new TransactionGetRecordQuery(transactionId, true), context, 0).ConfigureAwait(false);

            // Note if we are retrieving the list, Not found is OK too.
            var precheckCode = response.ResponseHeader?.NodeTransactionPrecheckCode ?? ResponseCodeEnum.Unknown;

            if (precheckCode != ResponseCodeEnum.Ok && precheckCode != ResponseCodeEnum.RecordNotFound)
            {
                throw new TransactionException("Unable to retrieve transaction record.", transactionId.AsTxId(), (ResponseCode)precheckCode);
            }
            var record = response.TransactionGetRecord;

            return(TransactionRecordExtensions.Create(record.DuplicateTransactionRecords, record.TransactionRecord));
        }
Exemple #2
0
    /// <summary>
    /// Retrieves all records having the given transaction ID, including duplicates
    /// that were rejected or produced errors during execution.  Typically there is
    /// only one record per transaction, but in some cases, deliberate or accidental
    /// there may be more than one for a given transaction ID.
    /// </summary>
    /// <param name="transaction">
    /// Transaction identifier of the record
    /// </param>
    /// <param name="configure">
    /// Optional callback method providing an opportunity to modify
    /// the execution configuration for just this method call.
    /// It is executed prior to submitting the request to the network.
    /// </param>
    /// <returns>
    /// An collection of all the transaction records known to the system
    /// at the time of query having the identified transaction id.
    /// </returns>
    public async Task <ReadOnlyCollection <TransactionRecord> > GetAllTransactionRecordsAsync(TxId transaction, Action <IContext>?configure = null)
    {
        await using var context = CreateChildContext(configure);
        var transactionId = new TransactionID(transaction);

        // For the public version of this method, we do not know
        // if the transaction in question has come to consensus so
        // we need to get the receipt first (and wait if necessary).
        // The Receipt status returned does notmatter in this case.
        // We may be retrieving a failed record (the status would not equal OK).
        await WaitForConsensusReceipt(context, transactionId).ConfigureAwait(false);

        var response = await ExecuteQueryInContextAsync(new TransactionGetRecordQuery(transactionId, true, true), context, 0).ConfigureAwait(false);

        var record = response.TransactionGetRecord;

        return(TransactionRecordExtensions.Create(record.TransactionRecord, record.ChildTransactionRecords, record.DuplicateTransactionRecords));
    }
        /// <summary>
        /// Retrieves the account records associated with an account that are presently
        /// held within the network because they exceeded the receive or send threshold
        /// values for autogeneration of records.
        /// </summary>
        /// <param name="address">
        /// The Hedera Network Address to retrieve associated records.
        /// </param>
        /// <param name="configure">
        /// Optional callback method providing an opportunity to modify
        /// the execution configuration for just this method call.
        /// It is executed prior to submitting the request to the network.
        /// </param>
        /// <returns>
        /// A detailed description of the account.
        /// </returns>
        /// <exception cref="ArgumentOutOfRangeException">If required arguments are missing.</exception>
        /// <exception cref="InvalidOperationException">If required context configuration is missing.</exception>
        /// <exception cref="PrecheckException">If the gateway node create rejected the request upon submission.</exception>
        public async Task <TransactionRecord[]> GetAccountRecordsAsync(Address address, Action <IContext>?configure = null)
        {
            var response = await ExecuteQueryAsync(new CryptoGetAccountRecordsQuery(address), configure).ConfigureAwait(false);

            return(TransactionRecordExtensions.Create(response.CryptoGetAccountRecords.Records, null).ToArray());
        }