Skip to content

Commit 1d10606

Browse files
[DDW-1179] Fix types
1 parent 5dbba7c commit 1d10606

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

source/common/types/hardware-wallets.types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { BridgeInfo, Device as TrezorDevice, UdevInfo } from '@trezor/connect';
22
import {
33
TxOutputDestinationType,
44
AddressType,
5-
GovernanceVotingRegistrationFormat,
5+
CIP36VoteRegistrationFormat,
66
TxAuxiliaryDataType,
77
} from '@cardano-foundation/ledgerjs-hw-app-cardano';
88

@@ -147,7 +147,7 @@ export type LedgerSignTransactionOutputsType =
147147
export type LedgerAuxiliaryDataType = {
148148
type: TxAuxiliaryDataType;
149149
params: {
150-
format: GovernanceVotingRegistrationFormat;
150+
format: CIP36VoteRegistrationFormat;
151151
votingPublicKeyHex: string;
152152
stakingPath: BIP32Path;
153153
rewardsDestination: {

source/main/ipc/getHardwareWalletChannel.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,7 @@ export const handleHardwareWalletRequests = async (
456456
});
457457
deriveXpubChannel.onRequest(async (params) => {
458458
const { parentXpubHex, lastIndex, derivationScheme } = params;
459+
// @ts-ignore
459460
const parentXpub = utils.hex_to_buf(parentXpubHex);
460461

461462
try {

source/renderer/app/utils/shelleyLedger.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
AddressType,
55
TxAuxiliaryDataType, // CHECK THIS
66
StakeCredentialParamsType,
7-
GovernanceVotingRegistrationFormat,
7+
CIP36VoteRegistrationFormat,
88
} from '@cardano-foundation/ledgerjs-hw-app-cardano';
99
import { encode } from 'borc';
1010
import blakejs from 'blakejs';
@@ -31,6 +31,8 @@ import type {
3131
} from '../../../common/types/hardware-wallets.types';
3232
import type { AddressStyle } from '../api/addresses/types';
3333

34+
const bs58 = require('bs58');
35+
3436
export const CATALYST_VOTING_REGISTRATION_TYPE = 'CATALYST_VOTING';
3537
export type ShelleyTxInputType = {
3638
coins: number;
@@ -175,7 +177,7 @@ export function ShelleyTxOutput(
175177
const addressBuff =
176178
addressStyle === AddressStyles.ADDRESS_SHELLEY
177179
? utils.bech32_decodeAddress(address)
178-
: utils.base58_decode(address);
180+
: bs58.decode(address);
179181
return encoder.pushAny([addressBuff, coins]);
180182
}
181183

@@ -399,6 +401,7 @@ export const CachedDeriveXpubFactory = (
399401
const parentXpub = await deriveXpub(derivationPath.slice(0, -1), null);
400402

401403
try {
404+
// @ts-ignore
402405
const parentXpubHex = utils.buf_to_hex(parentXpub);
403406
const derivedXpub = await deriveXpubChannel.request({
404407
parentXpubHex,
@@ -460,7 +463,7 @@ export const prepareLedgerOutput = (
460463
addressHex:
461464
addressStyle === AddressStyles.ADDRESS_SHELLEY
462465
? utils.buf_to_hex(utils.bech32_decodeAddress(output.address))
463-
: utils.buf_to_hex(utils.base58_decode(output.address)),
466+
: utils.buf_to_hex(bs58.decode(output.address)),
464467
},
465468
},
466469
amount: output.amount.quantity.toString(),
@@ -474,9 +477,9 @@ export const prepareLedgerAuxiliaryData = (
474477

475478
if (type === CATALYST_VOTING_REGISTRATION_TYPE) {
476479
return {
477-
type: TxAuxiliaryDataType.GOVERNANCE_VOTING_REGISTRATION,
480+
type: TxAuxiliaryDataType.CIP36_REGISTRATION,
478481
params: {
479-
format: GovernanceVotingRegistrationFormat.CIP_15,
482+
format: CIP36VoteRegistrationFormat.CIP_15,
480483
votingPublicKeyHex: votingPubKey,
481484
stakingPath: rewardDestinationAddress.stakingPath,
482485
rewardsDestination: {

0 commit comments

Comments
 (0)