@trezor/connect 9.0.4 → 9.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/README.md +1 -1
  3. package/lib/api/binanceGetAddress.d.ts +1 -1
  4. package/lib/api/binanceSignTransaction.d.ts +1 -1
  5. package/lib/api/bitcoin/Fees.d.ts +1 -1
  6. package/lib/api/bitcoin/TransactionComposer.d.ts +1 -1
  7. package/lib/api/bitcoin/refTx.js +1 -1
  8. package/lib/api/bitcoin/signtxVerify.d.ts +1 -1
  9. package/lib/api/blockchainDisconnect.d.ts +1 -1
  10. package/lib/api/blockchainEstimateFee.d.ts +1 -1
  11. package/lib/api/blockchainGetAccountBalanceHistory.d.ts +1 -1
  12. package/lib/api/blockchainGetCurrentFiatRates.d.ts +1 -1
  13. package/lib/api/blockchainGetFiatRatesForTimestamps.d.ts +1 -1
  14. package/lib/api/blockchainGetTransactions.d.ts +1 -1
  15. package/lib/api/blockchainSetCustomBackend.d.ts +1 -1
  16. package/lib/api/blockchainSubscribe.d.ts +1 -1
  17. package/lib/api/blockchainSubscribeFiatRates.d.ts +1 -1
  18. package/lib/api/blockchainUnsubscribe.d.ts +1 -1
  19. package/lib/api/blockchainUnsubscribeFiatRates.d.ts +1 -1
  20. package/lib/api/cardano/cardanoCertificate.d.ts +2 -2
  21. package/lib/api/cardano/cardanoInputs.d.ts +3 -3
  22. package/lib/api/cardano/cardanoOutputs.d.ts +1 -1
  23. package/lib/api/cardano/cardanoTokenBundle.d.ts +1 -1
  24. package/lib/api/cardanoGetAddress.d.ts +1 -1
  25. package/lib/api/cardanoSignTransaction.d.ts +1 -1
  26. package/lib/api/checkFirmwareAuthenticity.js +3 -1
  27. package/lib/api/common/Discovery.d.ts +2 -2
  28. package/lib/api/common/paramsValidator.d.ts +2 -2
  29. package/lib/api/composeTransaction.d.ts +1 -1
  30. package/lib/api/eos/eosSignTx.js +1 -1
  31. package/lib/api/eosSignTransaction.d.ts +1 -1
  32. package/lib/api/ethereumGetAddress.d.ts +1 -1
  33. package/lib/api/ethereumGetPublicKey.d.ts +1 -1
  34. package/lib/api/ethereumSignTransaction.d.ts +1 -1
  35. package/lib/api/ethereumSignTypedData.d.ts +1 -1
  36. package/lib/api/firmware/uploadFirmware.d.ts +2 -2
  37. package/lib/api/firmwareUpdate.d.ts +1 -1
  38. package/lib/api/firmwareUpdate.js +1 -1
  39. package/lib/api/getAccountInfo.d.ts +1 -1
  40. package/lib/api/getAddress.d.ts +1 -1
  41. package/lib/api/getCoinInfo.d.ts +2 -2
  42. package/lib/api/getPublicKey.d.ts +1 -1
  43. package/lib/api/nemGetAddress.d.ts +1 -1
  44. package/lib/api/pushTransaction.d.ts +1 -1
  45. package/lib/api/rippleGetAddress.d.ts +1 -1
  46. package/lib/api/setBusy.js +5 -1
  47. package/lib/api/setProxy.js +3 -4
  48. package/lib/api/signTransaction.d.ts +3 -1
  49. package/lib/api/signTransaction.js +41 -38
  50. package/lib/api/stellarGetAddress.d.ts +1 -1
  51. package/lib/api/stellarSignTransaction.d.ts +1 -1
  52. package/lib/api/tezosGetAddress.d.ts +1 -1
  53. package/lib/backend/BackendManager.d.ts +1 -1
  54. package/lib/backend/BackendManager.js +0 -4
  55. package/lib/backend/Blockchain.d.ts +3 -9
  56. package/lib/backend/Blockchain.js +2 -17
  57. package/lib/constants/network.d.ts +1 -1
  58. package/lib/core/AbstractMethod.d.ts +4 -4
  59. package/lib/core/AbstractMethod.js +7 -5
  60. package/lib/core/index.d.ts +1 -1
  61. package/lib/core/index.js +9 -5
  62. package/lib/data/DataManager.d.ts +1 -1
  63. package/lib/data/analyticsInfo.d.ts +6 -0
  64. package/lib/data/analyticsInfo.js +37 -0
  65. package/lib/data/config.js +2 -5
  66. package/lib/data/version.d.ts +1 -1
  67. package/lib/data/version.js +1 -1
  68. package/lib/device/AbortController.d.ts +1 -1
  69. package/lib/device/DescriptorStream.d.ts +1 -1
  70. package/lib/device/Device.d.ts +3 -3
  71. package/lib/device/Device.js +13 -6
  72. package/lib/device/DeviceCommands.d.ts +7 -7
  73. package/lib/device/DeviceCommands.js +3 -1
  74. package/lib/device/DeviceList.d.ts +2 -2
  75. package/lib/device/DeviceList.js +2 -2
  76. package/lib/events/blockchain.d.ts +4 -5
  77. package/lib/events/call.d.ts +10 -10
  78. package/lib/events/core.d.ts +3 -2
  79. package/lib/events/device.d.ts +3 -3
  80. package/lib/events/iframe.d.ts +2 -2
  81. package/lib/events/popup.d.ts +2 -2
  82. package/lib/events/transport.d.ts +8 -4
  83. package/lib/events/transport.js +1 -1
  84. package/lib/events/ui-promise.d.ts +2 -2
  85. package/lib/events/ui-request.d.ts +9 -7
  86. package/lib/events/ui-response.d.ts +2 -2
  87. package/lib/factory.d.ts +2 -1
  88. package/lib/factory.js +2 -1
  89. package/lib/index-browser.js +1 -0
  90. package/lib/index.js +6 -2
  91. package/lib/types/account.d.ts +2 -2
  92. package/lib/types/api/binance/index.d.ts +1 -1
  93. package/lib/types/api/bitcoin/index.d.ts +2 -2
  94. package/lib/types/api/blockchainGetTransactions.d.ts +1 -1
  95. package/lib/types/api/blockchainSetCustomBackend.d.ts +1 -1
  96. package/lib/types/api/blockchainSubscribe.d.ts +1 -1
  97. package/lib/types/api/blockchainSubscribeFiatRates.d.ts +1 -1
  98. package/lib/types/api/cardano/index.d.ts +2 -2
  99. package/lib/types/api/composeTransaction.d.ts +3 -3
  100. package/lib/types/api/dispose.d.ts +1 -1
  101. package/lib/types/api/eos/index.d.ts +1 -1
  102. package/lib/types/api/getAddress.d.ts +1 -1
  103. package/lib/types/api/index.d.ts +2 -0
  104. package/lib/types/api/nem/index.d.ts +9 -9
  105. package/lib/types/api/off.d.ts +2 -2
  106. package/lib/types/api/on.d.ts +2 -2
  107. package/lib/types/api/pushTransaction.d.ts +1 -1
  108. package/lib/types/api/requestWebUSBDevice.d.ts +2 -0
  109. package/lib/types/api/requestWebUSBDevice.js +3 -0
  110. package/lib/types/api/setProxy.d.ts +1 -2
  111. package/lib/types/api/stellar/index.d.ts +2 -2
  112. package/lib/types/coinInfo.d.ts +3 -3
  113. package/lib/types/device.d.ts +13 -13
  114. package/lib/types/firmware.d.ts +3 -3
  115. package/lib/types/params.d.ts +3 -3
  116. package/lib/types/settings.d.ts +1 -2
  117. package/lib/types/utils.d.ts +2 -2
  118. package/lib/utils/accountUtils.d.ts +1 -1
  119. package/lib/utils/browserUtils.d.ts +2 -2
  120. package/lib/utils/debug.d.ts +1 -1
  121. package/lib/utils/deferred.d.ts +2 -2
  122. package/lib/utils/interactionTimeout.d.ts +1 -1
  123. package/lib/workers/RNUsbPlugin.d.ts +1 -1
  124. package/lib/workers/workers.d.ts +1 -1
  125. package/package.json +84 -80
@@ -173,11 +173,12 @@ class DeviceList extends events_1.default {
173
173
  outdated: this.transport.isOutdated,
174
174
  };
175
175
  }
176
- dispose() {
176
+ async dispose() {
177
177
  this.removeAllListeners();
178
178
  if (this.stream) {
179
179
  this.stream.stop();
180
180
  }
181
+ await Promise.all(this.allDevices().map(device => device.dispose()));
181
182
  if (this.transport) {
182
183
  this.transport.stop();
183
184
  }
@@ -185,7 +186,6 @@ class DeviceList extends events_1.default {
185
186
  this.fetchController.abort();
186
187
  this.fetchController = null;
187
188
  }
188
- this.allDevices().forEach(device => device.dispose());
189
189
  }
190
190
  disconnectDevices() {
191
191
  this.allDevices().forEach(device => {
@@ -11,7 +11,6 @@ export declare const BLOCKCHAIN: {
11
11
  };
12
12
  export interface BlockchainInfo extends ServerInfo {
13
13
  coin: CoinInfo;
14
- cleanUrl?: string;
15
14
  misc?: {
16
15
  reserve?: string;
17
16
  };
@@ -21,7 +20,7 @@ export interface BlockchainError {
21
20
  error: string;
22
21
  code?: string;
23
22
  }
24
- export declare type BlockchainBlock = BlockEvent['payload'] & {
23
+ export type BlockchainBlock = BlockEvent['payload'] & {
25
24
  coin: CoinInfo;
26
25
  };
27
26
  export interface BlockchainNotification {
@@ -32,7 +31,7 @@ export interface BlockchainFiatRatesUpdate {
32
31
  coin: CoinInfo;
33
32
  rates: FiatRates;
34
33
  }
35
- export declare type BlockchainEvent = {
34
+ export type BlockchainEvent = {
36
35
  type: typeof BLOCKCHAIN.CONNECT;
37
36
  payload: BlockchainInfo;
38
37
  } | {
@@ -48,9 +47,9 @@ export declare type BlockchainEvent = {
48
47
  type: typeof BLOCKCHAIN.FIAT_RATES_UPDATE;
49
48
  payload: BlockchainFiatRatesUpdate;
50
49
  };
51
- export declare type BlockchainEventMessage = BlockchainEvent & {
50
+ export type BlockchainEventMessage = BlockchainEvent & {
52
51
  event: typeof BLOCKCHAIN_EVENT;
53
52
  };
54
- export declare type BlockchainEventListenerFn = (type: typeof BLOCKCHAIN_EVENT, cb: (event: BlockchainEventMessage) => void) => void;
53
+ export type BlockchainEventListenerFn = (type: typeof BLOCKCHAIN_EVENT, cb: (event: BlockchainEventMessage) => void) => void;
55
54
  export declare const createBlockchainMessage: MessageFactoryFn<typeof BLOCKCHAIN_EVENT, BlockchainEvent>;
56
55
  //# sourceMappingURL=blockchain.d.ts.map
@@ -1,28 +1,28 @@
1
1
  import type { IFRAME } from './iframe';
2
2
  import type { TrezorConnect } from '../types/api';
3
3
  import type { CommonParams } from '../types/params';
4
- declare type UnwrappedResponse<T> = T extends Promise<infer R> ? R extends {
4
+ type UnwrappedResponse<T> = T extends Promise<infer R> ? R extends {
5
5
  success: true;
6
6
  payload: infer P;
7
7
  } ? P : never : void;
8
- declare type OverloadedMethod<T, E extends Record<string, string>> = T extends {
8
+ type OverloadedMethod<T, E extends Record<string, string>> = T extends {
9
9
  (params: infer P1): infer R1;
10
10
  (params: infer P2): infer R2;
11
11
  } ? ((params: P1 & E) => R1) | ((params: P2 & E) => R2) : T extends (...args: infer P) => infer R ? (params: E & P[0]) => R : never;
12
- declare type UnwrappedMethod<T, M extends Record<string, string>> = T extends () => infer R ? (params: M & CommonParams) => R : OverloadedMethod<T, M>;
13
- declare type IsMethodCallable<T> = T extends (...args: any[]) => infer R ? R extends Promise<{
12
+ type UnwrappedMethod<T, M extends Record<string, string>> = T extends () => infer R ? (params: M & CommonParams) => R : OverloadedMethod<T, M>;
13
+ type IsMethodCallable<T> = T extends (...args: any[]) => infer R ? R extends Promise<{
14
14
  success: boolean;
15
15
  }> ? R : never : never;
16
- declare type CallApi = {
16
+ type CallApi = {
17
17
  [K in keyof TrezorConnect]: IsMethodCallable<TrezorConnect[K]> extends never ? never : UnwrappedMethod<TrezorConnect[K], {
18
18
  method: K;
19
19
  }>;
20
20
  };
21
- export declare type CallMethodUnion = CallApi[keyof CallApi];
22
- export declare type CallMethodPayload = Parameters<CallMethodUnion>[0];
23
- export declare type CallMethodResponse<M extends keyof CallApi> = UnwrappedResponse<ReturnType<CallApi[M]>>;
24
- export declare type CallMethodAnyResponse = ReturnType<CallMethodUnion>;
25
- export declare type CallMethod = (params: CallMethodPayload) => Promise<any>;
21
+ export type CallMethodUnion = CallApi[keyof CallApi];
22
+ export type CallMethodPayload = Parameters<CallMethodUnion>[0];
23
+ export type CallMethodResponse<M extends keyof CallApi> = UnwrappedResponse<ReturnType<CallApi[M]>>;
24
+ export type CallMethodAnyResponse = ReturnType<CallMethodUnion>;
25
+ export type CallMethod = (params: CallMethodPayload) => Promise<any>;
26
26
  export interface IFrameCallMessage {
27
27
  event: typeof IFRAME.CALL;
28
28
  type: typeof IFRAME.CALL;
@@ -8,11 +8,12 @@ import type { UiEventMessage } from './ui-request';
8
8
  import type { UiResponseMessage } from './ui-response';
9
9
  import type { Unsuccessful } from '../types/params';
10
10
  export declare const CORE_EVENT = "CORE_EVENT";
11
- export declare type CoreMessage = {
11
+ export type CoreMessage = {
12
12
  id?: number;
13
13
  success?: boolean;
14
14
  } & (BlockchainEventMessage | DeviceEventMessage | TransportEventMessage | UiEventMessage | UiResponseMessage | IFrameCallMessage | MethodResponseMessage | IFrameEventMessage | PopupEventMessage);
15
- export declare type PostMessageEvent = MessageEvent<CoreMessage>;
15
+ export type PostMessageEvent = MessageEvent<CoreMessage>;
16
+ export type PostMessage = (message: CoreMessage) => void;
16
17
  export declare const parseMessage: (messageData: any) => CoreMessage;
17
18
  export declare const createErrorMessage: (error: Error & {
18
19
  code?: string;
@@ -28,13 +28,13 @@ export interface DeviceButtonRequest {
28
28
  device: Device;
29
29
  };
30
30
  }
31
- export declare type DeviceEvent = {
31
+ export type DeviceEvent = {
32
32
  type: typeof DEVICE.CONNECT | typeof DEVICE.CONNECT_UNACQUIRED | typeof DEVICE.CHANGED | typeof DEVICE.DISCONNECT;
33
33
  payload: Device;
34
34
  } | DeviceButtonRequest;
35
- export declare type DeviceEventMessage = DeviceEvent & {
35
+ export type DeviceEventMessage = DeviceEvent & {
36
36
  event: typeof DEVICE_EVENT;
37
37
  };
38
- export declare type DeviceEventListenerFn = (type: typeof DEVICE_EVENT, cb: (event: DeviceEventMessage) => void) => void;
38
+ export type DeviceEventListenerFn = (type: typeof DEVICE_EVENT, cb: (event: DeviceEventMessage) => void) => void;
39
39
  export declare const createDeviceMessage: MessageFactoryFn<typeof DEVICE_EVENT, DeviceEvent>;
40
40
  //# sourceMappingURL=device.d.ts.map
@@ -28,11 +28,11 @@ export interface IFrameInit {
28
28
  extension?: string;
29
29
  };
30
30
  }
31
- export declare type IFrameEvent = {
31
+ export type IFrameEvent = {
32
32
  type: typeof IFRAME.BOOTSTRAP;
33
33
  payload?: typeof undefined;
34
34
  } | IFrameLoaded | IFrameInit | IFrameError;
35
- export declare type IFrameEventMessage = IFrameEvent & {
35
+ export type IFrameEventMessage = IFrameEvent & {
36
36
  event: typeof UI_EVENT;
37
37
  };
38
38
  export declare const createIFrameMessage: MessageFactoryFn<typeof UI_EVENT, IFrameEvent>;
@@ -40,11 +40,11 @@ export interface PopupClosedMessage {
40
40
  error: any;
41
41
  } | null;
42
42
  }
43
- export declare type PopupEvent = {
43
+ export type PopupEvent = {
44
44
  type: typeof POPUP.LOADED | typeof POPUP.CANCEL_POPUP_REQUEST;
45
45
  payload?: typeof undefined;
46
46
  } | PopupInit | PopupHandshake | PopupError | PopupClosedMessage;
47
- export declare type PopupEventMessage = PopupEvent & {
47
+ export type PopupEventMessage = PopupEvent & {
48
48
  event: typeof UI_EVENT;
49
49
  };
50
50
  export declare const createPopupMessage: MessageFactoryFn<typeof UI_EVENT, PopupEvent>;
@@ -5,7 +5,7 @@ export declare const TRANSPORT: {
5
5
  readonly ERROR: "transport-error";
6
6
  readonly UPDATE: "transport-update";
7
7
  readonly STREAM: "transport-stream";
8
- readonly REQUEST: "transport-request_device";
8
+ readonly REQUEST_DEVICE: "transport-request_device";
9
9
  readonly DISABLE_WEBUSB: "transport-disable_webusb";
10
10
  readonly START_PENDING: "transport-start_pending";
11
11
  };
@@ -38,7 +38,7 @@ export interface TransportInfo {
38
38
  bridge?: BridgeInfo;
39
39
  udev?: UdevInfo;
40
40
  }
41
- export declare type TransportEvent = {
41
+ export type TransportEvent = {
42
42
  type: typeof TRANSPORT.START;
43
43
  payload: TransportInfo;
44
44
  } | {
@@ -54,9 +54,13 @@ export interface TransportDisableWebUSB {
54
54
  type: typeof TRANSPORT.DISABLE_WEBUSB;
55
55
  payload?: undefined;
56
56
  }
57
- export declare type TransportEventMessage = TransportEvent & {
57
+ export interface TransportRequestWebUSBDevice {
58
+ type: typeof TRANSPORT.REQUEST_DEVICE;
59
+ payload?: undefined;
60
+ }
61
+ export type TransportEventMessage = TransportEvent & {
58
62
  event: typeof TRANSPORT_EVENT;
59
63
  };
60
- export declare type TransportEventListenerFn = (type: typeof TRANSPORT_EVENT, cb: (event: TransportEventMessage) => void) => void;
64
+ export type TransportEventListenerFn = (type: typeof TRANSPORT_EVENT, cb: (event: TransportEventMessage) => void) => void;
61
65
  export declare const createTransportMessage: MessageFactoryFn<typeof TRANSPORT_EVENT, TransportEvent>;
62
66
  //# sourceMappingURL=transport.d.ts.map
@@ -8,7 +8,7 @@ exports.TRANSPORT = {
8
8
  ERROR: 'transport-error',
9
9
  UPDATE: 'transport-update',
10
10
  STREAM: 'transport-stream',
11
- REQUEST: 'transport-request_device',
11
+ REQUEST_DEVICE: 'transport-request_device',
12
12
  DISABLE_WEBUSB: 'transport-disable_webusb',
13
13
  START_PENDING: 'transport-start_pending',
14
14
  };
@@ -2,11 +2,11 @@ import type { DEVICE } from './device';
2
2
  import type { Device } from '../device/Device';
3
3
  import type { UiResponseEvent } from './ui-response';
4
4
  import type { Deferred } from '../utils/deferred';
5
- export declare type UiPromiseResponse = UiResponseEvent | {
5
+ export type UiPromiseResponse = UiResponseEvent | {
6
6
  type: typeof DEVICE.DISCONNECT;
7
7
  payload?: undefined;
8
8
  };
9
- export declare type UiPromise<T extends UiPromiseResponse['type']> = Deferred<Extract<UiPromiseResponse, {
9
+ export type UiPromise<T extends UiPromiseResponse['type']> = Deferred<Extract<UiPromiseResponse, {
10
10
  type: T;
11
11
  }>, T, Device>;
12
12
  //# sourceMappingURL=ui-promise.d.ts.map
@@ -1,5 +1,6 @@
1
+ import type { EventTypeDeviceSelected } from '@trezor/connect-analytics';
1
2
  import type { PROTO } from '../constants';
2
- import type { TransportDisableWebUSB } from './transport';
3
+ import type { TransportDisableWebUSB, TransportRequestWebUSBDevice } from './transport';
3
4
  import type { Device, CoinInfo, BitcoinNetworkInfo } from '../types';
4
5
  import type { DiscoveryAccountType, DiscoveryAccount, SelectFeeLevel } from '../types/account';
5
6
  import type { MessageFactoryFn } from '../types/utils';
@@ -43,7 +44,7 @@ export declare const UI_REQUEST: {
43
44
  readonly ADDRESS_VALIDATION: "ui-address_validation";
44
45
  readonly IFRAME_FAILURE: "ui-iframe_failure";
45
46
  };
46
- export declare type UiRequestWithoutPayload = {
47
+ export type UiRequestWithoutPayload = {
47
48
  type: typeof UI_REQUEST.LOADING;
48
49
  payload?: typeof undefined;
49
50
  } | {
@@ -65,7 +66,7 @@ export declare type UiRequestWithoutPayload = {
65
66
  type: typeof UI_REQUEST.LOGIN_CHALLENGE_REQUEST;
66
67
  payload?: typeof undefined;
67
68
  };
68
- export declare type UiRequestDeviceAction = {
69
+ export type UiRequestDeviceAction = {
69
70
  type: typeof UI_REQUEST.REQUEST_PIN;
70
71
  payload: {
71
72
  device: Device;
@@ -141,6 +142,7 @@ export interface UiRequestConfirmation {
141
142
  className: string;
142
143
  label: string;
143
144
  };
145
+ analytics?: EventTypeDeviceSelected;
144
146
  };
145
147
  }
146
148
  export interface UiRequestSelectDevice {
@@ -198,11 +200,11 @@ export interface FirmwareProgress {
198
200
  progress: number;
199
201
  };
200
202
  }
201
- export declare type UiEvent = UiRequestWithoutPayload | UiRequestDeviceAction | UiRequestButton | UiRequestPermission | UiRequestConfirmation | UiRequestSelectDevice | UiRequestUnexpectedDeviceMode | UiRequestSelectAccount | UiRequestSelectFee | UpdateCustomFee | BundleProgress<any> | FirmwareProgress | FirmwareException | UiRequestAddressValidation | UiRequestSetOperation | TransportDisableWebUSB;
202
- export declare type UiEventMessage = UiEvent & {
203
+ export type UiEvent = UiRequestWithoutPayload | UiRequestDeviceAction | UiRequestButton | UiRequestPermission | UiRequestConfirmation | UiRequestSelectDevice | UiRequestUnexpectedDeviceMode | UiRequestSelectAccount | UiRequestSelectFee | UpdateCustomFee | BundleProgress<any> | FirmwareProgress | FirmwareException | UiRequestAddressValidation | UiRequestSetOperation | TransportDisableWebUSB | TransportRequestWebUSBDevice;
204
+ export type UiEventMessage = UiEvent & {
203
205
  event: typeof UI_EVENT;
204
206
  };
205
- export declare type ProgressEventListenerFn = <R>(type: typeof UI_REQUEST.BUNDLE_PROGRESS, cb: (event: BundleProgress<R>['payload']) => void) => void;
206
- export declare type UiEventListenerFn = (type: typeof UI_EVENT, cb: (event: UiEventMessage) => void) => void;
207
+ export type ProgressEventListenerFn = <R>(type: typeof UI_REQUEST.BUNDLE_PROGRESS, cb: (event: BundleProgress<R>['payload']) => void) => void;
208
+ export type UiEventListenerFn = (type: typeof UI_EVENT, cb: (event: UiEventMessage) => void) => void;
207
209
  export declare const createUiMessage: MessageFactoryFn<typeof UI_EVENT, UiEvent>;
208
210
  //# sourceMappingURL=ui-request.d.ts.map
@@ -80,8 +80,8 @@ export interface UiResponseLoginChallenge {
80
80
  challengeVisual: string;
81
81
  };
82
82
  }
83
- export declare type UiResponseEvent = UiResponsePopupHandshake | UiResponsePermission | UiResponseConfirmation | UiResponseDevice | UiResponsePin | UiResponseWord | UiResponsePassphrase | UiResponsePassphraseAction | UiResponseAccount | UiResponseFee | UiResponseLoginChallenge;
84
- export declare type UiResponseMessage = UiResponseEvent & {
83
+ export type UiResponseEvent = UiResponsePopupHandshake | UiResponsePermission | UiResponseConfirmation | UiResponseDevice | UiResponsePin | UiResponseWord | UiResponsePassphrase | UiResponsePassphraseAction | UiResponseAccount | UiResponseFee | UiResponseLoginChallenge;
84
+ export type UiResponseMessage = UiResponseEvent & {
85
85
  event: typeof UI_EVENT;
86
86
  };
87
87
  export declare const createUiResponse: MessageFactoryFn<typeof UI_EVENT, UiResponseEvent>;
package/lib/factory.d.ts CHANGED
@@ -11,9 +11,10 @@ interface Dependencies {
11
11
  uiResponse: TrezorConnect['uiResponse'];
12
12
  renderWebUSBButton: TrezorConnect['renderWebUSBButton'];
13
13
  disableWebUSB: TrezorConnect['disableWebUSB'];
14
+ requestWebUSBDevice: TrezorConnect['requestWebUSBDevice'];
14
15
  cancel: TrezorConnect['cancel'];
15
16
  dispose: TrezorConnect['dispose'];
16
17
  }
17
- export declare const factory: ({ eventEmitter, manifest, init, call, requestLogin, uiResponse, renderWebUSBButton, disableWebUSB, cancel, dispose, }: Dependencies) => TrezorConnect;
18
+ export declare const factory: ({ eventEmitter, manifest, init, call, requestLogin, uiResponse, renderWebUSBButton, disableWebUSB, requestWebUSBDevice, cancel, dispose, }: Dependencies) => TrezorConnect;
18
19
  export {};
19
20
  //# sourceMappingURL=factory.d.ts.map
package/lib/factory.js CHANGED
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.factory = void 0;
4
4
  const events_1 = require("./events");
5
- const factory = ({ eventEmitter, manifest, init, call, requestLogin, uiResponse, renderWebUSBButton, disableWebUSB, cancel, dispose, }) => {
5
+ const factory = ({ eventEmitter, manifest, init, call, requestLogin, uiResponse, renderWebUSBButton, disableWebUSB, requestWebUSBDevice, cancel, dispose, }) => {
6
6
  const api = {
7
7
  manifest,
8
8
  init,
@@ -123,6 +123,7 @@ const factory = ({ eventEmitter, manifest, init, call, requestLogin, uiResponse,
123
123
  cancel,
124
124
  renderWebUSBButton,
125
125
  disableWebUSB,
126
+ requestWebUSBDevice,
126
127
  };
127
128
  return api;
128
129
  };
@@ -17,6 +17,7 @@ const TrezorConnect = (0, factory_1.factory)({
17
17
  init: fallback,
18
18
  call: fallback,
19
19
  requestLogin: fallback,
20
+ requestWebUSBDevice: fallback,
20
21
  uiResponse: fallback,
21
22
  renderWebUSBButton: fallback,
22
23
  disableWebUSB: fallback,
package/lib/index.js CHANGED
@@ -22,11 +22,11 @@ const manifest = (data) => {
22
22
  manifest: data,
23
23
  });
24
24
  };
25
- const dispose = () => {
25
+ const dispose = async () => {
26
26
  exports.eventEmitter.removeAllListeners();
27
27
  _settings = (0, connectSettings_1.parseConnectSettings)();
28
28
  if (_core) {
29
- _core.dispose();
29
+ await _core.dispose();
30
30
  _core = null;
31
31
  }
32
32
  };
@@ -186,6 +186,9 @@ const renderWebUSBButton = (_className) => {
186
186
  const disableWebUSB = () => {
187
187
  throw constants_1.ERRORS.TypedError('Method_InvalidPackage');
188
188
  };
189
+ const requestWebUSBDevice = () => {
190
+ throw constants_1.ERRORS.TypedError('Method_InvalidPackage');
191
+ };
189
192
  const TrezorConnect = (0, factory_1.factory)({
190
193
  eventEmitter: exports.eventEmitter,
191
194
  manifest,
@@ -195,6 +198,7 @@ const TrezorConnect = (0, factory_1.factory)({
195
198
  uiResponse,
196
199
  renderWebUSBButton,
197
200
  disableWebUSB,
201
+ requestWebUSBDevice,
198
202
  cancel,
199
203
  dispose,
200
204
  });
@@ -1,6 +1,6 @@
1
1
  import type { AccountInfo as AccountInfoBase, AccountAddresses, Utxo as AccountUtxo } from '@trezor/blockchain-link';
2
2
  export type { AccountAddresses, Utxo as AccountUtxo, Address as AccountAddress, } from '@trezor/blockchain-link';
3
- export declare type DiscoveryAccountType = 'p2pkh' | 'p2sh' | 'p2tr' | 'p2wpkh';
3
+ export type DiscoveryAccountType = 'p2pkh' | 'p2sh' | 'p2tr' | 'p2wpkh';
4
4
  export interface AccountInfo extends AccountInfoBase {
5
5
  path?: string;
6
6
  legacyXpub?: string;
@@ -22,7 +22,7 @@ export interface FeeLevel {
22
22
  feeLimit?: string;
23
23
  feePerTx?: string;
24
24
  }
25
- export declare type SelectFeeLevel = {
25
+ export type SelectFeeLevel = {
26
26
  name: string;
27
27
  fee: '0';
28
28
  feePerByte?: undefined;
@@ -9,7 +9,7 @@ export interface BinanceSDKTransaction {
9
9
  placeOrder?: PROTO.BinanceOrderMsg;
10
10
  cancelOrder?: PROTO.BinanceCancelMsg;
11
11
  }
12
- export declare type BinancePreparedMessage = (PROTO.BinanceTransferMsg & {
12
+ export type BinancePreparedMessage = (PROTO.BinanceTransferMsg & {
13
13
  type: 'BinanceTransferMsg';
14
14
  }) | (PROTO.BinanceOrderMsg & {
15
15
  type: 'BinanceOrderMsg';
@@ -7,7 +7,7 @@ export interface SignMessage {
7
7
  hex?: boolean;
8
8
  no_script_type?: boolean;
9
9
  }
10
- export declare type RefTransaction = {
10
+ export type RefTransaction = {
11
11
  hash: string;
12
12
  version: number;
13
13
  inputs: PROTO.PrevInput[];
@@ -71,7 +71,7 @@ export interface SignTransaction {
71
71
  serialize?: boolean;
72
72
  coinjoinRequest?: PROTO.CoinJoinRequest;
73
73
  }
74
- export declare type SignedTransaction = {
74
+ export type SignedTransaction = {
75
75
  signatures: string[];
76
76
  serializedTx: string;
77
77
  witnesses?: (string | undefined)[];
@@ -1,6 +1,6 @@
1
1
  import type { TypedRawTransaction } from '@trezor/blockchain-link';
2
2
  import type { CommonParamsWithCoin, Response } from '../params';
3
- export declare type BlockchainGetTransactions = CommonParamsWithCoin & {
3
+ export type BlockchainGetTransactions = CommonParamsWithCoin & {
4
4
  txs: string[];
5
5
  };
6
6
  export declare function blockchainGetTransactions(params: BlockchainGetTransactions): Response<TypedRawTransaction[]>;
@@ -1,6 +1,6 @@
1
1
  import type { CommonParamsWithCoin, Response } from '../params';
2
2
  import type { BlockchainLink } from '../coinInfo';
3
- export declare type BlockchainSetCustomBackend = CommonParamsWithCoin & {
3
+ export type BlockchainSetCustomBackend = CommonParamsWithCoin & {
4
4
  blockchainLink?: BlockchainLink;
5
5
  };
6
6
  export declare function blockchainSetCustomBackend(params: BlockchainSetCustomBackend): Response<boolean>;
@@ -1,6 +1,6 @@
1
1
  import type { SubscriptionAccountInfo, BlockchainLinkResponse } from '@trezor/blockchain-link';
2
2
  import type { CommonParamsWithCoin, Response } from '../params';
3
- export declare type BlockchainSubscribe = CommonParamsWithCoin & {
3
+ export type BlockchainSubscribe = CommonParamsWithCoin & {
4
4
  accounts?: SubscriptionAccountInfo[];
5
5
  };
6
6
  export declare function blockchainSubscribe(params: BlockchainSubscribe): Response<BlockchainLinkResponse<'subscribe'>>;
@@ -1,6 +1,6 @@
1
1
  import type { BlockchainLinkResponse } from '@trezor/blockchain-link';
2
2
  import type { CommonParamsWithCoin, Response } from '../params';
3
- export declare type BlockchainSubscribeFiatRates = CommonParamsWithCoin & {
3
+ export type BlockchainSubscribeFiatRates = CommonParamsWithCoin & {
4
4
  currency?: string;
5
5
  };
6
6
  export declare function blockchainSubscribeFiatRates(params: BlockchainSubscribeFiatRates): Response<BlockchainLinkResponse<'subscribe'>>;
@@ -67,7 +67,7 @@ export interface CardanoAssetGroup {
67
67
  policyId: string;
68
68
  tokenAmounts: CardanoToken[];
69
69
  }
70
- export declare type CardanoOutput = ({
70
+ export type CardanoOutput = ({
71
71
  addressParameters: CardanoAddressParameters;
72
72
  } | {
73
73
  address: string;
@@ -123,7 +123,7 @@ export interface CardanoWithdrawal {
123
123
  scriptHash?: string;
124
124
  keyHash?: string;
125
125
  }
126
- export declare type CardanoMint = CardanoAssetGroup[];
126
+ export type CardanoMint = CardanoAssetGroup[];
127
127
  export interface CardanoCollateralInput {
128
128
  path?: string | number[];
129
129
  prev_hash: string;
@@ -28,7 +28,7 @@ export interface NoAddressOutput {
28
28
  export interface NoAddressSendMaxOutput {
29
29
  type: 'send-max-noaddress';
30
30
  }
31
- export declare type ComposeOutput = RegularOutput | InternalOutput | SendMaxOutput | OpReturnOutput | NoAddressOutput | NoAddressSendMaxOutput;
31
+ export type ComposeOutput = RegularOutput | InternalOutput | SendMaxOutput | OpReturnOutput | NoAddressOutput | NoAddressSendMaxOutput;
32
32
  export interface ComposeParams {
33
33
  outputs: ComposeOutput[];
34
34
  coin: string;
@@ -40,7 +40,7 @@ export interface ComposeParams {
40
40
  floorBaseFee?: boolean;
41
41
  skipPermutation?: boolean;
42
42
  }
43
- export declare type SignedTransaction = {
43
+ export type SignedTransaction = {
44
44
  signatures: string[];
45
45
  serializedTx: string;
46
46
  txid?: string;
@@ -64,7 +64,7 @@ export interface PrecomposeParams {
64
64
  sequence?: number;
65
65
  skipPermutation?: boolean;
66
66
  }
67
- export declare type PrecomposedTransaction = {
67
+ export type PrecomposedTransaction = {
68
68
  type: 'error';
69
69
  error: string;
70
70
  } | {
@@ -1,2 +1,2 @@
1
- export declare function dispose(): void;
1
+ export declare function dispose(): Promise<void>;
2
2
  //# sourceMappingURL=dispose.d.ts.map
@@ -26,7 +26,7 @@ export interface EosTxActionCommon {
26
26
  account: string;
27
27
  authorization: PROTO.EosPermissionLevel[];
28
28
  }
29
- export declare type EosTxAction = (EosTxActionCommon & {
29
+ export type EosTxAction = (EosTxActionCommon & {
30
30
  name: 'transfer';
31
31
  data: {
32
32
  from: string;
@@ -7,7 +7,7 @@ interface GetAddress extends GetAddressShared {
7
7
  scriptType?: PROTO.InternalInputScriptType;
8
8
  unlockPath?: PROTO.UnlockPath;
9
9
  }
10
- declare type Address = AddressShared & PROTO.Address;
10
+ type Address = AddressShared & PROTO.Address;
11
11
  export declare function getAddress(params: Params<GetAddress>): Response<Address>;
12
12
  export declare function getAddress(params: BundledParams<GetAddress>): Response<Address[]>;
13
13
  export {};
@@ -57,6 +57,7 @@ import { recoveryDevice } from './recoveryDevice';
57
57
  import { removeAllListeners } from './removeAllListeners';
58
58
  import { renderWebUSBButton } from './renderWebUSBButton';
59
59
  import { requestLogin } from './requestLogin';
60
+ import { requestWebUSBDevice } from './requestWebUSBDevice';
60
61
  import { resetDevice } from './resetDevice';
61
62
  import { rippleGetAddress } from './rippleGetAddress';
62
63
  import { rippleSignTransaction } from './rippleSignTransaction';
@@ -102,6 +103,7 @@ export interface TrezorConnect {
102
103
  cipherKeyValue: typeof cipherKeyValue;
103
104
  composeTransaction: typeof composeTransaction;
104
105
  disableWebUSB: typeof disableWebUSB;
106
+ requestWebUSBDevice: typeof requestWebUSBDevice;
105
107
  dispose: typeof dispose;
106
108
  eosGetPublicKey: typeof eosGetPublicKey;
107
109
  eosSignTransaction: typeof eosSignTransaction;
@@ -37,52 +37,52 @@ export interface TransactionCommon {
37
37
  deadline: number;
38
38
  signer?: string;
39
39
  }
40
- export declare type NEMTransferTransaction = TransactionCommon & {
40
+ export type NEMTransferTransaction = TransactionCommon & {
41
41
  type: NEM.TxType.TRANSFER;
42
42
  recipient: string;
43
43
  amount: PROTO.UintType;
44
44
  mosaics?: NEMMosaic[];
45
45
  message?: Message;
46
46
  };
47
- export declare type NEMImportanceTransaction = TransactionCommon & {
47
+ export type NEMImportanceTransaction = TransactionCommon & {
48
48
  type: NEM.TxType.IMPORTANCE_TRANSFER;
49
49
  importanceTransfer: {
50
50
  mode: PROTO.NEMImportanceTransferMode;
51
51
  publicKey: string;
52
52
  };
53
53
  };
54
- export declare type NEMAggregateModificationTransaction = TransactionCommon & {
54
+ export type NEMAggregateModificationTransaction = TransactionCommon & {
55
55
  type: NEM.TxType.AGGREGATE_MODIFICATION;
56
56
  modifications?: Modification[];
57
57
  minCosignatories: {
58
58
  relativeChange: number;
59
59
  };
60
60
  };
61
- export declare type NEMProvisionNamespaceTransaction = TransactionCommon & {
61
+ export type NEMProvisionNamespaceTransaction = TransactionCommon & {
62
62
  type: NEM.TxType.PROVISION_NAMESPACE;
63
63
  newPart: string;
64
64
  parent?: string;
65
65
  rentalFeeSink: string;
66
66
  rentalFee: number;
67
67
  };
68
- export declare type NEMMosaicCreationTransaction = TransactionCommon & {
68
+ export type NEMMosaicCreationTransaction = TransactionCommon & {
69
69
  type: NEM.TxType.MOSAIC_CREATION;
70
70
  mosaicDefinition: MosaicDefinition;
71
71
  creationFeeSink: string;
72
72
  creationFee: number;
73
73
  };
74
- export declare type NEMSupplyChangeTransaction = TransactionCommon & {
74
+ export type NEMSupplyChangeTransaction = TransactionCommon & {
75
75
  type: NEM.TxType.SUPPLY_CHANGE;
76
76
  mosaicId: MosaicID;
77
77
  supplyType: PROTO.NEMSupplyChangeType;
78
78
  delta: number;
79
79
  };
80
- export declare type NEMRegularTransaction = NEMTransferTransaction | NEMImportanceTransaction | NEMAggregateModificationTransaction | NEMProvisionNamespaceTransaction | NEMMosaicCreationTransaction | NEMSupplyChangeTransaction;
81
- export declare type NEMMultisigTransaction = TransactionCommon & {
80
+ export type NEMRegularTransaction = NEMTransferTransaction | NEMImportanceTransaction | NEMAggregateModificationTransaction | NEMProvisionNamespaceTransaction | NEMMosaicCreationTransaction | NEMSupplyChangeTransaction;
81
+ export type NEMMultisigTransaction = TransactionCommon & {
82
82
  type: NEM.TxType.COSIGNING | NEM.TxType.MULTISIG | NEM.TxType.MULTISIG_SIGNATURE;
83
83
  otherTrans: NEMRegularTransaction;
84
84
  };
85
- export declare type NEMTransaction = NEMRegularTransaction | NEMMultisigTransaction;
85
+ export type NEMTransaction = NEMRegularTransaction | NEMMultisigTransaction;
86
86
  export interface NEMSignTransaction {
87
87
  path: string | number[];
88
88
  transaction: NEMTransaction;
@@ -2,10 +2,10 @@ import { BLOCKCHAIN_EVENT, BlockchainEvent } from '../../events/blockchain';
2
2
  import { DEVICE_EVENT, DeviceEvent } from '../../events/device';
3
3
  import { TRANSPORT_EVENT, TransportEvent } from '../../events/transport';
4
4
  import { UI_EVENT, UiEvent } from '../../events/ui-request';
5
- declare type EventType<Event> = Event extends {
5
+ type EventType<Event> = Event extends {
6
6
  type: string;
7
7
  } ? Event['type'] : never;
8
- export declare type EventListenerType = typeof BLOCKCHAIN_EVENT | typeof DEVICE_EVENT | typeof TRANSPORT_EVENT | typeof UI_EVENT | EventType<TransportEvent> | EventType<UiEvent> | EventType<DeviceEvent> | EventType<BlockchainEvent>;
8
+ export type EventListenerType = typeof BLOCKCHAIN_EVENT | typeof DEVICE_EVENT | typeof TRANSPORT_EVENT | typeof UI_EVENT | EventType<TransportEvent> | EventType<UiEvent> | EventType<DeviceEvent> | EventType<BlockchainEvent>;
9
9
  export declare function off(type: EventListenerType, cb: (...args: any[]) => any): void;
10
10
  export {};
11
11
  //# sourceMappingURL=off.d.ts.map
@@ -3,12 +3,12 @@ import type { DeviceEvent, DeviceEventListenerFn } from '../../events/device';
3
3
  import type { TransportEvent, TransportEventListenerFn } from '../../events/transport';
4
4
  import type { UiEvent, UiEventListenerFn, ProgressEventListenerFn } from '../../events/ui-request';
5
5
  import type { UnionToIntersection } from '../utils';
6
- declare type DetailedEvent<Event> = Event extends {
6
+ type DetailedEvent<Event> = Event extends {
7
7
  type: string;
8
8
  } ? Event extends {
9
9
  payload: any;
10
10
  } ? (type: Event['type'], cb: (event: Event['payload']) => any) => void : (type: Event['type'], cb: () => any) => void : never;
11
- declare type EventsUnion = BlockchainEventListenerFn | DetailedEvent<BlockchainEvent> | DeviceEventListenerFn | DetailedEvent<DeviceEvent> | TransportEventListenerFn | DetailedEvent<TransportEvent> | UiEventListenerFn | DetailedEvent<UiEvent> | ProgressEventListenerFn;
11
+ type EventsUnion = BlockchainEventListenerFn | DetailedEvent<BlockchainEvent> | DeviceEventListenerFn | DetailedEvent<DeviceEvent> | TransportEventListenerFn | DetailedEvent<TransportEvent> | UiEventListenerFn | DetailedEvent<UiEvent> | ProgressEventListenerFn;
12
12
  export declare const on: UnionToIntersection<EventsUnion>;
13
13
  export {};
14
14
  //# sourceMappingURL=on.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import type { Params, Response } from '../params';
2
- export declare type PushTransaction = {
2
+ export type PushTransaction = {
3
3
  tx: string;
4
4
  coin: string;
5
5
  };
@@ -0,0 +1,2 @@
1
+ export declare function requestWebUSBDevice(): void;
2
+ //# sourceMappingURL=requestWebUSBDevice.d.ts.map
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=requestWebUSBDevice.js.map