@onekeyfe/hd-core 0.0.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.
- package/.eslintrc +6 -0
- package/README.md +3 -0
- package/dist/api/BTCGetAddress.d.ts +8 -0
- package/dist/api/BTCGetAddress.d.ts.map +1 -0
- package/dist/api/BTCGetPublicKey.d.ts +8 -0
- package/dist/api/BTCGetPublicKey.d.ts.map +1 -0
- package/dist/api/BTCSignMessage.d.ts +10 -0
- package/dist/api/BTCSignMessage.d.ts.map +1 -0
- package/dist/api/BTCSignTransaction.d.ts +17 -0
- package/dist/api/BTCSignTransaction.d.ts.map +1 -0
- package/dist/api/BTCVerifyMessage.d.ts +9 -0
- package/dist/api/BTCVerifyMessage.d.ts.map +1 -0
- package/dist/api/BaseMethod.d.ts +24 -0
- package/dist/api/BaseMethod.d.ts.map +1 -0
- package/dist/api/CheckBLEFirmwareRelease.d.ts +6 -0
- package/dist/api/CheckBLEFirmwareRelease.d.ts.map +1 -0
- package/dist/api/CheckFirmwareRelease.d.ts +6 -0
- package/dist/api/CheckFirmwareRelease.d.ts.map +1 -0
- package/dist/api/CheckTransportRelease.d.ts +6 -0
- package/dist/api/CheckTransportRelease.d.ts.map +1 -0
- package/dist/api/DeviceBackup.d.ts +9 -0
- package/dist/api/DeviceBackup.d.ts.map +1 -0
- package/dist/api/DeviceChangePin.d.ts +9 -0
- package/dist/api/DeviceChangePin.d.ts.map +1 -0
- package/dist/api/DeviceFlags.d.ts +9 -0
- package/dist/api/DeviceFlags.d.ts.map +1 -0
- package/dist/api/DeviceRebootToBootloader.d.ts +9 -0
- package/dist/api/DeviceRebootToBootloader.d.ts.map +1 -0
- package/dist/api/DeviceRecovery.d.ts +9 -0
- package/dist/api/DeviceRecovery.d.ts.map +1 -0
- package/dist/api/DeviceReset.d.ts +9 -0
- package/dist/api/DeviceReset.d.ts.map +1 -0
- package/dist/api/DeviceSettings.d.ts +9 -0
- package/dist/api/DeviceSettings.d.ts.map +1 -0
- package/dist/api/DeviceUpdateReboot.d.ts +9 -0
- package/dist/api/DeviceUpdateReboot.d.ts.map +1 -0
- package/dist/api/DeviceWipe.d.ts +9 -0
- package/dist/api/DeviceWipe.d.ts.map +1 -0
- package/dist/api/EVMGetAddress.d.ts +8 -0
- package/dist/api/EVMGetAddress.d.ts.map +1 -0
- package/dist/api/EVMGetPublicKey.d.ts +8 -0
- package/dist/api/EVMGetPublicKey.d.ts.map +1 -0
- package/dist/api/EVMSignMessage.d.ts +10 -0
- package/dist/api/EVMSignMessage.d.ts.map +1 -0
- package/dist/api/EVMSignMessageEIP712.d.ts +10 -0
- package/dist/api/EVMSignMessageEIP712.d.ts.map +1 -0
- package/dist/api/EVMSignTransaction.d.ts +20 -0
- package/dist/api/EVMSignTransaction.d.ts.map +1 -0
- package/dist/api/EVMSignTypedData.d.ts +18 -0
- package/dist/api/EVMSignTypedData.d.ts.map +1 -0
- package/dist/api/EVMVerifyMessage.d.ts +9 -0
- package/dist/api/EVMVerifyMessage.d.ts.map +1 -0
- package/dist/api/GetFeatures.d.ts +51 -0
- package/dist/api/GetFeatures.d.ts.map +1 -0
- package/dist/api/SearchDevices.d.ts +16 -0
- package/dist/api/SearchDevices.d.ts.map +1 -0
- package/dist/api/helpers/bigNumberUtils.d.ts +4 -0
- package/dist/api/helpers/bigNumberUtils.d.ts.map +1 -0
- package/dist/api/helpers/btc/signtx.d.ts +5 -0
- package/dist/api/helpers/btc/signtx.d.ts.map +1 -0
- package/dist/api/helpers/btc/signtxLegacy.d.ts +5 -0
- package/dist/api/helpers/btc/signtxLegacy.d.ts.map +1 -0
- package/dist/api/helpers/btcParamsUtils.d.ts +11 -0
- package/dist/api/helpers/btcParamsUtils.d.ts.map +1 -0
- package/dist/api/helpers/hexUtils.d.ts +7 -0
- package/dist/api/helpers/hexUtils.d.ts.map +1 -0
- package/dist/api/helpers/paramsValidator.d.ts +8 -0
- package/dist/api/helpers/paramsValidator.d.ts.map +1 -0
- package/dist/api/helpers/pathUtils.d.ts +12 -0
- package/dist/api/helpers/pathUtils.d.ts.map +1 -0
- package/dist/api/helpers/stringUtils.d.ts +2 -0
- package/dist/api/helpers/stringUtils.d.ts.map +1 -0
- package/dist/api/helpers/typeNameUtils.d.ts +9 -0
- package/dist/api/helpers/typeNameUtils.d.ts.map +1 -0
- package/dist/api/index.d.ts +27 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/utils.d.ts +5 -0
- package/dist/api/utils.d.ts.map +1 -0
- package/dist/constants/errors.d.ts +25 -0
- package/dist/constants/errors.d.ts.map +1 -0
- package/dist/constants/index.d.ts +3 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/ui-request.d.ts +13 -0
- package/dist/constants/ui-request.d.ts.map +1 -0
- package/dist/core/index.d.ts +14 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/data/version.d.ts +3 -0
- package/dist/data/version.d.ts.map +1 -0
- package/dist/data-manager/CoinManager.d.ts +13 -0
- package/dist/data-manager/CoinManager.d.ts.map +1 -0
- package/dist/data-manager/DataManager.d.ts +17 -0
- package/dist/data-manager/DataManager.d.ts.map +1 -0
- package/dist/data-manager/TransportManager.d.ts +15 -0
- package/dist/data-manager/TransportManager.d.ts.map +1 -0
- package/dist/data-manager/connectSettings.d.ts +9 -0
- package/dist/data-manager/connectSettings.d.ts.map +1 -0
- package/dist/data-manager/index.d.ts +3 -0
- package/dist/data-manager/index.d.ts.map +1 -0
- package/dist/device/Device.d.ts +64 -0
- package/dist/device/Device.d.ts.map +1 -0
- package/dist/device/DeviceCommands.d.ts +35 -0
- package/dist/device/DeviceCommands.d.ts.map +1 -0
- package/dist/device/DeviceConnector.d.ts +28 -0
- package/dist/device/DeviceConnector.d.ts.map +1 -0
- package/dist/device/DeviceList.d.ts +12 -0
- package/dist/device/DeviceList.d.ts.map +1 -0
- package/dist/events/call.d.ts +41 -0
- package/dist/events/call.d.ts.map +1 -0
- package/dist/events/core.d.ts +16 -0
- package/dist/events/core.d.ts.map +1 -0
- package/dist/events/device.d.ts +23 -0
- package/dist/events/device.d.ts.map +1 -0
- package/dist/events/iframe.d.ts +24 -0
- package/dist/events/iframe.d.ts.map +1 -0
- package/dist/events/index.d.ts +8 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/ui-promise.d.ts +12 -0
- package/dist/events/ui-promise.d.ts.map +1 -0
- package/dist/events/ui-request.d.ts +20 -0
- package/dist/events/ui-request.d.ts.map +1 -0
- package/dist/events/ui-response.d.ts +15 -0
- package/dist/events/ui-response.d.ts.map +1 -0
- package/dist/events/utils.d.ts +15 -0
- package/dist/events/utils.d.ts.map +1 -0
- package/dist/index.d.ts +823 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12396 -0
- package/dist/inject.d.ts +14 -0
- package/dist/inject.d.ts.map +1 -0
- package/dist/types/api/btcGetAddress.d.ts +14 -0
- package/dist/types/api/btcGetAddress.d.ts.map +1 -0
- package/dist/types/api/btcGetPublicKey.d.ts +13 -0
- package/dist/types/api/btcGetPublicKey.d.ts.map +1 -0
- package/dist/types/api/btcSignMessage.d.ts +9 -0
- package/dist/types/api/btcSignMessage.d.ts.map +1 -0
- package/dist/types/api/btcSignTransaction.d.ts +74 -0
- package/dist/types/api/btcSignTransaction.d.ts.map +1 -0
- package/dist/types/api/btcVerifyMessage.d.ts +10 -0
- package/dist/types/api/btcVerifyMessage.d.ts.map +1 -0
- package/dist/types/api/checkBLEFirmwareRelease.d.ts +4 -0
- package/dist/types/api/checkBLEFirmwareRelease.d.ts.map +1 -0
- package/dist/types/api/checkFirmwareRelease.d.ts +4 -0
- package/dist/types/api/checkFirmwareRelease.d.ts.map +1 -0
- package/dist/types/api/checkTransportRelease.d.ts +4 -0
- package/dist/types/api/checkTransportRelease.d.ts.map +1 -0
- package/dist/types/api/deviceBackup.d.ts +4 -0
- package/dist/types/api/deviceBackup.d.ts.map +1 -0
- package/dist/types/api/deviceChangePin.d.ts +7 -0
- package/dist/types/api/deviceChangePin.d.ts.map +1 -0
- package/dist/types/api/deviceFlags.d.ts +7 -0
- package/dist/types/api/deviceFlags.d.ts.map +1 -0
- package/dist/types/api/deviceRebootToBootloader.d.ts +4 -0
- package/dist/types/api/deviceRebootToBootloader.d.ts.map +1 -0
- package/dist/types/api/deviceRecovery.d.ts +15 -0
- package/dist/types/api/deviceRecovery.d.ts.map +1 -0
- package/dist/types/api/deviceReset.d.ts +16 -0
- package/dist/types/api/deviceReset.d.ts.map +1 -0
- package/dist/types/api/deviceSettings.d.ts +16 -0
- package/dist/types/api/deviceSettings.d.ts.map +1 -0
- package/dist/types/api/deviceUpdateReboot.d.ts +4 -0
- package/dist/types/api/deviceUpdateReboot.d.ts.map +1 -0
- package/dist/types/api/deviceWipe.d.ts +4 -0
- package/dist/types/api/deviceWipe.d.ts.map +1 -0
- package/dist/types/api/event.d.ts +4 -0
- package/dist/types/api/event.d.ts.map +1 -0
- package/dist/types/api/evmGetAddress.d.ts +11 -0
- package/dist/types/api/evmGetAddress.d.ts.map +1 -0
- package/dist/types/api/evmGetPublicKey.d.ts +11 -0
- package/dist/types/api/evmGetPublicKey.d.ts.map +1 -0
- package/dist/types/api/evmSignMessage.d.ts +8 -0
- package/dist/types/api/evmSignMessage.d.ts.map +1 -0
- package/dist/types/api/evmSignMessageEIP712.d.ts +9 -0
- package/dist/types/api/evmSignMessageEIP712.d.ts.map +1 -0
- package/dist/types/api/evmSignTransaction.d.ts +36 -0
- package/dist/types/api/evmSignTransaction.d.ts.map +1 -0
- package/dist/types/api/evmSignTypedData.d.ts +33 -0
- package/dist/types/api/evmSignTypedData.d.ts.map +1 -0
- package/dist/types/api/evmVerifyMessage.d.ts +9 -0
- package/dist/types/api/evmVerifyMessage.d.ts.map +1 -0
- package/dist/types/api/getFeatures.d.ts +4 -0
- package/dist/types/api/getFeatures.d.ts.map +1 -0
- package/dist/types/api/index.d.ts +66 -0
- package/dist/types/api/index.d.ts.map +1 -0
- package/dist/types/api/init.d.ts +3 -0
- package/dist/types/api/init.d.ts.map +1 -0
- package/dist/types/api/searchDevices.d.ts +4 -0
- package/dist/types/api/searchDevices.d.ts.map +1 -0
- package/dist/types/api/uiResponse.d.ts +3 -0
- package/dist/types/api/uiResponse.d.ts.map +1 -0
- package/dist/types/device.d.ts +29 -0
- package/dist/types/device.d.ts.map +1 -0
- package/dist/types/firmware.d.ts +37 -0
- package/dist/types/firmware.d.ts.map +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/params.d.ts +16 -0
- package/dist/types/params.d.ts.map +1 -0
- package/dist/types/settings.d.ts +65 -0
- package/dist/types/settings.d.ts.map +1 -0
- package/dist/utils/assets.d.ts +3 -0
- package/dist/utils/assets.d.ts.map +1 -0
- package/dist/utils/deferred.d.ts +9 -0
- package/dist/utils/deferred.d.ts.map +1 -0
- package/dist/utils/deviceFeaturesUtils.d.ts +52 -0
- package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -0
- package/dist/utils/findDefectiveBatchDevice.d.ts +3 -0
- package/dist/utils/findDefectiveBatchDevice.d.ts.map +1 -0
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/logger.d.ts +24 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/networkUtils.d.ts +2 -0
- package/dist/utils/networkUtils.d.ts.map +1 -0
- package/dist/utils/promiseUtils.d.ts +2 -0
- package/dist/utils/promiseUtils.d.ts.map +1 -0
- package/dist/utils/versionUtils.d.ts +6 -0
- package/dist/utils/versionUtils.d.ts.map +1 -0
- package/package.json +39 -0
- package/src/api/BTCGetAddress.ts +71 -0
- package/src/api/BTCGetPublicKey.ts +70 -0
- package/src/api/BTCSignMessage.ts +40 -0
- package/src/api/BTCSignTransaction.ts +141 -0
- package/src/api/BTCVerifyMessage.ts +40 -0
- package/src/api/BaseMethod.ts +71 -0
- package/src/api/CheckBLEFirmwareRelease.ts +18 -0
- package/src/api/CheckFirmwareRelease.ts +15 -0
- package/src/api/CheckTransportRelease.ts +19 -0
- package/src/api/DeviceBackup.ts +12 -0
- package/src/api/DeviceChangePin.ts +22 -0
- package/src/api/DeviceFlags.ts +23 -0
- package/src/api/DeviceRebootToBootloader.ts +13 -0
- package/src/api/DeviceRecovery.ts +41 -0
- package/src/api/DeviceReset.ts +43 -0
- package/src/api/DeviceSettings.ts +45 -0
- package/src/api/DeviceUpdateReboot.ts +13 -0
- package/src/api/DeviceWipe.ts +12 -0
- package/src/api/EVMGetAddress.ts +54 -0
- package/src/api/EVMGetPublicKey.ts +58 -0
- package/src/api/EVMSignMessage.ts +40 -0
- package/src/api/EVMSignMessageEIP712.ts +40 -0
- package/src/api/EVMSignTransaction.ts +195 -0
- package/src/api/EVMSignTypedData.ts +212 -0
- package/src/api/EVMVerifyMessage.ts +33 -0
- package/src/api/GetFeatures.ts +12 -0
- package/src/api/SearchDevices.ts +40 -0
- package/src/api/helpers/bigNumberUtils.ts +58 -0
- package/src/api/helpers/btc/signtx.ts +232 -0
- package/src/api/helpers/btc/signtxLegacy.ts +205 -0
- package/src/api/helpers/btcParamsUtils.ts +57 -0
- package/src/api/helpers/hexUtils.ts +50 -0
- package/src/api/helpers/paramsValidator.ts +95 -0
- package/src/api/helpers/pathUtils.ts +111 -0
- package/src/api/helpers/stringUtils.ts +8 -0
- package/src/api/helpers/typeNameUtils.ts +132 -0
- package/src/api/index.ts +26 -0
- package/src/api/utils.ts +18 -0
- package/src/constants/errors.ts +47 -0
- package/src/constants/index.ts +2 -0
- package/src/constants/ui-request.ts +12 -0
- package/src/core/index.ts +305 -0
- package/src/data/coins/bitcoin.json +42 -0
- package/src/data/messages/messages.json +8658 -0
- package/src/data/version.ts +3 -0
- package/src/data-manager/CoinManager.ts +31 -0
- package/src/data-manager/DataManager.ts +148 -0
- package/src/data-manager/TransportManager.ts +87 -0
- package/src/data-manager/connectSettings.ts +109 -0
- package/src/data-manager/index.ts +2 -0
- package/src/device/Device.ts +411 -0
- package/src/device/DeviceCommands.ts +207 -0
- package/src/device/DeviceConnector.ts +173 -0
- package/src/device/DeviceList.ts +47 -0
- package/src/events/call.ts +72 -0
- package/src/events/core.ts +41 -0
- package/src/events/device.ts +28 -0
- package/src/events/iframe.ts +34 -0
- package/src/events/index.ts +7 -0
- package/src/events/ui-promise.ts +14 -0
- package/src/events/ui-request.ts +28 -0
- package/src/events/ui-response.ts +25 -0
- package/src/events/utils.ts +19 -0
- package/src/index.ts +29 -0
- package/src/inject.ts +103 -0
- package/src/types/api/btcGetAddress.ts +24 -0
- package/src/types/api/btcGetPublicKey.ts +19 -0
- package/src/types/api/btcSignMessage.ts +13 -0
- package/src/types/api/btcSignTransaction.ts +98 -0
- package/src/types/api/btcVerifyMessage.ts +14 -0
- package/src/types/api/checkBLEFirmwareRelease.ts +6 -0
- package/src/types/api/checkFirmwareRelease.ts +4 -0
- package/src/types/api/checkTransportRelease.ts +4 -0
- package/src/types/api/deviceBackup.ts +4 -0
- package/src/types/api/deviceChangePin.ts +11 -0
- package/src/types/api/deviceFlags.ts +11 -0
- package/src/types/api/deviceRebootToBootloader.ts +4 -0
- package/src/types/api/deviceRecovery.ts +19 -0
- package/src/types/api/deviceReset.ts +20 -0
- package/src/types/api/deviceSettings.ts +17 -0
- package/src/types/api/deviceUpdateReboot.ts +4 -0
- package/src/types/api/deviceWipe.ts +4 -0
- package/src/types/api/event.ts +8 -0
- package/src/types/api/evmGetAddress.ts +17 -0
- package/src/types/api/evmGetPublicKey.ts +17 -0
- package/src/types/api/evmSignMessage.ts +12 -0
- package/src/types/api/evmSignMessageEIP712.ts +13 -0
- package/src/types/api/evmSignTransaction.ts +43 -0
- package/src/types/api/evmSignTypedData.ts +40 -0
- package/src/types/api/evmVerifyMessage.ts +13 -0
- package/src/types/api/getFeatures.ts +4 -0
- package/src/types/api/index.ts +80 -0
- package/src/types/api/init.ts +3 -0
- package/src/types/api/searchDevices.ts +4 -0
- package/src/types/api/uiResponse.ts +3 -0
- package/src/types/device.ts +71 -0
- package/src/types/firmware.ts +40 -0
- package/src/types/global.d.ts +3 -0
- package/src/types/index.ts +5 -0
- package/src/types/params.ts +15 -0
- package/src/types/settings.ts +77 -0
- package/src/utils/assets.ts +5 -0
- package/src/utils/deferred.ts +35 -0
- package/src/utils/deviceFeaturesUtils.ts +49 -0
- package/src/utils/findDefectiveBatchDevice.ts +10 -0
- package/src/utils/index.ts +7 -0
- package/src/utils/logger.ts +113 -0
- package/src/utils/networkUtils.ts +18 -0
- package/src/utils/promiseUtils.ts +4 -0
- package/src/utils/versionUtils.ts +120 -0
- package/tsconfig.json +7 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TxInput as OrigTxInput,
|
|
3
|
+
PrevInput,
|
|
4
|
+
Success,
|
|
5
|
+
TxOutputBinType,
|
|
6
|
+
TxOutputType,
|
|
7
|
+
TxInputType,
|
|
8
|
+
} from '@onekeyfe/hd-transport/src/types/messages';
|
|
9
|
+
import type { CommonParams, Response } from '../params';
|
|
10
|
+
|
|
11
|
+
export type SignedTransaction = {
|
|
12
|
+
signatures: string[];
|
|
13
|
+
serializedTx: string;
|
|
14
|
+
txid?: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type TransactionOptions = {
|
|
18
|
+
version?: number;
|
|
19
|
+
lock_time?: number;
|
|
20
|
+
expiry?: number;
|
|
21
|
+
overwintered?: boolean;
|
|
22
|
+
version_group_id?: number;
|
|
23
|
+
timestamp?: number;
|
|
24
|
+
branch_id?: number;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type RefTransaction =
|
|
28
|
+
| {
|
|
29
|
+
hash: string;
|
|
30
|
+
version: number;
|
|
31
|
+
inputs: PrevInput[];
|
|
32
|
+
bin_outputs: TxOutputBinType[];
|
|
33
|
+
outputs?: typeof undefined;
|
|
34
|
+
lock_time: number;
|
|
35
|
+
extra_data?: string;
|
|
36
|
+
expiry?: number;
|
|
37
|
+
overwintered?: boolean;
|
|
38
|
+
version_group_id?: number;
|
|
39
|
+
timestamp?: number;
|
|
40
|
+
branch_id?: number;
|
|
41
|
+
}
|
|
42
|
+
| {
|
|
43
|
+
hash: string;
|
|
44
|
+
version: number;
|
|
45
|
+
inputs: OrigTxInput[];
|
|
46
|
+
bin_outputs?: typeof undefined;
|
|
47
|
+
outputs: TxOutputType[];
|
|
48
|
+
lock_time: number;
|
|
49
|
+
extra_data?: string;
|
|
50
|
+
expiry?: number;
|
|
51
|
+
overwintered?: boolean;
|
|
52
|
+
version_group_id?: number;
|
|
53
|
+
timestamp?: number;
|
|
54
|
+
branch_id?: number;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export type AccountAddress = {
|
|
58
|
+
address: string;
|
|
59
|
+
path: string;
|
|
60
|
+
transfers?: number;
|
|
61
|
+
balance?: string;
|
|
62
|
+
sent?: string;
|
|
63
|
+
received?: string;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export type AccountAddresses = {
|
|
67
|
+
change: AccountAddress[];
|
|
68
|
+
used: AccountAddress[];
|
|
69
|
+
unused: AccountAddress[];
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export type BTCSignTransactionParams = {
|
|
73
|
+
coin: string;
|
|
74
|
+
inputs: TxInputType[];
|
|
75
|
+
outputs: TxOutputType[];
|
|
76
|
+
refTxs: RefTransaction[];
|
|
77
|
+
account?: {
|
|
78
|
+
// Partial account (addresses)
|
|
79
|
+
addresses: AccountAddresses;
|
|
80
|
+
};
|
|
81
|
+
locktime?: number;
|
|
82
|
+
version?: number;
|
|
83
|
+
// Only available for Decred and Zcash
|
|
84
|
+
expiry?: number;
|
|
85
|
+
// Only available for Zcash
|
|
86
|
+
overwintered?: boolean;
|
|
87
|
+
// Only available for Zcash, set overwintered to nVersionGroupId
|
|
88
|
+
versionGroupId?: number;
|
|
89
|
+
// Only available for Zcash when overwintered is true
|
|
90
|
+
branchId?: number;
|
|
91
|
+
// Only available for Capricoin
|
|
92
|
+
timestamp?: number;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export declare function btcSignTransaction(
|
|
96
|
+
connectId: string,
|
|
97
|
+
params: CommonParams & BTCSignTransactionParams
|
|
98
|
+
): Response<Success>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Success } from '@onekeyfe/hd-transport/src/types/messages';
|
|
2
|
+
import type { CommonParams, Response } from '../params';
|
|
3
|
+
|
|
4
|
+
export type BTCVerifyMessageParams = {
|
|
5
|
+
address: string;
|
|
6
|
+
messageHex: string;
|
|
7
|
+
signature: string;
|
|
8
|
+
coin: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export declare function btcVerifyMessage(
|
|
12
|
+
connectId: string,
|
|
13
|
+
params: CommonParams & BTCVerifyMessageParams
|
|
14
|
+
): Response<Success>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Success } from '@onekeyfe/hd-transport/src/types/messages';
|
|
2
|
+
import type { CommonParams, Response } from '../params';
|
|
3
|
+
|
|
4
|
+
export type DeviceChangePinParams = {
|
|
5
|
+
remove?: boolean;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export declare function deviceChangePin(
|
|
9
|
+
connectId: string,
|
|
10
|
+
params: CommonParams & DeviceChangePinParams
|
|
11
|
+
): Response<Success>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Success } from '@onekeyfe/hd-transport/src/types/messages';
|
|
2
|
+
import type { CommonParams, Response } from '../params';
|
|
3
|
+
|
|
4
|
+
export type DeviceFlagsParams = {
|
|
5
|
+
flags?: number;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export declare function deviceFlags(
|
|
9
|
+
connectId: string,
|
|
10
|
+
params: CommonParams & DeviceFlagsParams
|
|
11
|
+
): Response<Success>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { RecoveryDeviceType, Success } from '@onekeyfe/hd-transport/src/types/messages';
|
|
2
|
+
import type { CommonParams, Response } from '../params';
|
|
3
|
+
|
|
4
|
+
export type DeviceRecoveryParams = {
|
|
5
|
+
wordCount?: number;
|
|
6
|
+
passphraseProtection?: boolean;
|
|
7
|
+
pinProtection?: boolean;
|
|
8
|
+
language?: string;
|
|
9
|
+
label?: string;
|
|
10
|
+
enforceWordlist?: boolean;
|
|
11
|
+
type?: RecoveryDeviceType;
|
|
12
|
+
u2fCounter?: number;
|
|
13
|
+
dryRun?: boolean;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export declare function deviceRecovery(
|
|
17
|
+
connectId: string,
|
|
18
|
+
params: CommonParams & DeviceRecoveryParams
|
|
19
|
+
): Response<Success>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Success } from '@onekeyfe/hd-transport/src/types/messages';
|
|
2
|
+
import type { CommonParams, Response } from '../params';
|
|
3
|
+
|
|
4
|
+
export type DeviceResetParams = {
|
|
5
|
+
displayRandom?: boolean;
|
|
6
|
+
strength?: number;
|
|
7
|
+
passphraseProtection?: boolean;
|
|
8
|
+
pinProtection?: boolean;
|
|
9
|
+
language?: string;
|
|
10
|
+
label?: string;
|
|
11
|
+
u2fCounter?: number;
|
|
12
|
+
skipBackup?: boolean;
|
|
13
|
+
noBackup?: boolean;
|
|
14
|
+
backupType?: string | number;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export declare function deviceReset(
|
|
18
|
+
connectId: string,
|
|
19
|
+
params: CommonParams & DeviceResetParams
|
|
20
|
+
): Response<Success>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SafetyCheckLevel, Success } from '@onekeyfe/hd-transport/src/types/messages';
|
|
2
|
+
import type { Response } from '../params';
|
|
3
|
+
|
|
4
|
+
export type DeviceSettingsParams = {
|
|
5
|
+
language?: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
usePassphrase?: boolean;
|
|
8
|
+
homescreen?: string;
|
|
9
|
+
passphraseSource?: number;
|
|
10
|
+
autoLockDelayMs?: number;
|
|
11
|
+
displayRotation?: number;
|
|
12
|
+
passphraseAlwaysOnDevice?: boolean;
|
|
13
|
+
safetyChecks?: SafetyCheckLevel;
|
|
14
|
+
experimentalFeatures?: boolean;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export declare function deviceSettings(connectId: string): Response<Success>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { EthereumAddress } from '@onekeyfe/hd-transport/src/types/messages';
|
|
2
|
+
import type { CommonParams, Response } from '../params';
|
|
3
|
+
|
|
4
|
+
export type EVMGetAddressParams = {
|
|
5
|
+
path: string | number[];
|
|
6
|
+
showOnOneKey?: boolean;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export declare function evmGetAddress(
|
|
10
|
+
connectId: string,
|
|
11
|
+
params: CommonParams & EVMGetAddressParams
|
|
12
|
+
): Response<EthereumAddress>;
|
|
13
|
+
|
|
14
|
+
export declare function evmGetAddress(
|
|
15
|
+
connectId: string,
|
|
16
|
+
params: CommonParams & { bundle?: EVMGetAddressParams[] }
|
|
17
|
+
): Response<Array<EthereumAddress>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { EthereumPublicKey } from '@onekeyfe/hd-transport/src/types/messages';
|
|
2
|
+
import type { CommonParams, Response } from '../params';
|
|
3
|
+
|
|
4
|
+
export type EVMGetPublicKeyParams = {
|
|
5
|
+
path: string | number[];
|
|
6
|
+
showOnOneKey?: boolean;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export declare function evmGetPublicKey(
|
|
10
|
+
connectId: string,
|
|
11
|
+
params: CommonParams & EVMGetPublicKeyParams
|
|
12
|
+
): Response<EthereumPublicKey>;
|
|
13
|
+
|
|
14
|
+
export declare function evmGetPublicKey(
|
|
15
|
+
connectId: string,
|
|
16
|
+
params: CommonParams & { bundle?: EVMGetPublicKeyParams[] }
|
|
17
|
+
): Response<Array<EthereumPublicKey>>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { EthereumMessageSignature } from '@onekeyfe/hd-transport/src/types/messages';
|
|
2
|
+
import type { CommonParams, Response } from '../params';
|
|
3
|
+
|
|
4
|
+
export type EVMSignMessageParams = {
|
|
5
|
+
path: string | number[];
|
|
6
|
+
messageHex: string;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export declare function evmSignMessage(
|
|
10
|
+
connectId: string,
|
|
11
|
+
params: CommonParams & EVMSignMessageParams
|
|
12
|
+
): Response<EthereumMessageSignature>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { EthereumMessageSignature } from '@onekeyfe/hd-transport/src/types/messages';
|
|
2
|
+
import type { CommonParams, Response } from '../params';
|
|
3
|
+
|
|
4
|
+
export type EVMSignMessageEIP712Params = {
|
|
5
|
+
path: string | number[];
|
|
6
|
+
domainHash: string;
|
|
7
|
+
messageHash: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export declare function evmSignMessageEIP712(
|
|
11
|
+
connectId: string,
|
|
12
|
+
params: CommonParams & EVMSignMessageEIP712Params
|
|
13
|
+
): Response<EthereumMessageSignature>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { EthereumMessageSignature } from '@onekeyfe/hd-transport/src/types/messages';
|
|
2
|
+
import type { CommonParams, Response } from '../params';
|
|
3
|
+
|
|
4
|
+
export interface EVMTransaction {
|
|
5
|
+
to: string;
|
|
6
|
+
value: string;
|
|
7
|
+
gasPrice: string;
|
|
8
|
+
gasLimit: string;
|
|
9
|
+
maxFeePerGas?: typeof undefined;
|
|
10
|
+
maxPriorityFeePerGas?: typeof undefined;
|
|
11
|
+
nonce: string;
|
|
12
|
+
data?: string;
|
|
13
|
+
chainId: number;
|
|
14
|
+
txType?: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type EVMAccessList = {
|
|
18
|
+
address: string;
|
|
19
|
+
storageKeys: string[];
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type EVMTransactionEIP1559 = {
|
|
23
|
+
to: string;
|
|
24
|
+
value: string;
|
|
25
|
+
gasLimit: string;
|
|
26
|
+
gasPrice?: typeof undefined;
|
|
27
|
+
nonce: string;
|
|
28
|
+
data?: string;
|
|
29
|
+
chainId: number;
|
|
30
|
+
maxFeePerGas: string;
|
|
31
|
+
maxPriorityFeePerGas: string;
|
|
32
|
+
accessList?: EVMAccessList[];
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type EVMSignTransactionParams = {
|
|
36
|
+
path: string | number[];
|
|
37
|
+
transaction: EVMTransaction | EVMTransactionEIP1559;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export declare function evmSignTransaction(
|
|
41
|
+
connectId: string,
|
|
42
|
+
params: CommonParams & EVMSignTransactionParams
|
|
43
|
+
): Response<EthereumMessageSignature>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { EthereumMessageSignature } from '@onekeyfe/hd-transport/src/types/messages';
|
|
2
|
+
import type { CommonParams, Response } from '../params';
|
|
3
|
+
|
|
4
|
+
export type EthereumSignTypedDataTypeProperty = {
|
|
5
|
+
name: string;
|
|
6
|
+
type: string;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
// EthereumSignTypedDataTypes
|
|
10
|
+
export type EthereumSignTypedDataTypes = {
|
|
11
|
+
EIP712Domain: EthereumSignTypedDataTypeProperty[];
|
|
12
|
+
[additionalProperties: string]: EthereumSignTypedDataTypeProperty[];
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
// EthereumSignTypedDataMessage
|
|
16
|
+
export type EthereumSignTypedDataMessage<T extends EthereumSignTypedDataTypes> = {
|
|
17
|
+
types: T;
|
|
18
|
+
primaryType: keyof T;
|
|
19
|
+
domain: {
|
|
20
|
+
name?: string;
|
|
21
|
+
version?: string;
|
|
22
|
+
chainId?: number;
|
|
23
|
+
verifyingContract?: string;
|
|
24
|
+
salt?: ArrayBuffer;
|
|
25
|
+
};
|
|
26
|
+
message: { [fieldName: string]: any };
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export type EVMSignTypedDataParams = {
|
|
30
|
+
path: string | number[];
|
|
31
|
+
metamaskV4Compat: boolean;
|
|
32
|
+
data: EthereumSignTypedDataMessage<EthereumSignTypedDataTypes>;
|
|
33
|
+
domainHash?: string;
|
|
34
|
+
messageHash?: string;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export declare function evmSignTypedData(
|
|
38
|
+
connectId: string,
|
|
39
|
+
params: CommonParams & EVMSignTypedDataParams
|
|
40
|
+
): Response<EthereumMessageSignature>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Success } from '@onekeyfe/hd-transport/src/types/messages';
|
|
2
|
+
import type { CommonParams, Response } from '../params';
|
|
3
|
+
|
|
4
|
+
export type EVMVerifyMessageParams = {
|
|
5
|
+
address: string;
|
|
6
|
+
messageHex: string;
|
|
7
|
+
signature: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export declare function evmVerifyMessage(
|
|
11
|
+
connectId: string,
|
|
12
|
+
params: CommonParams & EVMVerifyMessageParams
|
|
13
|
+
): Response<Success>;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { on, off, removeAllListeners } from './event';
|
|
2
|
+
import { searchDevices } from './searchDevices';
|
|
3
|
+
import { getFeatures } from './getFeatures';
|
|
4
|
+
import { checkFirmwareRelease } from './checkFirmwareRelease';
|
|
5
|
+
import { init } from './init';
|
|
6
|
+
import { checkBLEFirmwareRelease } from './checkBLEFirmwareRelease';
|
|
7
|
+
import { checkTransportRelease } from './checkTransportRelease';
|
|
8
|
+
import { evmGetAddress } from './evmGetAddress';
|
|
9
|
+
import { evmGetPublicKey } from './evmGetPublicKey';
|
|
10
|
+
import { evmSignMessage } from './evmSignMessage';
|
|
11
|
+
import { evmSignMessageEIP712 } from './evmSignMessageEIP712';
|
|
12
|
+
import { evmSignTransaction } from './evmSignTransaction';
|
|
13
|
+
import { evmSignTypedData } from './evmSignTypedData';
|
|
14
|
+
import { evmVerifyMessage } from './evmVerifyMessage';
|
|
15
|
+
import { btcGetAddress } from './btcGetAddress';
|
|
16
|
+
import { btcGetPublicKey } from './btcGetPublicKey';
|
|
17
|
+
import { btcSignMessage } from './btcSignMessage';
|
|
18
|
+
import { btcSignTransaction } from './btcSignTransaction';
|
|
19
|
+
import { btcVerifyMessage } from './btcVerifyMessage';
|
|
20
|
+
import { uiResponse } from './uiResponse';
|
|
21
|
+
import { deviceReset } from './deviceReset';
|
|
22
|
+
import { deviceRecovery } from './deviceRecovery';
|
|
23
|
+
import { deviceWipe } from './deviceWipe';
|
|
24
|
+
import { deviceRebootToBootloader } from './deviceRebootToBootloader';
|
|
25
|
+
import { deviceBackup } from './deviceBackup';
|
|
26
|
+
import { deviceChangePin } from './deviceChangePin';
|
|
27
|
+
import { deviceSettings } from './deviceSettings';
|
|
28
|
+
import { deviceFlags } from './deviceFlags';
|
|
29
|
+
import { deviceUpdateReboot } from './deviceUpdateReboot';
|
|
30
|
+
|
|
31
|
+
export type CoreApi = {
|
|
32
|
+
/**
|
|
33
|
+
* Inject function
|
|
34
|
+
*/
|
|
35
|
+
init: typeof init;
|
|
36
|
+
on: typeof on;
|
|
37
|
+
off: typeof off;
|
|
38
|
+
removeAllListeners: typeof removeAllListeners;
|
|
39
|
+
dispose: () => void;
|
|
40
|
+
call: (params: any) => Promise<any>;
|
|
41
|
+
uiResponse: typeof uiResponse;
|
|
42
|
+
cancel: (params?: string) => void;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Core function
|
|
46
|
+
*/
|
|
47
|
+
searchDevices: typeof searchDevices;
|
|
48
|
+
|
|
49
|
+
getFeatures: typeof getFeatures;
|
|
50
|
+
|
|
51
|
+
checkFirmwareRelease: typeof checkFirmwareRelease;
|
|
52
|
+
|
|
53
|
+
checkBLEFirmwareRelease: typeof checkBLEFirmwareRelease;
|
|
54
|
+
|
|
55
|
+
checkTransportRelease: typeof checkTransportRelease;
|
|
56
|
+
|
|
57
|
+
deviceBackup: typeof deviceBackup;
|
|
58
|
+
deviceChangePin: typeof deviceChangePin;
|
|
59
|
+
deviceFlags: typeof deviceFlags;
|
|
60
|
+
deviceRebootToBootloader: typeof deviceRebootToBootloader;
|
|
61
|
+
deviceRecovery: typeof deviceRecovery;
|
|
62
|
+
deviceReset: typeof deviceReset;
|
|
63
|
+
deviceSettings: typeof deviceSettings;
|
|
64
|
+
deviceUpdateReboot: typeof deviceUpdateReboot;
|
|
65
|
+
deviceWipe: typeof deviceWipe;
|
|
66
|
+
|
|
67
|
+
evmGetAddress: typeof evmGetAddress;
|
|
68
|
+
evmGetPublicKey: typeof evmGetPublicKey;
|
|
69
|
+
evmSignMessage: typeof evmSignMessage;
|
|
70
|
+
evmSignMessageEIP712: typeof evmSignMessageEIP712;
|
|
71
|
+
evmSignTransaction: typeof evmSignTransaction;
|
|
72
|
+
evmSignTypedData: typeof evmSignTypedData;
|
|
73
|
+
evmVerifyMessage: typeof evmVerifyMessage;
|
|
74
|
+
|
|
75
|
+
btcGetAddress: typeof btcGetAddress;
|
|
76
|
+
btcGetPublicKey: typeof btcGetPublicKey;
|
|
77
|
+
btcSignMessage: typeof btcSignMessage;
|
|
78
|
+
btcSignTransaction: typeof btcSignTransaction;
|
|
79
|
+
btcVerifyMessage: typeof btcVerifyMessage;
|
|
80
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { PROTO } from '../constants';
|
|
2
|
+
import { IVersionArray } from './settings';
|
|
3
|
+
|
|
4
|
+
export type DeviceStatus = 'available' | 'occupied' | 'used';
|
|
5
|
+
|
|
6
|
+
export type DeviceMode = 'normal' | 'bootloader' | 'initialize' | 'seedless';
|
|
7
|
+
|
|
8
|
+
export type UnavailableCapability =
|
|
9
|
+
| 'no-capability'
|
|
10
|
+
| 'no-support'
|
|
11
|
+
| 'update-required'
|
|
12
|
+
| 'trezor-connect-outdated';
|
|
13
|
+
|
|
14
|
+
export type UnavailableCapabilities = { [key: string]: UnavailableCapability };
|
|
15
|
+
|
|
16
|
+
export type KnownDevice = {
|
|
17
|
+
connectId: string | null;
|
|
18
|
+
uuid: string;
|
|
19
|
+
deviceId: string | null;
|
|
20
|
+
deviceType: IDeviceType;
|
|
21
|
+
path: string;
|
|
22
|
+
label: string;
|
|
23
|
+
error?: typeof undefined;
|
|
24
|
+
mode: DeviceMode;
|
|
25
|
+
features: PROTO.Features;
|
|
26
|
+
unavailableCapabilities: UnavailableCapabilities;
|
|
27
|
+
bleFirmwareVersion: IVersionArray | null;
|
|
28
|
+
firmwareVersion: IVersionArray | null;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// export type UnknownDevice = {
|
|
32
|
+
// type: 'unacquired';
|
|
33
|
+
// id?: null;
|
|
34
|
+
// path: string;
|
|
35
|
+
// label: string;
|
|
36
|
+
// error?: typeof undefined;
|
|
37
|
+
// features?: typeof undefined;
|
|
38
|
+
// firmware?: typeof undefined;
|
|
39
|
+
// firmwareRelease?: typeof undefined;
|
|
40
|
+
// status?: typeof undefined;
|
|
41
|
+
// mode?: typeof undefined;
|
|
42
|
+
// state?: typeof undefined;
|
|
43
|
+
// unavailableCapabilities?: typeof undefined;
|
|
44
|
+
// };
|
|
45
|
+
|
|
46
|
+
// export type UnreadableDevice = {
|
|
47
|
+
// type: 'unreadable';
|
|
48
|
+
// id?: null;
|
|
49
|
+
// path: string;
|
|
50
|
+
// label: string;
|
|
51
|
+
// error: string;
|
|
52
|
+
// features?: typeof undefined;
|
|
53
|
+
// firmware?: typeof undefined;
|
|
54
|
+
// firmwareRelease?: typeof undefined;
|
|
55
|
+
// status?: typeof undefined;
|
|
56
|
+
// mode?: typeof undefined;
|
|
57
|
+
// state?: typeof undefined;
|
|
58
|
+
// unavailableCapabilities?: typeof undefined;
|
|
59
|
+
// };
|
|
60
|
+
|
|
61
|
+
export type Device = KnownDevice;
|
|
62
|
+
|
|
63
|
+
export type Features = PROTO.Features;
|
|
64
|
+
|
|
65
|
+
export type IDeviceType = 'classic' | 'mini' | 'touch' | 'pro';
|
|
66
|
+
|
|
67
|
+
export type IDeviceFirmwareStatus = 'valid' | 'outdated' | 'required' | 'unknown' | 'none';
|
|
68
|
+
|
|
69
|
+
export type IDeviceBLEFirmwareStatus = 'valid' | 'outdated' | 'required' | 'unknown' | 'none';
|
|
70
|
+
|
|
71
|
+
export type ITransportStatus = 'valid' | 'outdated';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export interface FirmwareRange {
|
|
2
|
+
'1': {
|
|
3
|
+
min: string;
|
|
4
|
+
max: string;
|
|
5
|
+
};
|
|
6
|
+
'2': {
|
|
7
|
+
min: string;
|
|
8
|
+
max: string;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type VersionArray = [1 | 2, number, number];
|
|
13
|
+
|
|
14
|
+
export type FirmwareRelease = {
|
|
15
|
+
required: boolean;
|
|
16
|
+
url: string;
|
|
17
|
+
fingerprint: string;
|
|
18
|
+
changelog: string;
|
|
19
|
+
min_bridge_version: [number, number, number];
|
|
20
|
+
version: VersionArray;
|
|
21
|
+
min_firmware_version: VersionArray;
|
|
22
|
+
min_bootloader_version: VersionArray;
|
|
23
|
+
bootloader_version?: VersionArray;
|
|
24
|
+
url_bitcoinonly?: string;
|
|
25
|
+
fingerprint_bitcoinonly?: string;
|
|
26
|
+
notes?: string;
|
|
27
|
+
rollout?: number;
|
|
28
|
+
channel?: string;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type ReleaseInfo = {
|
|
32
|
+
changelog: FirmwareRelease[] | null;
|
|
33
|
+
release: FirmwareRelease;
|
|
34
|
+
isLatest: boolean;
|
|
35
|
+
latest: FirmwareRelease;
|
|
36
|
+
isRequired: boolean | null;
|
|
37
|
+
isNewer: boolean | null;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export type TransportReleaseStatus = 'valid' | 'outdated';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface CommonParams {
|
|
2
|
+
keepSession?: boolean;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export interface Unsuccessful {
|
|
6
|
+
success: false;
|
|
7
|
+
payload: { error: string; code?: string };
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface Success<T> {
|
|
11
|
+
success: true;
|
|
12
|
+
payload: T;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type Response<T> = Promise<Success<T> | Unsuccessful>;
|