@@ -2,17 +2,18 @@ import { utils } from '@cardano-foundation/ledgerjs-hw-app-cardano';
2
2
import { Messages } from '@trezor/transport' ;
3
3
import { CardanoDRep , PROTO } from '@trezor/connect' ;
4
4
import { map } from 'lodash' ;
5
+ import { Cardano } from '@cardano-sdk/core' ;
5
6
import {
6
- derivationPathToString ,
7
7
CERTIFICATE_TYPE ,
8
+ derivationPathToString ,
8
9
groupTokensByPolicyId ,
9
10
} from './hardwareWalletUtils' ;
10
11
import type {
12
+ CoinSelectionAssetsType ,
13
+ CoinSelectionCertificate ,
11
14
CoinSelectionInput ,
12
15
CoinSelectionOutput ,
13
- CoinSelectionCertificate ,
14
16
CoinSelectionWithdrawal ,
15
- CoinSelectionAssetsType ,
16
17
} from '../api/transactions/types' ;
17
18
18
19
export const TrezorTransactionSigningMode = {
@@ -67,18 +68,18 @@ const parseVoteDelegation = (cert: CoinSelectionCertificate): CardanoDRep => {
67
68
} ;
68
69
}
69
70
70
- const voteHash = utils . bech32_decodeAddress ( cert . vote ) . toString ( 'hex' ) ;
71
+ const { type , hash } = Cardano . DRepID . toCredential ( Cardano . DRepID ( cert . vote ) ) ;
71
72
72
- if ( cert . vote . includes ( '_script' ) ) {
73
+ if ( type === Cardano . CredentialType . ScriptHash ) {
73
74
return {
74
75
type : PROTO . CardanoDRepType . SCRIPT_HASH ,
75
- scriptHash : voteHash ,
76
+ scriptHash : hash ,
76
77
} ;
77
78
}
78
79
79
80
return {
80
81
type : PROTO . CardanoDRepType . KEY_HASH ,
81
- keyHash : voteHash ,
82
+ keyHash : hash ,
82
83
} ;
83
84
} ;
84
85
0 commit comments