@onekeyfe/hd-core 0.2.48 → 0.2.49-alpha.1

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.
@@ -135,7 +135,7 @@ export default class StellarSignTransaction extends BaseMethod<HardwareStellarSi
135
135
  value?: undefined;
136
136
  bump_to?: undefined;
137
137
  } | {
138
- signer_type?: 0 | 2 | 1 | undefined;
138
+ signer_type?: 0 | 1 | 2 | undefined;
139
139
  signer_key?: string | Buffer | undefined;
140
140
  signer_weight?: number | undefined;
141
141
  type: string;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import EventEmitter, { EventEmitter as EventEmitter$1 } from 'events';
1
+ import EventEmitter$1, { EventEmitter } from 'events';
2
2
  import * as _onekeyfe_hd_transport from '@onekeyfe/hd-transport';
3
3
  import { Messages, Success as Success$1, RecoveryDeviceType, SafetyCheckLevel, ResourceType, CipheredKeyValue as CipheredKeyValue$1, EthereumPublicKey, EthereumMessageSignature, Address, MultisigRedeemScriptType, InputScriptType, PublicKey, MessageSignature, PrevInput, TxOutputBinType, TxInput, TxOutputType, TxInputType, StarcoinAddress as StarcoinAddress$1, StarcoinPublicKey as StarcoinPublicKey$1, StarcoinMessageSignature, StarcoinSignedTx, NEMAddress as NEMAddress$1, NEMSignedTx, SolanaAddress as SolanaAddress$1, SolanaSignedTx as SolanaSignedTx$1, StellarAddress as StellarAddress$1, StellarSignedTx, TronAddress as TronAddress$1, UintType, TronSignedTx, TronMessageSignature, ConfluxAddress as ConfluxAddress$1, ConfluxMessageSignature, NearAddress as NearAddress$1, NearSignedTx, AptosAddress as AptosAddress$1, AptosMessageSignature as AptosMessageSignature$1, AptosSignedTx as AptosSignedTx$1, AlgorandAddress, AlgorandSignedTx, CosmosAddress as CosmosAddress$1, CosmosSignedTx as CosmosSignedTx$1, SuiAddress as SuiAddress$1, CardanoAddressParametersType, CardanoMessageSignature, FilecoinAddress as FilecoinAddress$1, FilecoinSignedTx as FilecoinSignedTx$1, PolkadotAddress as PolkadotAddress$1, PolkadotSignedTx as PolkadotSignedTx$1, OneKeyDeviceInfo, Transport, ChangeOutputScriptType } from '@onekeyfe/hd-transport';
4
4
  export { Messages as PROTO } from '@onekeyfe/hd-transport';
@@ -36,6 +36,20 @@ declare const removeAllListeners: (type: any) => void;
36
36
 
37
37
  declare function uiResponse(response: UiResponseEvent): void;
38
38
 
39
+ declare type IAddHardwareGlobalEventListener = (coreMessage: CoreMessage) => void;
40
+ interface LowLevelInjectApi {
41
+ call: CallMethod;
42
+ eventEmitter: EventEmitter;
43
+ init: CoreApi['init'];
44
+ dispose: CoreApi['dispose'];
45
+ uiResponse: CoreApi['uiResponse'];
46
+ cancel: CoreApi['cancel'];
47
+ addHardwareGlobalEventListener: (listener: IAddHardwareGlobalEventListener) => void;
48
+ }
49
+ declare type LowLevelCoreApi = Omit<CoreApi, 'on' | 'off'> & {
50
+ addHardwareGlobalEventListener: (listener: IAddHardwareGlobalEventListener) => void;
51
+ };
52
+
39
53
  declare const safeThrowError: (error: any) => never;
40
54
 
41
55
  declare type DeviceStatus = 'available' | 'occupied' | 'used';
@@ -196,7 +210,7 @@ declare type RemoteConfigResponse = {
196
210
  bridge: AssetsMap['bridge'];
197
211
  } & DeviceTypeMap;
198
212
 
199
- declare function init$1(settings: Partial<ConnectSettings>): Promise<boolean>;
213
+ declare function init$1(settings: Partial<ConnectSettings>, lowLevelApi?: LowLevelCoreApi): Promise<boolean>;
200
214
 
201
215
  declare function getLogs(): Response<string[]>;
202
216
 
@@ -1512,6 +1526,7 @@ declare type CoreApi = {
1512
1526
  init: typeof init$1;
1513
1527
  on: typeof on;
1514
1528
  off: typeof off;
1529
+ emit: (event: string, ...args: any[]) => void;
1515
1530
  removeAllListeners: typeof removeAllListeners;
1516
1531
  dispose: () => void;
1517
1532
  call: (params: any) => Promise<any>;
@@ -1992,7 +2007,7 @@ interface Device {
1992
2007
  off<K extends keyof DeviceEvents>(type: K, listener: (...event: DeviceEvents[K]) => void): this;
1993
2008
  emit<K extends keyof DeviceEvents>(type: K, ...args: DeviceEvents[K]): boolean;
1994
2009
  }
1995
- declare class Device extends EventEmitter {
2010
+ declare class Device extends EventEmitter$1 {
1996
2011
  originalDescriptor: OneKeyDeviceInfo;
1997
2012
  mainId?: string | null;
1998
2013
  deviceConnector?: DeviceConnector | null;
@@ -2054,14 +2069,19 @@ declare type UiPromise<T extends UiPromiseResponse['type']> = Deferred<Extract<U
2054
2069
 
2055
2070
  interface InjectApi {
2056
2071
  call: CallMethod;
2057
- eventEmitter: EventEmitter$1;
2072
+ eventEmitter: EventEmitter;
2058
2073
  init: CoreApi['init'];
2059
2074
  dispose: CoreApi['dispose'];
2060
2075
  uiResponse: CoreApi['uiResponse'];
2061
2076
  cancel: CoreApi['cancel'];
2062
2077
  }
2063
2078
 
2064
- declare class Core extends EventEmitter {
2079
+ interface TopLevelInjectApi {
2080
+ init: CoreApi['init'];
2081
+ call: CoreApi['call'];
2082
+ }
2083
+
2084
+ declare class Core extends EventEmitter$1 {
2065
2085
  handleMessage(message: CoreMessage): Promise<any>;
2066
2086
  dispose(): void;
2067
2087
  }
@@ -2178,5 +2198,7 @@ declare class DataManager {
2178
2198
  }
2179
2199
 
2180
2200
  declare const HardwareSdk: ({ init, call, dispose, eventEmitter, uiResponse, cancel, }: InjectApi) => CoreApi;
2201
+ declare const HardwareSDKLowLevel: ({ init, call, dispose, eventEmitter, addHardwareGlobalEventListener, uiResponse, cancel, }: LowLevelInjectApi) => LowLevelCoreApi;
2202
+ declare const HardwareTopLevelSdk: () => CoreApi;
2181
2203
 
2182
- export { AccountAddress, AccountAddresses, AlgoAddress, AlgoGetAddressParams, AlgoSignTransactionParams, AlgoSignedTx, AptosAddress, AptosGetAddressParams, AptosGetPublicKeyParams, AptosMessageSignature, AptosPublicKey, AptosSignMessageParams, AptosSignTransactionParams, AptosSignedTx, AssetsMap, BTCAddress, BTCGetAddressParams, BTCGetPublicKeyParams, BTCPublicKey, BTCSignMessageParams, BTCSignTransactionParams, BTCVerifyMessageParams, BleReleaseInfoEvent, BleReleaseInfoPayload, CORE_EVENT, CallMethod, CallMethodAnyResponse, CallMethodKeys, CallMethodPayload, CallMethodResponse, CallMethodUnion, CardanoAddress, CardanoGetAddressMethodParams, CardanoGetAddressParams, CardanoSignTransaction, CardanoSignedTxData, CipheredKeyValue, CipheredKeyValueParams, CommonParams, ConfluxAddress, ConfluxGetAddressParams, ConfluxSignMessageCIP23Params, ConfluxSignMessageParams, ConfluxSignTransactionParams, ConfluxSignedTx, ConfluxTransaction, ConnectSettings, Core, CoreApi, CoreMessage, CosmosAddress, CosmosGetAddressParams, CosmosGetPublicKeyParams, CosmosPublicKey, CosmosSignTransactionParams, CosmosSignedTx, DEFAULT_PRIORITY, DEVICE, DEVICE_EVENT, DataManager, Device$1 as Device, DeviceButtonRequest, DeviceButtonRequestPayload, DeviceChangePinParams, DeviceConnnectRequest, DeviceDisconnnectRequest, DeviceEvent, DeviceEventListenerFn, DeviceEventMessage, DeviceFeaturesPayload, DeviceFirmwareRange, DeviceFlagsParams, DeviceMode, DeviceRecoveryParams, DeviceResetParams, DeviceSendFeatures, DeviceSendSupportFeatures, DeviceSettingsParams, DeviceStatus, DeviceSupportFeatures, DeviceSupportFeaturesPayload, DeviceTypeMap, DeviceUploadResourceParams, DeviceVerifyParams, DeviceVerifySignature, EVMAccessList, EVMAddress, EVMGetAddressParams, EVMGetPublicKeyParams, EVMPublicKey, EVMSignMessageEIP712Params, EVMSignMessageParams, EVMSignTransactionParams, EVMSignTypedDataParams, EVMSignedTx, EVMTransaction, EVMTransactionEIP1559, EVMVerifyMessageParams, EthereumSignTypedDataMessage, EthereumSignTypedDataTypeProperty, EthereumSignTypedDataTypes, FIRMWARE, FIRMWARE_EVENT, Features, FilecoinAddress, FilecoinGetAddressParams, FilecoinSignTransactionParams, FilecoinSignedTx, FirmwareEvent, FirmwareMessage, FirmwareProgress, FirmwareRange, FirmwareRelease$1 as FirmwareRelease, FirmwareTip, FirmwareUpdateBinaryParams, FirmwareUpdateParams, IBLEFirmwareReleaseInfo, IDeviceBLEFirmwareStatus, IDeviceFirmwareStatus, IDeviceModel, IDeviceType, IFRAME, IFirmwareReleaseInfo, IFrameBridge, IFrameCallMessage, IFrameCancelMessage, IFrameEvent, IFrameEventMessage, IFrameInit, ILocale, ITransportStatus, IVersionArray, KnownDevice, LOG, LOG_EVENT, LogEvent, LogEventMessage, LogOutput, LoggerNames, MajorVersion, MethodResponseMessage, NEMAddress, NEMAggregateModificationTransaction, NEMGetAddressParams, NEMImportanceTransaction, NEMMosaic, NEMMosaicCreationTransaction, NEMMultisigTransaction, NEMProvisionNamespaceTransaction, NEMSignTransactionParams, NEMSupplyChangeTransaction, NEMTransaction, NEMTransferTransaction, NearAddress, NearGetAddressParams, NearSignTransactionParams, Params, PolkadotAddress, PolkadotGetAddressParams, PolkadotSignTransactionParams, PolkadotSignedTx, PostMessageEvent, PreviousAddressResult, RESPONSE_EVENT, RefTransaction, ReleaseInfo, ReleaseInfoEvent, ReleaseInfoPayload, RemoteConfigResponse, Response, SearchDevice, SignedTransaction, SolanaAddress, SolanaGetAddressParams, SolanaSignTransactionParams, SolanaSignedTx, StarcoinAddress, StarcoinGetAddressParams, StarcoinGetPublicKeyParams, StarcoinPublicKey, StarcoinSignMessageParams, StarcoinSignTransactionParams, StarcoinVerifyMessageParams, StellarAddress, StellarAsset, StellarGetAddressParams, StellarOperation, StellarSignTransactionParams, StellarTransaction, StrictFeatures, Success, SuiAddress, SuiGetAddressParams, SuiGetPublicKeyParams, SuiPublicKey, SuiSignTransactionParams, SuiSignedTx, SupportFeatureType, SupportFeatures, TransactionOptions, TransportReleaseStatus, TronAddress, TronGetAddressParams, TronSignMessageParams, TronSignTransactionParams, TronTransaction, TronTransactionContract, TronTransferContract, TronTriggerSmartContract, UI_EVENT, UI_REQUEST, UI_RESPONSE, UiEvent, UiEventMessage, UiPromise, UiPromiseResponse, UiRequestButton, UiRequestDeviceAction, UiRequestPassphrase, UiRequestPassphraseOnDevice, UiRequestWithoutPayload, UiResponseEvent, UiResponseMessage, UiResponsePassphrase, UiResponsePin, UnavailableCapabilities, UnavailableCapability, Unsuccessful, VersionArray, checkNeedUpdateBoot, corsValidator, createDeviceMessage, createErrorMessage, createFirmwareMessage, createIFrameMessage, createLogMessage, createResponseMessage, createUiMessage, createUiResponse, HardwareSdk as default, enableLog, getDeviceLabel, getDeviceType, getDeviceTypeByBleName, getDeviceTypeByDeviceId, getDeviceUUID, getEnv, getFirmwareUpdateField, getHDPath, getHomeScreenHex, getLog, getLogger, getOutputScriptType, getSDKVersion, getScriptType, getTimeStamp, httpRequest, init as initCore, isValidVersionArray, isValidVersionString, normalizeVersionArray, parseConnectSettings, parseMessage, patchFeatures, safeThrowError, setLoggerPostMessage, supportInputPinOnSoftware, versionCompare, versionSplit, wait };
2204
+ export { AccountAddress, AccountAddresses, AlgoAddress, AlgoGetAddressParams, AlgoSignTransactionParams, AlgoSignedTx, AptosAddress, AptosGetAddressParams, AptosGetPublicKeyParams, AptosMessageSignature, AptosPublicKey, AptosSignMessageParams, AptosSignTransactionParams, AptosSignedTx, AssetsMap, BTCAddress, BTCGetAddressParams, BTCGetPublicKeyParams, BTCPublicKey, BTCSignMessageParams, BTCSignTransactionParams, BTCVerifyMessageParams, BleReleaseInfoEvent, BleReleaseInfoPayload, CORE_EVENT, CallMethod, CallMethodAnyResponse, CallMethodKeys, CallMethodPayload, CallMethodResponse, CallMethodUnion, CardanoAddress, CardanoGetAddressMethodParams, CardanoGetAddressParams, CardanoSignTransaction, CardanoSignedTxData, CipheredKeyValue, CipheredKeyValueParams, CommonParams, ConfluxAddress, ConfluxGetAddressParams, ConfluxSignMessageCIP23Params, ConfluxSignMessageParams, ConfluxSignTransactionParams, ConfluxSignedTx, ConfluxTransaction, ConnectSettings, Core, CoreApi, CoreMessage, CosmosAddress, CosmosGetAddressParams, CosmosGetPublicKeyParams, CosmosPublicKey, CosmosSignTransactionParams, CosmosSignedTx, DEFAULT_PRIORITY, DEVICE, DEVICE_EVENT, DataManager, Device$1 as Device, DeviceButtonRequest, DeviceButtonRequestPayload, DeviceChangePinParams, DeviceConnnectRequest, DeviceDisconnnectRequest, DeviceEvent, DeviceEventListenerFn, DeviceEventMessage, DeviceFeaturesPayload, DeviceFirmwareRange, DeviceFlagsParams, DeviceMode, DeviceRecoveryParams, DeviceResetParams, DeviceSendFeatures, DeviceSendSupportFeatures, DeviceSettingsParams, DeviceStatus, DeviceSupportFeatures, DeviceSupportFeaturesPayload, DeviceTypeMap, DeviceUploadResourceParams, DeviceVerifyParams, DeviceVerifySignature, EVMAccessList, EVMAddress, EVMGetAddressParams, EVMGetPublicKeyParams, EVMPublicKey, EVMSignMessageEIP712Params, EVMSignMessageParams, EVMSignTransactionParams, EVMSignTypedDataParams, EVMSignedTx, EVMTransaction, EVMTransactionEIP1559, EVMVerifyMessageParams, EthereumSignTypedDataMessage, EthereumSignTypedDataTypeProperty, EthereumSignTypedDataTypes, FIRMWARE, FIRMWARE_EVENT, Features, FilecoinAddress, FilecoinGetAddressParams, FilecoinSignTransactionParams, FilecoinSignedTx, FirmwareEvent, FirmwareMessage, FirmwareProgress, FirmwareRange, FirmwareRelease$1 as FirmwareRelease, FirmwareTip, FirmwareUpdateBinaryParams, FirmwareUpdateParams, HardwareSDKLowLevel, HardwareTopLevelSdk, IBLEFirmwareReleaseInfo, IDeviceBLEFirmwareStatus, IDeviceFirmwareStatus, IDeviceModel, IDeviceType, IFRAME, IFirmwareReleaseInfo, IFrameBridge, IFrameCallMessage, IFrameCancelMessage, IFrameEvent, IFrameEventMessage, IFrameInit, ILocale, ITransportStatus, IVersionArray, KnownDevice, LOG, LOG_EVENT, LogEvent, LogEventMessage, LogOutput, LoggerNames, LowLevelCoreApi, LowLevelInjectApi, MajorVersion, MethodResponseMessage, NEMAddress, NEMAggregateModificationTransaction, NEMGetAddressParams, NEMImportanceTransaction, NEMMosaic, NEMMosaicCreationTransaction, NEMMultisigTransaction, NEMProvisionNamespaceTransaction, NEMSignTransactionParams, NEMSupplyChangeTransaction, NEMTransaction, NEMTransferTransaction, NearAddress, NearGetAddressParams, NearSignTransactionParams, Params, PolkadotAddress, PolkadotGetAddressParams, PolkadotSignTransactionParams, PolkadotSignedTx, PostMessageEvent, PreviousAddressResult, RESPONSE_EVENT, RefTransaction, ReleaseInfo, ReleaseInfoEvent, ReleaseInfoPayload, RemoteConfigResponse, Response, SearchDevice, SignedTransaction, SolanaAddress, SolanaGetAddressParams, SolanaSignTransactionParams, SolanaSignedTx, StarcoinAddress, StarcoinGetAddressParams, StarcoinGetPublicKeyParams, StarcoinPublicKey, StarcoinSignMessageParams, StarcoinSignTransactionParams, StarcoinVerifyMessageParams, StellarAddress, StellarAsset, StellarGetAddressParams, StellarOperation, StellarSignTransactionParams, StellarTransaction, StrictFeatures, Success, SuiAddress, SuiGetAddressParams, SuiGetPublicKeyParams, SuiPublicKey, SuiSignTransactionParams, SuiSignedTx, SupportFeatureType, SupportFeatures, TopLevelInjectApi, TransactionOptions, TransportReleaseStatus, TronAddress, TronGetAddressParams, TronSignMessageParams, TronSignTransactionParams, TronTransaction, TronTransactionContract, TronTransferContract, TronTriggerSmartContract, UI_EVENT, UI_REQUEST, UI_RESPONSE, UiEvent, UiEventMessage, UiPromise, UiPromiseResponse, UiRequestButton, UiRequestDeviceAction, UiRequestPassphrase, UiRequestPassphraseOnDevice, UiRequestWithoutPayload, UiResponseEvent, UiResponseMessage, UiResponsePassphrase, UiResponsePin, UnavailableCapabilities, UnavailableCapability, Unsuccessful, VersionArray, checkNeedUpdateBoot, corsValidator, createDeviceMessage, createErrorMessage, createFirmwareMessage, createIFrameMessage, createLogMessage, createResponseMessage, createUiMessage, createUiResponse, HardwareSdk as default, enableLog, getDeviceLabel, getDeviceType, getDeviceTypeByBleName, getDeviceTypeByDeviceId, getDeviceUUID, getEnv, getFirmwareUpdateField, getHDPath, getHomeScreenHex, getLog, getLogger, getOutputScriptType, getSDKVersion, getScriptType, getTimeStamp, httpRequest, init as initCore, isValidVersionArray, isValidVersionString, normalizeVersionArray, parseConnectSettings, parseMessage, patchFeatures, safeThrowError, setLoggerPostMessage, supportInputPinOnSoftware, versionCompare, versionSplit, wait };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,SAAS,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAE3D,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AAExB,QAAA,MAAM,WAAW,+DAOd,SAAS,KAAG,OAQX,CAAC;AAEL,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,SAAS,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAkB,iBAAiB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEtF,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC3E,YAAY,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAE3D,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AAExB,QAAA,MAAM,WAAW,+DAOd,SAAS,KAAG,OAQX,CAAC;AAEL,QAAA,MAAM,mBAAmB,+FAQtB,iBAAiB,KAAG,eASnB,CAAC;AAEL,QAAA,MAAM,mBAAmB,QAAO,OAA2B,CAAC;AAE5D,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,CAAC;AAEpD,eAAe,WAAW,CAAC"}
package/dist/index.js CHANGED
@@ -25,163 +25,114 @@ var BigNumber__default = /*#__PURE__*/_interopDefaultLegacy(BigNumber);
25
25
  var JSZip__default = /*#__PURE__*/_interopDefaultLegacy(JSZip);
26
26
 
27
27
  const inject = ({ call, cancel, dispose, eventEmitter, init, uiResponse, }) => {
28
- const api = {
29
- on: (type, fn) => {
28
+ const api = Object.assign({ on: (type, fn) => {
30
29
  eventEmitter.on(type, fn);
31
- },
32
- off: (type, fn) => {
30
+ }, emit: () => { }, off: (type, fn) => {
33
31
  eventEmitter.removeListener(type, fn);
34
- },
35
- removeAllListeners: type => {
32
+ }, removeAllListeners: type => {
36
33
  eventEmitter.removeAllListeners(type);
37
- },
38
- init,
34
+ }, init,
39
35
  call,
40
36
  dispose,
41
37
  uiResponse,
42
- cancel,
43
- getLogs: () => call({ method: 'getLogs' }),
44
- searchDevices: () => call({ method: 'searchDevices' }),
45
- getFeatures: connectId => call({ connectId, method: 'getFeatures' }),
46
- checkFirmwareRelease: connectId => call({ connectId, method: 'checkFirmwareRelease' }),
47
- checkBLEFirmwareRelease: connectId => call({ connectId, method: 'checkBLEFirmwareRelease' }),
48
- checkTransportRelease: () => call({ method: 'checkTransportRelease' }),
49
- checkBridgeStatus: () => call({ method: 'checkBridgeStatus' }),
50
- checkBootloaderRelease: connectId => call({ connectId, method: 'checkBootloaderRelease' }),
51
- cipherKeyValue: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'cipherKeyValue' })),
52
- deviceBackup: connectId => call({ connectId, method: 'deviceBackup' }),
53
- deviceChangePin: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceChangePin' })),
54
- deviceFlags: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceFlags' })),
55
- deviceRebootToBoardloader: connectId => call({ connectId, method: 'deviceRebootToBoardloader' }),
56
- deviceRebootToBootloader: connectId => call({ connectId, method: 'deviceRebootToBootloader' }),
57
- deviceRecovery: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceRecovery' })),
58
- deviceReset: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceReset' })),
59
- deviceSettings: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceSettings' })),
60
- deviceUpdateReboot: connectId => call({ connectId, method: 'deviceUpdateReboot' }),
61
- deviceUploadResource: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceUploadResource' })),
62
- deviceSupportFeatures: connectId => call({ connectId, method: 'deviceSupportFeatures' }),
63
- deviceVerify: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceVerify' })),
64
- deviceWipe: connectId => call({ connectId, method: 'deviceWipe' }),
65
- deviceFullyUploadResource: connectId => call({ connectId, method: 'deviceFullyUploadResource' }),
66
- deviceUpdateBootloader: connectId => call({ connectId, method: 'deviceUpdateBootloader' }),
67
- getPassphraseState: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'getPassphraseState' })),
68
- evmGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'evmGetAddress' })),
69
- evmGetPublicKey: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'evmGetPublicKey' })),
70
- evmSignMessage: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'evmSignMessage' })),
71
- evmSignMessageEIP712: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'evmSignMessageEIP712' })),
72
- evmSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'evmSignTransaction' })),
73
- evmSignTypedData: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'evmSignTypedData' })),
74
- evmVerifyMessage: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'evmVerifyMessage' })),
75
- btcGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'btcGetAddress' })),
76
- btcGetPublicKey: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'btcGetPublicKey' })),
77
- btcSignMessage: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'btcSignMessage' })),
78
- btcSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'btcSignTransaction' })),
79
- btcVerifyMessage: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'btcVerifyMessage' })),
80
- starcoinGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'starcoinGetAddress' })),
81
- starcoinGetPublicKey: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'starcoinGetPublicKey' })),
82
- starcoinSignMessage: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'starcoinSignMessage' })),
83
- starcoinSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'starcoinSignTransaction' })),
84
- starcoinVerifyMessage: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'starcoinVerifyMessage' })),
85
- nemGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'nemGetAddress' })),
86
- nemSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'nemSignTransaction' })),
87
- solGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'solGetAddress' })),
88
- solSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'solSignTransaction' })),
89
- stellarGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'stellarGetAddress' })),
90
- stellarSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'stellarSignTransaction' })),
91
- firmwareUpdate: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'firmwareUpdate' })),
92
- firmwareUpdateV2: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'firmwareUpdateV2' })),
93
- requestWebUsbDevice: () => call({ method: 'requestWebUsbDevice' }),
94
- tronGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'tronGetAddress' })),
95
- tronSignMessage: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'tronSignMessage' })),
96
- tronSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'tronSignTransaction' })),
97
- confluxGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'confluxGetAddress' })),
98
- confluxSignMessage: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'confluxSignMessage' })),
99
- confluxSignMessageCIP23: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'confluxSignMessageCIP23' })),
100
- confluxSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'confluxSignTransaction' })),
101
- nearGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'nearGetAddress' })),
102
- nearSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'nearSignTransaction' })),
103
- aptosGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'aptosGetAddress' })),
104
- aptosGetPublicKey: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'aptosGetPublicKey' })),
105
- aptosSignMessage: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'aptosSignMessage' })),
106
- aptosSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'aptosSignTransaction' })),
107
- algoGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'algoGetAddress' })),
108
- algoSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'algoSignTransaction' })),
109
- cosmosGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'cosmosGetAddress' })),
110
- cosmosGetPublicKey: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'cosmosGetPublicKey' })),
111
- cosmosSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'cosmosSignTransaction' })),
112
- xrpGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'xrpGetAddress' })),
113
- xrpSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'xrpSignTransaction' })),
114
- suiGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'suiGetAddress' })),
115
- suiGetPublicKey: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'suiGetPublicKey' })),
116
- suiSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'suiSignTransaction' })),
117
- cardanoGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'cardanoGetAddress' })),
118
- cardanoGetPublicKey: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'cardanoGetPublicKey' })),
119
- cardanoSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'cardanoSignTransaction' })),
120
- cardanoSignMessage: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'cardanoSignMessage' })),
121
- filecoinGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'filecoinGetAddress' })),
122
- filecoinSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'filecoinSignTransaction' })),
123
- polkadotGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'polkadotGetAddress' })),
124
- polkadotSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'polkadotSignTransaction' })),
125
- };
38
+ cancel }, createCoreApi(call));
126
39
  return api;
127
40
  };
41
+ const createCoreApi = (call) => ({
42
+ getLogs: () => call({ method: 'getLogs' }),
43
+ searchDevices: () => call({ method: 'searchDevices' }),
44
+ getFeatures: connectId => call({ connectId, method: 'getFeatures' }),
45
+ checkFirmwareRelease: connectId => call({ connectId, method: 'checkFirmwareRelease' }),
46
+ checkBLEFirmwareRelease: connectId => call({ connectId, method: 'checkBLEFirmwareRelease' }),
47
+ checkTransportRelease: () => call({ method: 'checkTransportRelease' }),
48
+ checkBridgeStatus: () => call({ method: 'checkBridgeStatus' }),
49
+ checkBootloaderRelease: connectId => call({ connectId, method: 'checkBootloaderRelease' }),
50
+ cipherKeyValue: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'cipherKeyValue' })),
51
+ deviceBackup: connectId => call({ connectId, method: 'deviceBackup' }),
52
+ deviceChangePin: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceChangePin' })),
53
+ deviceFlags: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceFlags' })),
54
+ deviceRebootToBoardloader: connectId => call({ connectId, method: 'deviceRebootToBoardloader' }),
55
+ deviceRebootToBootloader: connectId => call({ connectId, method: 'deviceRebootToBootloader' }),
56
+ deviceRecovery: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceRecovery' })),
57
+ deviceReset: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceReset' })),
58
+ deviceSettings: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceSettings' })),
59
+ deviceUpdateReboot: connectId => call({ connectId, method: 'deviceUpdateReboot' }),
60
+ deviceUploadResource: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceUploadResource' })),
61
+ deviceSupportFeatures: connectId => call({ connectId, method: 'deviceSupportFeatures' }),
62
+ deviceVerify: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceVerify' })),
63
+ deviceWipe: connectId => call({ connectId, method: 'deviceWipe' }),
64
+ deviceFullyUploadResource: connectId => call({ connectId, method: 'deviceFullyUploadResource' }),
65
+ deviceUpdateBootloader: connectId => call({ connectId, method: 'deviceUpdateBootloader' }),
66
+ getPassphraseState: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'getPassphraseState' })),
67
+ evmGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'evmGetAddress' })),
68
+ evmGetPublicKey: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'evmGetPublicKey' })),
69
+ evmSignMessage: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'evmSignMessage' })),
70
+ evmSignMessageEIP712: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'evmSignMessageEIP712' })),
71
+ evmSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'evmSignTransaction' })),
72
+ evmSignTypedData: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'evmSignTypedData' })),
73
+ evmVerifyMessage: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'evmVerifyMessage' })),
74
+ btcGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'btcGetAddress' })),
75
+ btcGetPublicKey: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'btcGetPublicKey' })),
76
+ btcSignMessage: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'btcSignMessage' })),
77
+ btcSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'btcSignTransaction' })),
78
+ btcVerifyMessage: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'btcVerifyMessage' })),
79
+ starcoinGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'starcoinGetAddress' })),
80
+ starcoinGetPublicKey: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'starcoinGetPublicKey' })),
81
+ starcoinSignMessage: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'starcoinSignMessage' })),
82
+ starcoinSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'starcoinSignTransaction' })),
83
+ starcoinVerifyMessage: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'starcoinVerifyMessage' })),
84
+ nemGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'nemGetAddress' })),
85
+ nemSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'nemSignTransaction' })),
86
+ solGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'solGetAddress' })),
87
+ solSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'solSignTransaction' })),
88
+ stellarGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'stellarGetAddress' })),
89
+ stellarSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'stellarSignTransaction' })),
90
+ firmwareUpdate: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'firmwareUpdate' })),
91
+ firmwareUpdateV2: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'firmwareUpdateV2' })),
92
+ requestWebUsbDevice: () => call({ method: 'requestWebUsbDevice' }),
93
+ tronGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'tronGetAddress' })),
94
+ tronSignMessage: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'tronSignMessage' })),
95
+ tronSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'tronSignTransaction' })),
96
+ confluxGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'confluxGetAddress' })),
97
+ confluxSignMessage: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'confluxSignMessage' })),
98
+ confluxSignMessageCIP23: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'confluxSignMessageCIP23' })),
99
+ confluxSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'confluxSignTransaction' })),
100
+ nearGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'nearGetAddress' })),
101
+ nearSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'nearSignTransaction' })),
102
+ aptosGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'aptosGetAddress' })),
103
+ aptosGetPublicKey: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'aptosGetPublicKey' })),
104
+ aptosSignMessage: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'aptosSignMessage' })),
105
+ aptosSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'aptosSignTransaction' })),
106
+ algoGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'algoGetAddress' })),
107
+ algoSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'algoSignTransaction' })),
108
+ cosmosGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'cosmosGetAddress' })),
109
+ cosmosGetPublicKey: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'cosmosGetPublicKey' })),
110
+ cosmosSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'cosmosSignTransaction' })),
111
+ xrpGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'xrpGetAddress' })),
112
+ xrpSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'xrpSignTransaction' })),
113
+ suiGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'suiGetAddress' })),
114
+ suiGetPublicKey: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'suiGetPublicKey' })),
115
+ suiSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'suiSignTransaction' })),
116
+ cardanoGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'cardanoGetAddress' })),
117
+ cardanoGetPublicKey: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'cardanoGetPublicKey' })),
118
+ cardanoSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'cardanoSignTransaction' })),
119
+ cardanoSignMessage: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'cardanoSignMessage' })),
120
+ filecoinGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'filecoinGetAddress' })),
121
+ filecoinSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'filecoinSignTransaction' })),
122
+ polkadotGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'polkadotGetAddress' })),
123
+ polkadotSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'polkadotSignTransaction' })),
124
+ });
128
125
 
129
- /******************************************************************************
130
- Copyright (c) Microsoft Corporation.
131
-
132
- Permission to use, copy, modify, and/or distribute this software for any
133
- purpose with or without fee is hereby granted.
134
-
135
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
136
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
137
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
138
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
139
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
140
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
141
- PERFORMANCE OF THIS SOFTWARE.
142
- ***************************************************************************** */
143
-
144
- function __rest(s, e) {
145
- var t = {};
146
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
147
- t[p] = s[p];
148
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
149
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
150
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
151
- t[p[i]] = s[p[i]];
152
- }
153
- return t;
154
- }
155
-
156
- function __awaiter(thisArg, _arguments, P, generator) {
157
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
158
- return new (P || (P = Promise))(function (resolve, reject) {
159
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
160
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
161
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
162
- step((generator = generator.apply(thisArg, _arguments || [])).next());
163
- });
164
- }
165
-
166
- function __values(o) {
167
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
168
- if (m) return m.call(o);
169
- if (o && typeof o.length === "number") return {
170
- next: function () {
171
- if (o && i >= o.length) o = void 0;
172
- return { value: o && o[i++], done: !o };
173
- }
174
- };
175
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
176
- }
177
-
178
- function __asyncValues(o) {
179
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
180
- var m = o[Symbol.asyncIterator], i;
181
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
182
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
183
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
184
- }
126
+ const lowLevelInject = ({ call, cancel, dispose, eventEmitter, init, uiResponse, addHardwareGlobalEventListener, }) => {
127
+ const api = Object.assign({ addHardwareGlobalEventListener, removeAllListeners: type => {
128
+ eventEmitter.removeAllListeners(type);
129
+ }, init,
130
+ call,
131
+ dispose,
132
+ uiResponse,
133
+ cancel, emit: () => { } }, createCoreApi(call));
134
+ return api;
135
+ };
185
136
 
186
137
  var events = {exports: {}};
187
138
 
@@ -659,6 +610,87 @@ function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
659
610
  }
660
611
  }
661
612
 
613
+ const eventEmitter = new events.exports();
614
+ const topLevelInject = () => {
615
+ let lowLevelApi;
616
+ const call = (params) => {
617
+ if (!lowLevelApi)
618
+ return Promise.resolve(undefined);
619
+ return lowLevelApi.call(params);
620
+ };
621
+ const api = Object.assign(Object.assign({ on: (type, fn) => {
622
+ eventEmitter.on(type, fn);
623
+ }, emit: (eventName, ...args) => {
624
+ eventEmitter.emit(eventName, ...args);
625
+ }, off: (type, fn) => {
626
+ eventEmitter.emit(type, fn);
627
+ }, init: (settings, hardwareLowLeverApi) => {
628
+ var _a;
629
+ lowLevelApi = hardwareLowLeverApi;
630
+ return (_a = lowLevelApi === null || lowLevelApi === void 0 ? void 0 : lowLevelApi.init(settings)) !== null && _a !== void 0 ? _a : Promise.resolve(false);
631
+ }, call }, createCoreApi(call)), { removeAllListeners: type => {
632
+ eventEmitter.removeAllListeners(type);
633
+ }, dispose: () => lowLevelApi === null || lowLevelApi === void 0 ? void 0 : lowLevelApi.dispose, uiResponse: response => lowLevelApi === null || lowLevelApi === void 0 ? void 0 : lowLevelApi.uiResponse(response), cancel: (connectId) => lowLevelApi === null || lowLevelApi === void 0 ? void 0 : lowLevelApi.cancel(connectId) });
634
+ return api;
635
+ };
636
+
637
+ /******************************************************************************
638
+ Copyright (c) Microsoft Corporation.
639
+
640
+ Permission to use, copy, modify, and/or distribute this software for any
641
+ purpose with or without fee is hereby granted.
642
+
643
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
644
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
645
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
646
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
647
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
648
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
649
+ PERFORMANCE OF THIS SOFTWARE.
650
+ ***************************************************************************** */
651
+
652
+ function __rest(s, e) {
653
+ var t = {};
654
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
655
+ t[p] = s[p];
656
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
657
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
658
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
659
+ t[p[i]] = s[p[i]];
660
+ }
661
+ return t;
662
+ }
663
+
664
+ function __awaiter(thisArg, _arguments, P, generator) {
665
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
666
+ return new (P || (P = Promise))(function (resolve, reject) {
667
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
668
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
669
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
670
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
671
+ });
672
+ }
673
+
674
+ function __values(o) {
675
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
676
+ if (m) return m.call(o);
677
+ if (o && typeof o.length === "number") return {
678
+ next: function () {
679
+ if (o && i >= o.length) o = void 0;
680
+ return { value: o && o[i++], done: !o };
681
+ }
682
+ };
683
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
684
+ }
685
+
686
+ function __asyncValues(o) {
687
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
688
+ var m = o[Symbol.asyncIterator], i;
689
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
690
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
691
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
692
+ }
693
+
662
694
  const HD_HARDENED = 0x80000000;
663
695
  const toHardened = (n) => (n | HD_HARDENED) >>> 0;
664
696
  const fromHardened = (n) => (n & ~HD_HARDENED) >>> 0;
@@ -17395,7 +17427,7 @@ class CardanoGetAddress extends BaseMethod {
17395
17427
  getVersionRange() {
17396
17428
  return {
17397
17429
  model_mini: {
17398
- min: '2.11.0',
17430
+ min: '3.0.0',
17399
17431
  },
17400
17432
  model_touch: {
17401
17433
  min: '4.1.0',
@@ -17484,7 +17516,7 @@ class CardanoGetPublicKey extends BaseMethod {
17484
17516
  getVersionRange() {
17485
17517
  return {
17486
17518
  model_mini: {
17487
- min: '2.11.0',
17519
+ min: '3.0.0',
17488
17520
  },
17489
17521
  model_touch: {
17490
17522
  min: '4.1.0',
@@ -17901,7 +17933,7 @@ class CardanoSignTransaction extends BaseMethod {
17901
17933
  getVersionRange() {
17902
17934
  return {
17903
17935
  model_mini: {
17904
- min: '2.11.0',
17936
+ min: '3.0.0',
17905
17937
  },
17906
17938
  model_touch: {
17907
17939
  min: '4.1.0',
@@ -18154,7 +18186,7 @@ class CardanoSignMessage extends BaseMethod {
18154
18186
  getVersionRange() {
18155
18187
  return {
18156
18188
  model_mini: {
18157
- min: '2.11.0',
18189
+ min: '3.0.0',
18158
18190
  },
18159
18191
  model_touch: {
18160
18192
  min: '4.1.0',
@@ -19139,6 +19171,16 @@ const HardwareSdk = ({ init, call, dispose, eventEmitter, uiResponse, cancel, })
19139
19171
  uiResponse,
19140
19172
  cancel,
19141
19173
  });
19174
+ const HardwareSDKLowLevel = ({ init, call, dispose, eventEmitter, addHardwareGlobalEventListener, uiResponse, cancel, }) => lowLevelInject({
19175
+ init,
19176
+ call,
19177
+ dispose,
19178
+ eventEmitter,
19179
+ addHardwareGlobalEventListener,
19180
+ uiResponse,
19181
+ cancel,
19182
+ });
19183
+ const HardwareTopLevelSdk = () => topLevelInject();
19142
19184
 
19143
19185
  Object.defineProperty(exports, 'PROTO', {
19144
19186
  enumerable: true,
@@ -19152,6 +19194,8 @@ exports.DEVICE_EVENT = DEVICE_EVENT;
19152
19194
  exports.DataManager = DataManager;
19153
19195
  exports.FIRMWARE = FIRMWARE;
19154
19196
  exports.FIRMWARE_EVENT = FIRMWARE_EVENT;
19197
+ exports.HardwareSDKLowLevel = HardwareSDKLowLevel;
19198
+ exports.HardwareTopLevelSdk = HardwareTopLevelSdk;
19155
19199
  exports.IFRAME = IFRAME;
19156
19200
  exports.LOG = LOG;
19157
19201
  exports.LOG_EVENT = LOG_EVENT;
package/dist/inject.d.ts CHANGED
@@ -11,4 +11,5 @@ export interface InjectApi {
11
11
  cancel: CoreApi['cancel'];
12
12
  }
13
13
  export declare const inject: ({ call, cancel, dispose, eventEmitter, init, uiResponse, }: InjectApi) => CoreApi;
14
+ export declare const createCoreApi: (call: CoreApi['call']) => Omit<CoreApi, 'on' | 'off' | 'emit' | 'removeAllListeners' | 'init' | 'call' | 'dispose' | 'uiResponse' | 'cancel'>;
14
15
  //# sourceMappingURL=inject.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"inject.d.ts","sourceRoot":"","sources":["../src/inject.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,UAAU,CAAC;IACjB,YAAY,EAAE,YAAY,CAAC;IAC3B,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC5B,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAClC,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC3B;AAED,eAAO,MAAM,MAAM,+DAOhB,SAAS,KAAG,OAqNd,CAAC"}
1
+ {"version":3,"file":"inject.d.ts","sourceRoot":"","sources":["../src/inject.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,UAAU,CAAC;IACjB,YAAY,EAAE,YAAY,CAAC;IAC3B,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC5B,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAClC,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC3B;AAED,eAAO,MAAM,MAAM,+DAOhB,SAAS,KAAG,OA6Bd,CAAC;AAEF,eAAO,MAAM,aAAa,SAClB,OAAO,CAAC,MAAM,CAAC,KACpB,KACD,OAAO,EACL,IAAI,GACJ,KAAK,GACL,MAAM,GACN,oBAAoB,GACpB,MAAM,GACN,MAAM,GACN,SAAS,GACT,YAAY,GACZ,QAAQ,CA0LV,CAAC"}
@@ -0,0 +1,20 @@
1
+ /// <reference types="node" />
2
+ import { EventEmitter } from 'events';
3
+ import { CallMethod, CoreMessage } from './events';
4
+ import { CoreApi } from './types/api';
5
+ declare type IAddHardwareGlobalEventListener = (coreMessage: CoreMessage) => void;
6
+ export interface LowLevelInjectApi {
7
+ call: CallMethod;
8
+ eventEmitter: EventEmitter;
9
+ init: CoreApi['init'];
10
+ dispose: CoreApi['dispose'];
11
+ uiResponse: CoreApi['uiResponse'];
12
+ cancel: CoreApi['cancel'];
13
+ addHardwareGlobalEventListener: (listener: IAddHardwareGlobalEventListener) => void;
14
+ }
15
+ export declare type LowLevelCoreApi = Omit<CoreApi, 'on' | 'off'> & {
16
+ addHardwareGlobalEventListener: (listener: IAddHardwareGlobalEventListener) => void;
17
+ };
18
+ export declare const lowLevelInject: ({ call, cancel, dispose, eventEmitter, init, uiResponse, addHardwareGlobalEventListener, }: LowLevelInjectApi) => LowLevelCoreApi;
19
+ export {};
20
+ //# sourceMappingURL=lowLevelInject.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lowLevelInject.d.ts","sourceRoot":"","sources":["../src/lowLevelInject.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtC,aAAK,+BAA+B,GAAG,CAAC,WAAW,EAAE,WAAW,KAAK,IAAI,CAAC;AAE1E,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,UAAU,CAAC;IACjB,YAAY,EAAE,YAAY,CAAC;IAC3B,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC5B,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAClC,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC1B,8BAA8B,EAAE,CAAC,QAAQ,EAAE,+BAA+B,KAAK,IAAI,CAAC;CACrF;AAED,oBAAY,eAAe,GAAG,IAAI,CAAC,OAAO,EAAE,IAAI,GAAG,KAAK,CAAC,GAAG;IAC1D,8BAA8B,EAAE,CAAC,QAAQ,EAAE,+BAA+B,KAAK,IAAI,CAAC;CACrF,CAAC;AAEF,eAAO,MAAM,cAAc,+FAQxB,iBAAiB,KAAG,eAsBtB,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { CoreApi } from './types/api';
2
+ export interface TopLevelInjectApi {
3
+ init: CoreApi['init'];
4
+ call: CoreApi['call'];
5
+ }
6
+ export declare const topLevelInject: () => CoreApi;
7
+ //# sourceMappingURL=topLevelInject.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"topLevelInject.d.ts","sourceRoot":"","sources":["../src/topLevelInject.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAItC,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACtB,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;CACvB;AAID,eAAO,MAAM,cAAc,eAwC1B,CAAC"}
@@ -87,6 +87,7 @@ export declare type CoreApi = {
87
87
  init: typeof init;
88
88
  on: typeof on;
89
89
  off: typeof off;
90
+ emit: (event: string, ...args: any[]) => void;
90
91
  removeAllListeners: typeof removeAllListeners;
91
92
  dispose: () => void;
92
93
  call: (params: any) => Promise<any>;