Skip to content

Commit

Permalink
Merge branch 'release/7.0.0' into fix/lw-11919-voting-power-delegatio…
Browse files Browse the repository at this point in the history
…n-from-HW-wallet-not-fully-synced
  • Loading branch information
DominikGuzei authored Dec 2, 2024
2 parents 15a3f08 + d5f7e32 commit c744bf9
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 21 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@

### Chores

- Update `cardano-node` to 10.1.2 via `cardano-wallet` v2024-11-18 ([PR 3229](https://github.com/input-output-hk/daedalus/pull/3229))
- Update `cardano-node` to 10.1.3 ([PR 3249](https://github.com/input-output-hk/daedalus/pull/3249))

- Update `cardano-wallet` to v2024-11-18 ([PR 3229](https://github.com/input-output-hk/daedalus/pull/3229))

### Fixes

Expand Down
18 changes: 18 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-22.11-darwin";
cardano-wallet-unpatched.url = "github:cardano-foundation/cardano-wallet/v2024-11-18";
cardano-wallet-unpatched.flake = false; # otherwise, +10k quadratic dependencies in flake.lock…
cardano-node-override.url = "github:IntersectMBO/cardano-node/10.1.3";
cardano-node-override.flake = false;
cardano-playground.url = "github:input-output-hk/cardano-playground/49d93e5fe42e1e37f8b4c7d463b5d6bc4af65f26";
cardano-playground.flake = false; # otherwise, +9k dependencies in flake.lock…
cardano-shell.url = "github:input-output-hk/cardano-shell/0d1d5f036c73d18e641412d2c58d4acda592d493";
Expand Down
2 changes: 1 addition & 1 deletion nix/internal/common.nix
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ rec {
}).defaultNix;

nodeFlake = let
unpatched = walletFlake.inputs.cardano-node-runtime;
unpatched = inputs.cardano-node-override;
in (flake-compat {
src = {
outPath = toString (pkgs.runCommand "source" {} ''
Expand Down
6 changes: 3 additions & 3 deletions source/renderer/app/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1300,7 +1300,7 @@ export default class AdaApi {
error,
});

throw new ApiError(error);
throw new ApiError(error).result();
}
};

Expand All @@ -1318,7 +1318,7 @@ export default class AdaApi {
logger.error('AdaApi::createExternalTransaction error', {
error,
});
throw new ApiError(error);
throw new ApiError(error).result();
}
};
inspectAddress = async (request: {
Expand Down Expand Up @@ -2827,7 +2827,7 @@ export default class AdaApi {
error,
});

throw new ApiError(error);
throw new ApiError(error).result();
}
};

Expand Down
39 changes: 23 additions & 16 deletions source/renderer/app/stores/VotingStore.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { action, computed, observable, runInAction } from 'mobx';
import { get } from 'lodash';
import BigNumber from 'bignumber.js';
import Store from './lib/Store';
import Request from './lib/LocalizedRequest';
import { ROUTES } from '../routes-config';
Expand Down Expand Up @@ -30,8 +29,8 @@ import { EventCategories } from '../analytics';
import type { DelegationCalculateFeeResponse } from '../api/staking/types';
import Wallet from '../domains/Wallet';
import ApiError from '../domains/ApiError';
import type { DelegationAction } from '../types/stakingTypes';
import { GenericApiError } from '../api/common/errors';
import { logger } from '../utils/logging';

export type VotingRegistrationKeyType = {
bytes: (...args: Array<any>) => any;
Expand Down Expand Up @@ -280,29 +279,25 @@ export default class VotingStore extends Store {
wallet: Wallet;
}) => {
if (wallet.isHardwareWallet) {
const [{ id: stakePoolId }] = this.stores.staking.stakePools;
let dlegationData: {
delegationAction: DelegationAction;
poolId: string;
} = {
delegationAction: 'join',
poolId: stakePoolId,
};
let poolId: string;

if (wallet.isDelegating) {
const { lastDelegatedStakePoolId, delegatedStakePoolId } = wallet;
const poolId = lastDelegatedStakePoolId || delegatedStakePoolId || '';
dlegationData = {
delegationAction: 'quit',
poolId,
};
const currentPoolId = lastDelegatedStakePoolId || delegatedStakePoolId;
poolId = this.stores.staking.stakePools.find(
(stakePool) => stakePool.id !== currentPoolId
).id;
} else {
const [{ id }] = this.stores.staking.stakePools;
poolId = id;
}

try {
const initialCoinSelection = await this.stores.hardwareWallets.selectDelegationCoins(
{
walletId: wallet.id,
...dlegationData,
delegationAction: 'join',
poolId,
}
);

Expand Down Expand Up @@ -342,6 +337,12 @@ export default class VotingStore extends Store {
fees: coinSelection.fee,
};
} catch (error) {
logger.error(
'VotingStore: error while initializing VP delegation TX with HW',
{
error,
}
);
return {
success: false,
errorCode: parseApiCode(
Expand All @@ -364,6 +365,9 @@ export default class VotingStore extends Store {
fees: constructedTx.fee,
};
} catch (error) {
logger.error('VotingStore: error while initializing VP delegation TX', {
error,
});
return {
success: false,
errorCode: parseApiCode(expectedInitializeVPDelegationTxErrors, error),
Expand Down Expand Up @@ -417,6 +421,9 @@ export default class VotingStore extends Store {
success: true,
};
} catch (error) {
logger.error('VotingStore: error while delegating vote with HW', {
error,
});
const errorCode: GenericErrorCode = 'generic';
return {
success: false,
Expand Down

0 comments on commit c744bf9

Please sign in to comment.