Skip to content

Commit

Permalink
fix(connect): fix types, re-enable assert in typedCall
Browse files Browse the repository at this point in the history
  • Loading branch information
martykan committed Dec 20, 2023
1 parent 9df30f9 commit d75bbaf
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/connect/src/device/DeviceCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { initLog } from '../utils/debug';
import type { Device } from './Device';
import type { CoinInfo, BitcoinNetworkInfo, Network } from '../types';
import type { HDNodeResponse } from '../types/api/getPublicKey';
// import { Assert } from '@trezor/schema-utils';
import { Assert } from '@trezor/schema-utils';

type MessageType = Messages.MessageType;
type MessageKey = keyof MessageType;
Expand Down Expand Up @@ -422,7 +422,7 @@ export class DeviceCommands {
}
// Assert message type
// msg is allowed to be undefined for some calls, in that case the schema is an empty object
// Assert(Messages.MessageType.properties[type], msg ?? {});
Assert(Messages.MessageType.properties[type], msg ?? {});
const response = await this._commonCall(type, msg);
try {
assertType(response, resType);
Expand Down
2 changes: 1 addition & 1 deletion packages/connect/src/types/api/bitcoin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Static, Type } from '@trezor/schema-utils';
export type SignMessage = Static<typeof SignMessage>;
export const SignMessage = Type.Object({
path: DerivationPath,
coin: Type.String(),
coin: Type.Optional(Type.String()),
message: Type.String(),
hex: Type.Optional(Type.Boolean()),
no_script_type: Type.Optional(Type.Boolean()),
Expand Down
1 change: 1 addition & 0 deletions packages/connect/src/types/params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export const GetAddress = Type.Object({
address: Type.Optional(Type.String()),
showOnTrezor: Type.Optional(Type.Boolean()),
chunkify: Type.Optional(Type.Boolean()),
useEventListener: Type.Optional(Type.Boolean()),
});

export interface Address {
Expand Down

0 comments on commit d75bbaf

Please sign in to comment.