View on GitHub
File Changes
  exportToFile: Action<WalletExportToFileParams> = new Action();
  startWalletUtxoPolling: Action<any> = new Action();
  stopWalletUtxoPolling: Action<any> = new Action();
-
  forceWalletResync: Action<{ walletId: string }> = new Action();
+
  forceWalletResync: Action<{
+
    walletId: string,
+
    isLegacy: boolean,
+
  }> = new Action();
}
import { restoreByronWallet } from './wallets/requests/restoreByronWallet';
import { updateWallet } from './wallets/requests/updateWallet';
import { forceWalletResync } from './wallets/requests/forceWalletResync';
+
import { forceLegacyWalletResync } from './wallets/requests/forceLegacyWalletResync';
import { getWalletUtxos } from './wallets/requests/getWalletUtxos';
import { getWallet } from './wallets/requests/getWallet';
import { getWalletIdAndBalance } from './wallets/requests/getWalletIdAndBalance';
  forceWalletResync = async (
    request: ForceWalletResyncRequest
  ): Promise<void> => {
-
    const { walletId } = request;
-
    Logger.debug('AdaApi::forceWalletResync called', {
-
      walletId,
-
    });
+
    Logger.debug('AdaApi::forceWalletResync called', { parameters: request });
    try {
-
      const response = await forceWalletResync(this.config, {
-
        walletId,
-
      });
+
      const { walletId, isLegacy } = request;
+
      let response;
+
      if (isLegacy) {
+
        response = await forceLegacyWalletResync(this.config, { walletId });
+
      } else {
+
        response = await forceWalletResync(this.config, { walletId });
+
      }
      Logger.debug('AdaApi::forceWalletResync success', { response });
    } catch (error) {
      Logger.error('AdaApi::forceWalletResync error', { error });
+
// @flow
+
import type { RequestConfig } from '../../common/types';
+
import { request } from '../../utils/request';
+
import { getRawWalletId } from '../../utils';
+

                      
+
export const forceLegacyWalletResync = (
+
  config: RequestConfig,
+
  { walletId }: { walletId: string }
+
): Promise<*> =>
+
  request(
+
    {
+
      method: 'PUT',
+
      path: `/v2/byron-wallets/${getRawWalletId(walletId)}/tip`,
+
      ...config,
+
    },
+
    {},
+
    {
+
      slot_number: 0,
+
      epoch_number: 0,
+
    }
+
  );
import type { RequestConfig } from '../../common/types';
import { request } from '../../utils/request';

                      
-
export type ForceWalletResyncParams = {
-
  walletId: string,
-
};
-

                      
export const forceWalletResync = (
  config: RequestConfig,
-
  { walletId }: ForceWalletResyncParams
+
  { walletId }: { walletId: string }
): Promise<*> =>
  request(
    {

                      
export type ForceWalletResyncRequest = {
  walletId: string,
+
  isLegacy: boolean,
};

                      
export type ImportWalletFromKeyRequest = {
        onStopEditing={stopEditingWalletField.trigger}
        onCancelEditing={cancelEditingWalletField.trigger}
        onResyncWallet={() =>
-
          forceWalletResync.trigger({ walletId: activeWallet.id })
+
          forceWalletResync.trigger({
+
            walletId: activeWallet.id,
+
            isLegacy: activeWallet.isLegacy,
+
          })
        }
        activeField={walletFieldBeingEdited}
        nameValidator={name => isValidWalletName(name)}
    this._updateWalletUtxos(null);
  };

                      
-
  @action _forceWalletResync = async ({ walletId }: { walletId: string }) => {
-
    await this.forceWalletResyncRequest.execute({ walletId });
+
  @action _forceWalletResync = async ({
+
    walletId,
+
    isLegacy,
+
  }: {
+
    walletId: string,
+
    isLegacy: boolean,
+
  }) => {
+
    await this.forceWalletResyncRequest.execute({ walletId, isLegacy });
    this.forceWalletResyncRequest.reset();
    this.stores.wallets.refreshWalletsData();
  };