[DDW-873] Get single wallet v2 api integration (#1556)

  • [DDW-860] Introduce improvements for already integrated wallets API v2 endpoint

  • [DDW-860] Wallets endpoint flow code cleanup and removing unnecessary assurance declarations

  • [DDW-860] Introduce improvements for already integrated getAddresses API v2 endpoint

  • [DDW-680] Fix broken transactions screen

  • [DDW-860] Types improvements regarding to requested changes

  • [DDW-861] Introduce new error handling logic related to api v2 responsees

  • [DDW-861] Fix flow issue

  • [DDW-861] Shortens .map callback functions

  • [DDW-861] Fixes ESLint error

  • [DDW-871] Introduce Delete Wallet v2 API endpoint integration

  • [DDW-739] Introduce refactored e2e testReset method

  • [DDW-872] Introduce Update Wallet Metadata V2 API endpoint integration

  • [DDW-873] Introduce Get Single Wallet v2 API integration

  • CHANGELOG update

  • [DDW-738] CHANGELOG update

  • [DDW-872] CHANGELOG update

  • [DDW-873] CHANGELOG update

  • [DDW-871] Eslint fix

View on GitHub
File Changes
m
+1/-1

                      
### Features

                      
-
- Integrated Cardano V2 API endpoints ([PR 1548](https://github.com/input-output-hk/daedalus/pull/1548), [PR 1551](https://github.com/input-output-hk/daedalus/pull/1551), [PR 1552](https://github.com/input-output-hk/daedalus/pull/1552), [PR 1553](https://github.com/input-output-hk/daedalus/pull/1553), [PR 1555](https://github.com/input-output-hk/daedalus/pull/1555))
+
- Integrated Cardano V2 API endpoints ([PR 1548](https://github.com/input-output-hk/daedalus/pull/1548), [PR 1551](https://github.com/input-output-hk/daedalus/pull/1551), [PR 1552](https://github.com/input-output-hk/daedalus/pull/1552), [PR 1553](https://github.com/input-output-hk/daedalus/pull/1553), [PR 1555](https://github.com/input-output-hk/daedalus/pull/1555), [PR 1556](https://github.com/input-output-hk/daedalus/pull/1556))
- Removed select dropdown arrow ([PR 1550](https://github.com/input-output-hk/daedalus/pull/1550))
- Implemented automated and manual update flows unification ([PR 1491](https://github.com/input-output-hk/daedalus/pull/1491))
- Updated behavior of system dialogs ([PR 1494](https://github.com/input-output-hk/daedalus/pull/1494))
  closeCertificateGeneration: Action<any> = new Action();
  setCertificateTemplate: Action<{ selectedTemplate: string }> = new Action();
  finishCertificate: Action<any> = new Action();
+
  getWallet: Action<{ walletId: string }> = new Action();
}
import { restoreWallet } from './wallets/requests/restoreWallet';
import { updateWallet } from './wallets/requests/updateWallet';
import { getWalletUtxos } from './wallets/requests/getWalletUtxos';
+
import { getWallet } from './wallets/requests/getWallet';

                      
// utility functions
import {
  ImportWalletFromFileRequest,
  UpdateWalletRequest,
  GetWalletUtxosRequest,
+
  GetWalletRequest,
} from './wallets/types';

                      
// Common errors
    }
  };

                      
+
  getWallet = async (request: GetWalletRequest): Promise<Wallet> => {
+
    Logger.debug('AdaApi::getWallet called', {
+
      parameters: filterLogData(request),
+
    });
+
    try {
+
      const { walletId } = request;
+
      const wallet: AdaWallet = await getWallet(this.config, { walletId });
+
      Logger.debug('AdaApi::getWallet success', { wallet });
+
      return _createWalletFromServerData(wallet);
+
    } catch (error) {
+
      Logger.error('AdaApi::getWallet error', { error });
+
      throw new GenericApiError();
+
    }
+
  };
+

                      
  getAddresses = async (
    request: GetAddressesRequest
  ): Promise<GetAddressesResponse> => {
+
// @flow
+
import type { RequestConfig } from '../../common/types';
+
import type { GetWalletRequest, AdaWallet } from '../types';
+
import { request } from '../../utils/request';
+

                      
+
export const getWallet = (
+
  config: RequestConfig,
+
  { walletId }: GetWalletRequest
+
): Promise<AdaWallet> =>
+
  request({
+
    method: 'GET',
+
    path: `/v2/wallets/${walletId}`,
+
    ...config,
+
  });
  passphrase: string,
  scrambledInput: string,
};
+

                      
+
export type GetWalletRequest = {
+
  walletId: string,
+
};