@@ -4,7 +4,13 @@ import {
44 AddressType ,
55 TxAuxiliaryDataType , // CHECK THIS
66 StakeCredentialParamsType ,
7+ CIP36VoteRegistrationFormat ,
78} from '@cardano-foundation/ledgerjs-hw-app-cardano' ;
9+ import {
10+ str_to_path ,
11+ base58_decode ,
12+ } from '@cardano-foundation/ledgerjs-hw-app-cardano/dist/utils/address' ;
13+ import { HexString } from '@cardano-foundation/ledgerjs-hw-app-cardano/dist/types/internal' ;
814import { encode } from 'borc' ;
915import blakejs from 'blakejs' ;
1016import _ from 'lodash' ;
@@ -173,7 +179,7 @@ export function ShelleyTxOutput(
173179 const addressBuff =
174180 addressStyle === AddressStyles . ADDRESS_SHELLEY
175181 ? utils . bech32_decodeAddress ( address )
176- : utils . base58_decode ( address ) ;
182+ : base58_decode ( address ) ;
177183 return encoder . pushAny ( [ addressBuff , coins ] ) ;
178184 }
179185
@@ -403,8 +409,7 @@ export const CachedDeriveXpubFactory = (
403409 lastIndex,
404410 derivationScheme : derivationScheme . ed25519Mode ,
405411 } ) ;
406- // @ts -ignore
407- return utils . hex_to_buf ( derivedXpub ) ;
412+ return utils . hex_to_buf ( derivedXpub as HexString ) ;
408413 } catch ( e ) {
409414 throw e ;
410415 }
@@ -442,7 +447,7 @@ export const prepareLedgerOutput = (
442447 type : AddressType . BASE_PAYMENT_KEY_STAKE_KEY ,
443448 params : {
444449 spendingPath : derivationPathToLedgerPath ( output . derivationPath ) ,
445- stakingPath : utils . str_to_path ( "1852'/1815'/0'/2/0" ) ,
450+ stakingPath : str_to_path ( "1852'/1815'/0'/2/0" ) ,
446451 } ,
447452 } ,
448453 } ,
@@ -458,7 +463,7 @@ export const prepareLedgerOutput = (
458463 addressHex :
459464 addressStyle === AddressStyles . ADDRESS_SHELLEY
460465 ? utils . buf_to_hex ( utils . bech32_decodeAddress ( output . address ) )
461- : utils . buf_to_hex ( utils . base58_decode ( output . address ) ) ,
466+ : utils . buf_to_hex ( base58_decode ( output . address ) ) ,
462467 } ,
463468 } ,
464469 amount : output . amount . quantity . toString ( ) ,
@@ -469,17 +474,20 @@ export const prepareLedgerAuxiliaryData = (
469474 txAuxiliaryData : TxAuxiliaryData
470475) => {
471476 const { votingPubKey, rewardDestinationAddress, type } = txAuxiliaryData ;
472-
473477 if ( type === CATALYST_VOTING_REGISTRATION_TYPE ) {
474478 return {
475- type : TxAuxiliaryDataType . CATALYST_REGISTRATION ,
479+ type : TxAuxiliaryDataType . CIP36_REGISTRATION ,
476480 params : {
477- votingPublicKeyHex : votingPubKey ,
481+ format : CIP36VoteRegistrationFormat . CIP_15 ,
482+ voteKeyHex : votingPubKey ,
478483 stakingPath : rewardDestinationAddress . stakingPath ,
479- rewardsDestination : {
480- type : AddressType . REWARD_KEY ,
484+ paymentDestination : {
485+ type : TxOutputDestinationType . DEVICE_OWNED ,
481486 params : {
482- stakingPath : rewardDestinationAddress . stakingPath ,
487+ type : AddressType . REWARD_KEY ,
488+ params : {
489+ stakingPath : rewardDestinationAddress . stakingPath ,
490+ } ,
483491 } ,
484492 } ,
485493 nonce : `${ txAuxiliaryData . nonce } ` ,
0 commit comments