Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 7.0.2 #3264

Merged
merged 5 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading