View on GitHub
File Changes
import { TlsCertificateNotValidError } from './nodes/errors';
import { getSHA256HexForString } from './utils/hashing';
import { getNewsHash } from './news/requests/getNewsHash';
+
import { deleteTransaction } from './transactions/requests/deleteTransaction';

                      
export default class AdaApi {
  config: RequestConfig;
    request: DeleteTransactionRequest
  ): Promise<void> => {
    Logger.debug('AdaApi::deleteTransaction called', { parameters: request });
-
    const { walletId, transactionId } = request;
+
    const { walletId, transactionId, isLegacy } = request;
    try {
-
      const response: void = await deleteLegacyTransaction(this.config, {
-
        walletId,
-
        transactionId,
-
      });
+
      let response;
+
      if (isLegacy) {
+
        response = await deleteLegacyTransaction(this.config, {
+
          walletId,
+
          transactionId,
+
        });
+
      } else {
+
        response = await deleteTransaction(this.config, {
+
          walletId,
+
          transactionId,
+
        });
+
      }
      Logger.debug('AdaApi::deleteTransaction success', response);
    } catch (error) {
      Logger.error('AdaApi::deleteTransaction error', { error });
export type DeleteTransactionRequest = {
  walletId: string,
  transactionId: string,
+
  isLegacy?: boolean,
};

                      
export type GetTransactionsResponse = {
  isExpanded: boolean,
  isRestoreActive: boolean,
  isLastInList: boolean,
+
  isLegacy: boolean,
  formattedWalletAmount: Function,
  network: string,
  onDetailsToggled: ?Function,
  };

                      
  deletePendingTransaction = async () => {
-
    const { data, walletId } = this.props;
+
    const { data, walletId, isLegacy } = this.props;
    const { id: transactionId, state } = data;
    if (state !== TransactionStates.PENDING) {
      return this.hideConfirmationDialog();
    }
    await this.props.deletePendingTransaction({
      walletId,
      transactionId,
+
      isLegacy,
    });
    return this.hideConfirmationDialog();
  };
  isLoadingTransactions: boolean,
  isRestoreActive: boolean,
  isRenderingAsVirtualList: boolean,
+
  isLegacy: boolean,
  network: string,
  onShowMoreTransactions?: Function,
  onOpenExternalLink?: Function,
      network,
      onOpenExternalLink,
      walletId,
+
      isLegacy,
    } = this.props;
    const { isFirstInGroup, isLastInGroup, tx } = data;
    const txClasses = classnames([
          isExpanded={this.isTxExpanded(tx)}
          isLastInList={isLastInGroup}
          isRestoreActive={isRestoreActive}
+
          isLegacy={isLegacy}
          network={network}
          onDetailsToggled={() => this.toggleTransactionExpandedState(tx)}
          onOpenExternalLink={onOpenExternalLink}
          isRestoreActive={isRestoreActive}
          hasMoreToLoad={hasMoreToLoad()}
          onLoadMore={actions.transactions.loadMoreTransactions.trigger}
+
          isLegacy={activeWallet.isLegacy}
          walletId={activeWallet.id}
          formattedWalletAmount={formattedWalletAmount}
          onOpenExternalLink={openExternalLink}
      );
    }

                      
-
    // TODO:
-
    // check wallet for pending transaction using transactionId
-
    // if transaction does not exist or transaction state is not "pending"
-
    // throw new Error
-

                      
    return this.api.ada.deleteTransaction(deleteTransactionRequest);
  };