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();
}
import { restoreLegacyWallet } from './wallets/requests/restoreLegacyWallet';
import { restoreByronWallet } from './wallets/requests/restoreByronWallet';
import { updateWallet } from './wallets/requests/updateWallet';
+
import { forceWalletResync } from './wallets/requests/forceWalletResync';
import { getWalletUtxos } from './wallets/requests/getWalletUtxos';
import { getWallet } from './wallets/requests/getWallet';
import { getWalletIdAndBalance } from './wallets/requests/getWalletIdAndBalance';
  GetWalletRecoveryPhraseFromCertificateRequest,
  ImportWalletFromKeyRequest,
  ImportWalletFromFileRequest,
-
  UpdateWalletRequest,
+
  ForceWalletResyncRequest,
  GetWalletUtxosRequest,
  GetWalletRequest,
  GetWalletIdAndBalanceRequest,
  TransferFundsCalculateFeeResponse,
  TransferFundsRequest,
  TransferFundsResponse,
+
  UpdateWalletRequest,
} from './wallets/types';

                      
// News Types
    }
  };

                      
+
  forceWalletResync = async (
+
    request: ForceWalletResyncRequest
+
  ): Promise<void> => {
+
    const { walletId } = request;
+
    Logger.debug('AdaApi::forceWalletResync called', {
+
      walletId,
+
    });
+
    try {
+
      const response = await forceWalletResync(this.config, {
+
        walletId,
+
      });
+
      Logger.debug('AdaApi::forceWalletResync success', { response });
+
    } catch (error) {
+
      Logger.error('AdaApi::forceWalletResync error', { error });
+
      throw new GenericApiError();
+
    }
+
  };
+

                      
  transferFundsCalculateFee = async (
    request: TransferFundsCalculateFeeRequest
  ): Promise<BigNumber> => {
+
// @flow
+
import type { RequestConfig } from '../../common/types';
+
import { request } from '../../utils/request';
+

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

                      
+
export const forceWalletResync = (
+
  config: RequestConfig,
+
  { walletId }: ForceWalletResyncParams
+
): Promise<*> =>
+
  request(
+
    {
+
      method: 'PUT',
+
      path: `/v2/wallets/${walletId}/tip`,
+
      ...config,
+
    },
+
    {},
+
    {
+
      slot_number: 0,
+
      epoch_number: 0,
+
    }
+
  );
  walletId: string,
  name: string,
};
+

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

                      
export type ImportWalletFromKeyRequest = {
  filePath: string,
  spendingPassword: string,
  @observable getWalletUtxosRequest: Request<WalletUtxos> = new Request(
    this.api.ada.getWalletUtxos
  );
+
  @observable forceWalletResyncRequest: Request<void> = new Request(
+
    this.api.ada.forceWalletResync
+
  );

                      
  @observable walletFieldBeingEdited = null;
  @observable lastUpdatedWalletField = null;
    walletSettingsActions.stopWalletUtxoPolling.listen(
      this._stopWalletUtxoPolling
    );
+
    walletSettingsActions.forceWalletResync.listen(this._forceWalletResync);

                      
    sidebarActions.walletSelected.listen(this._onWalletSelected);
  }
  @action _onWalletSelected = () => {
    this._updateWalletUtxos(null);
  };
+

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