Skip to content

Commit

Permalink
Merge pull request #3264 from input-output-hk/release/7.0.2
Browse files Browse the repository at this point in the history
Release 7.0.2
  • Loading branch information
michalrus authored Dec 12, 2024
2 parents a69826c + 331049f commit d95a4cc
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 57 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
# Changelog

## 7.0.2

### Fixes

- Changed Cardano Wallet endpoint used to initialize VP delegation transaction ([PR 3262](https://github.com/input-output-hk/daedalus/pull/3262))

## 7.0.1

### Chores

- Fixed crashing of Daedalus 7.0.0 on Ubuntu ([PR 3257](https://github.com/input-output-hk/daedalus/pull/3257))

## 7.0.0
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "daedalus",
"productName": "Daedalus",
"version": "7.0.1",
"version": "7.0.2",
"description": "Cryptocurrency Wallet",
"main": "./dist/main/index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion source/renderer/app/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2829,7 +2829,7 @@ export default class AdaApi {

return response;
} catch (error) {
logger.debug('AdaApi::delegateVotes error', {
logger.error('AdaApi::delegateVotes error', {
error,
});

Expand Down
86 changes: 31 additions & 55 deletions source/renderer/app/stores/VotingStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,29 +278,29 @@ export default class VotingStore extends Store {
chosenOption: string;
wallet: Wallet;
}) => {
if (wallet.isHardwareWallet) {
let poolId: string;

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

if (wallet.isDelegating) {
const { lastDelegatedStakePoolId, delegatedStakePoolId } = wallet;
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,
delegationAction: 'join',
poolId,
}
);
try {
let coinSelection = await this.stores.hardwareWallets.selectDelegationCoins(
{
walletId: wallet.id,
delegationAction: 'join',
poolId,
}
);

if (wallet.isHardwareWallet) {
let certificates: object[] = [
{
certificateType: 'cast_vote',
Expand All @@ -309,7 +309,7 @@ export default class VotingStore extends Store {
},
];

const walletNeedsRegisteringRewardAccount = initialCoinSelection.certificates.some(
const walletNeedsRegisteringRewardAccount = coinSelection.certificates.some(
(c) => c.certificateType === 'register_reward_account'
);
if (walletNeedsRegisteringRewardAccount) {
Expand All @@ -322,52 +322,28 @@ export default class VotingStore extends Store {
];
}

const coinSelection = {
...initialCoinSelection,
coinSelection = {
...coinSelection,
certificates,
};

this.stores.hardwareWallets.updateTxSignRequest(coinSelection);
this.stores.hardwareWallets.initiateTransaction({
walletId: wallet.id,
});

return {
success: true,
fees: coinSelection.fee,
};
} catch (error) {
logger.error(
'VotingStore: error while initializing VP delegation TX with HW',
{
error,
}
);
return {
success: false,
errorCode: parseApiCode(
expectedInitializeVPDelegationTxErrors,
error
),
};
}
}

this.constructTxRequest.reset();
try {
const constructedTx = await this.constructTxRequest.execute({
walletId: wallet.id,
data: { vote: chosenOption },
}).promise;

return {
success: true,
fees: constructedTx.fee,
fees: coinSelection.fee,
};
} catch (error) {
logger.error('VotingStore: error while initializing VP delegation TX', {
error,
});
logger.error(
'VotingStore: error while initializing VP delegation TX with HW',
{
error,
}
);
return {
success: false,
errorCode: parseApiCode(expectedInitializeVPDelegationTxErrors, error),
Expand Down

0 comments on commit d95a4cc

Please sign in to comment.