Skip to content
Permalink
Browse files

[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
  • Loading branch information...
tomothespian authored and nikolaglumac committed Sep 12, 2019
1 parent 68c3186 commit 9e6161b247336397be4ca2440ec0c948daf19709
@@ -5,7 +5,7 @@ Changelog

### 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))
@@ -42,4 +42,5 @@ export default class WalletsActions {
closeCertificateGeneration: Action<any> = new Action();
setCertificateTemplate: Action<{ selectedTemplate: string }> = new Action();
finishCertificate: Action<any> = new Action();
getWallet: Action<{ walletId: string }> = new Action();
}
@@ -42,6 +42,7 @@ import { createWallet } from './wallets/requests/createWallet';
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 {
@@ -127,6 +128,7 @@ import type {
ImportWalletFromFileRequest,
UpdateWalletRequest,
GetWalletUtxosRequest,
GetWalletRequest,
} from './wallets/types';

// Common errors
@@ -180,6 +182,21 @@ export default class AdaApi {
}
};

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> => {
@@ -0,0 +1,14 @@
// @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,
});
@@ -111,3 +111,7 @@ export type GetWalletRecoveryPhraseFromCertificateRequest = {
passphrase: string,
scrambledInput: string,
};

export type GetWalletRequest = {
walletId: string,
};

0 comments on commit 9e6161b

Please sign in to comment.
You can’t perform that action at this time.