@onekeyfe/hd-core 0.3.40-alpha.5 → 0.3.40
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/dist/api/btc/BTCGetAddress.d.ts +0 -11
- package/dist/api/btc/BTCGetAddress.d.ts.map +1 -1
- package/dist/api/btc/BTCGetPublicKey.d.ts +0 -11
- package/dist/api/btc/BTCGetPublicKey.d.ts.map +1 -1
- package/dist/api/btc/BTCSignMessage.d.ts +0 -11
- package/dist/api/btc/BTCSignMessage.d.ts.map +1 -1
- package/dist/api/btc/BTCSignTransaction.d.ts +0 -11
- package/dist/api/btc/BTCSignTransaction.d.ts.map +1 -1
- package/dist/api/btc/BTCVerifyMessage.d.ts +0 -11
- package/dist/api/btc/BTCVerifyMessage.d.ts.map +1 -1
- package/dist/api/index.d.ts +0 -2
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/sui/SuiSignTransaction.d.ts +3 -6
- package/dist/api/sui/SuiSignTransaction.d.ts.map +1 -1
- package/dist/data-manager/DataManager.d.ts +1 -1
- package/dist/index.d.ts +5 -31
- package/dist/index.js +132 -196
- package/dist/inject.d.ts.map +1 -1
- package/dist/types/api/deviceUpdateBootloader.d.ts +1 -1
- package/dist/types/api/deviceUpdateBootloader.d.ts.map +1 -1
- package/dist/types/api/export.d.ts +0 -2
- package/dist/types/api/export.d.ts.map +1 -1
- package/dist/types/api/index.d.ts +0 -4
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/settings.d.ts +1 -1
- package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/api/btc/BTCGetAddress.ts +0 -5
- package/src/api/btc/BTCGetPublicKey.ts +0 -5
- package/src/api/btc/BTCSignMessage.ts +0 -5
- package/src/api/btc/BTCSignTransaction.ts +0 -5
- package/src/api/btc/BTCVerifyMessage.ts +0 -5
- package/src/api/index.ts +0 -4
- package/src/api/sui/SuiSignTransaction.ts +11 -12
- package/src/data/coins/bitcoin.json +1 -2
- package/src/data/messages/messages.json +113 -3
- package/src/data-manager/DataManager.ts +1 -1
- package/src/inject.ts +0 -5
- package/src/types/api/deviceUpdateBootloader.ts +1 -1
- package/src/types/api/export.ts +0 -3
- package/src/types/api/index.ts +0 -8
- package/src/types/settings.ts +1 -1
- package/src/utils/deviceFeaturesUtils.ts +8 -4
- package/dist/api/btc/helpers/versionLimit.d.ts +0 -12
- package/dist/api/btc/helpers/versionLimit.d.ts.map +0 -1
- package/dist/api/nervos/NervosGetAddress.d.ts +0 -17
- package/dist/api/nervos/NervosGetAddress.d.ts.map +0 -1
- package/dist/api/nervos/NervosSignTransaction.d.ts +0 -25
- package/dist/api/nervos/NervosSignTransaction.d.ts.map +0 -1
- package/dist/types/api/nervosGetAddress.d.ts +0 -15
- package/dist/types/api/nervosGetAddress.d.ts.map +0 -1
- package/dist/types/api/nervosSignTransaction.d.ts +0 -13
- package/dist/types/api/nervosSignTransaction.d.ts.map +0 -1
- package/src/api/btc/helpers/versionLimit.ts +0 -25
- package/src/api/nervos/NervosGetAddress.ts +0 -76
- package/src/api/nervos/NervosSignTransaction.ts +0 -113
- package/src/types/api/nervosGetAddress.ts +0 -24
- package/src/types/api/nervosSignTransaction.ts +0 -19
|
@@ -5,7 +5,6 @@ import { BaseMethod } from '../BaseMethod';
|
|
|
5
5
|
import { validateParams } from '../helpers/paramsValidator';
|
|
6
6
|
import { formatAnyHex } from '../helpers/hexUtils';
|
|
7
7
|
import { getCoinAndScriptType } from './helpers/btcParamsUtils';
|
|
8
|
-
import { getBitcoinForkVersionRange } from './helpers/versionLimit';
|
|
9
8
|
|
|
10
9
|
export default class BTCSignMessage extends BaseMethod<SignMessage> {
|
|
11
10
|
init() {
|
|
@@ -34,10 +33,6 @@ export default class BTCSignMessage extends BaseMethod<SignMessage> {
|
|
|
34
33
|
};
|
|
35
34
|
}
|
|
36
35
|
|
|
37
|
-
getVersionRange() {
|
|
38
|
-
return getBitcoinForkVersionRange([this.params.coin_name]);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
36
|
async run() {
|
|
42
37
|
const res = await this.device.commands.typedCall('SignMessage', 'MessageSignature', {
|
|
43
38
|
...this.params,
|
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
import signtx from './helpers/signtx';
|
|
15
15
|
import signtxLegacy from './helpers/signtxLegacy';
|
|
16
16
|
import { getCoinInfo } from './helpers/btcParamsUtils';
|
|
17
|
-
import { getBitcoinForkVersionRange } from './helpers/versionLimit';
|
|
18
17
|
|
|
19
18
|
type Params = {
|
|
20
19
|
inputs: TxInputType[];
|
|
@@ -121,10 +120,6 @@ export default class BTCSignTransaction extends BaseMethod<Params> {
|
|
|
121
120
|
};
|
|
122
121
|
}
|
|
123
122
|
|
|
124
|
-
getVersionRange() {
|
|
125
|
-
return getBitcoinForkVersionRange([this.params.coinName]);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
123
|
async run() {
|
|
129
124
|
const { device, params } = this;
|
|
130
125
|
|
|
@@ -5,7 +5,6 @@ import { BaseMethod } from '../BaseMethod';
|
|
|
5
5
|
import { validateParams } from '../helpers/paramsValidator';
|
|
6
6
|
import { formatAnyHex } from '../helpers/hexUtils';
|
|
7
7
|
import { getCoinInfo } from './helpers/btcParamsUtils';
|
|
8
|
-
import { getBitcoinForkVersionRange } from './helpers/versionLimit';
|
|
9
8
|
|
|
10
9
|
export default class BTCVerifyMessage extends BaseMethod<VerifyMessage> {
|
|
11
10
|
init() {
|
|
@@ -32,10 +31,6 @@ export default class BTCVerifyMessage extends BaseMethod<VerifyMessage> {
|
|
|
32
31
|
};
|
|
33
32
|
}
|
|
34
33
|
|
|
35
|
-
getVersionRange() {
|
|
36
|
-
return getBitcoinForkVersionRange([this.params.coin_name]);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
34
|
async run() {
|
|
40
35
|
const res = await this.device.commands.typedCall('VerifyMessage', 'Success', {
|
|
41
36
|
...this.params,
|
package/src/api/index.ts
CHANGED
|
@@ -113,8 +113,4 @@ export { default as nostrSignEvent } from './nostr/NostrSignEvent';
|
|
|
113
113
|
export { default as nostrEncryptMessage } from './nostr/NostrEncryptMessage';
|
|
114
114
|
export { default as nostrDecryptMessage } from './nostr/NostrDecryptMessage';
|
|
115
115
|
export { default as nostrSignSchnorr } from './nostr/NostrSignSchnorr';
|
|
116
|
-
|
|
117
116
|
export { default as lnurlAuth } from './lightning/LnurlAuth';
|
|
118
|
-
|
|
119
|
-
export { default as nervosGetAddress } from './nervos/NervosGetAddress';
|
|
120
|
-
export { default as nervosSignTransaction } from './nervos/NervosSignTransaction';
|
|
@@ -9,9 +9,7 @@ import { getDeviceFirmwareVersion, getDeviceType } from '../../utils/deviceFeatu
|
|
|
9
9
|
import { DeviceModelToTypes } from '../../types';
|
|
10
10
|
import type { TypedResponseMessage } from '../../device/DeviceCommands';
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export default class SuiSignTransaction extends BaseMethod<SuiSignTx> {
|
|
12
|
+
export default class SuiSignTransaction extends BaseMethod<HardwareSuiSignTx> {
|
|
15
13
|
init() {
|
|
16
14
|
this.checkDeviceId = true;
|
|
17
15
|
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
@@ -61,12 +59,12 @@ export default class SuiSignTransaction extends BaseMethod<SuiSignTx> {
|
|
|
61
59
|
return false;
|
|
62
60
|
}
|
|
63
61
|
|
|
64
|
-
|
|
62
|
+
chunkSize = 1024;
|
|
65
63
|
|
|
66
64
|
processTxRequest = async (
|
|
67
65
|
typedCall: TypedCall,
|
|
68
66
|
res: TypedResponseMessage<'SuiSignedTx'> | TypedResponseMessage<'SuiTxRequest'>,
|
|
69
|
-
data:
|
|
67
|
+
data: string,
|
|
70
68
|
offset = 0
|
|
71
69
|
): Promise<SuiSignedTx> => {
|
|
72
70
|
if (res.type === 'SuiSignedTx') {
|
|
@@ -80,10 +78,10 @@ export default class SuiSignTransaction extends BaseMethod<SuiSignTx> {
|
|
|
80
78
|
return res.message;
|
|
81
79
|
}
|
|
82
80
|
|
|
83
|
-
const payload = data.
|
|
81
|
+
const payload = data.slice(offset, offset + data_length * 2);
|
|
84
82
|
const newOffset = offset + payload.length;
|
|
85
83
|
const resourceAckParams = {
|
|
86
|
-
data_chunk: payload
|
|
84
|
+
data_chunk: payload,
|
|
87
85
|
};
|
|
88
86
|
|
|
89
87
|
const response = await typedCall('SuiTxAck', ['SuiSignedTx', 'SuiTxRequest'], {
|
|
@@ -95,17 +93,18 @@ export default class SuiSignTransaction extends BaseMethod<SuiSignTx> {
|
|
|
95
93
|
|
|
96
94
|
async run() {
|
|
97
95
|
const typedCall = this.device.getCommands().typedCall.bind(this.device.getCommands());
|
|
96
|
+
const dataLength = this.params.raw_tx.length / 2;
|
|
98
97
|
let offset = 0;
|
|
99
|
-
let data
|
|
98
|
+
let data = '';
|
|
100
99
|
|
|
101
100
|
if (this.supportChunkTransfer()) {
|
|
102
|
-
offset = this.
|
|
103
|
-
data =
|
|
101
|
+
offset = this.chunkSize;
|
|
102
|
+
data = this.params.raw_tx;
|
|
104
103
|
this.params = {
|
|
105
104
|
address_n: this.params.address_n,
|
|
106
105
|
raw_tx: '',
|
|
107
|
-
data_initial_chunk:
|
|
108
|
-
data_length:
|
|
106
|
+
data_initial_chunk: this.params.raw_tx.slice(0, this.chunkSize * 2),
|
|
107
|
+
data_length: dataLength,
|
|
109
108
|
};
|
|
110
109
|
}
|
|
111
110
|
|
|
@@ -39,6 +39,5 @@
|
|
|
39
39
|
{ "name": "Viacoin", "label": "VIA", "slip44": 14 },
|
|
40
40
|
{ "name": "ZCore", "label": "ZCR", "slip44": 428 },
|
|
41
41
|
{ "name": "Zcash", "label": "ZEC", "slip44": 133 },
|
|
42
|
-
{ "name": "Zcash Testnet", "label": "TAZ", "slip44": 1 }
|
|
43
|
-
{ "name": "Neurai", "label": "XNA", "slip44": 1900 }
|
|
42
|
+
{ "name": "Zcash Testnet", "label": "TAZ", "slip44": 1 }
|
|
44
43
|
]
|
|
@@ -5686,15 +5686,15 @@
|
|
|
5686
5686
|
"type": "bytes",
|
|
5687
5687
|
"id": 605
|
|
5688
5688
|
},
|
|
5689
|
-
"
|
|
5689
|
+
"onekey_se01_version": {
|
|
5690
5690
|
"type": "string",
|
|
5691
5691
|
"id": 606
|
|
5692
5692
|
},
|
|
5693
|
-
"
|
|
5693
|
+
"onekey_se01_hash": {
|
|
5694
5694
|
"type": "bytes",
|
|
5695
5695
|
"id": 607
|
|
5696
5696
|
},
|
|
5697
|
-
"
|
|
5697
|
+
"onekey_se01_build_id": {
|
|
5698
5698
|
"type": "string",
|
|
5699
5699
|
"id": 608
|
|
5700
5700
|
},
|
|
@@ -5733,6 +5733,110 @@
|
|
|
5733
5733
|
"onekey_ble_hash": {
|
|
5734
5734
|
"type": "bytes",
|
|
5735
5735
|
"id": 617
|
|
5736
|
+
},
|
|
5737
|
+
"onekey_board_build_id": {
|
|
5738
|
+
"type": "string",
|
|
5739
|
+
"id": 618
|
|
5740
|
+
},
|
|
5741
|
+
"onekey_se01_boot_version": {
|
|
5742
|
+
"type": "string",
|
|
5743
|
+
"id": 619
|
|
5744
|
+
},
|
|
5745
|
+
"onekey_se01_boot_hash": {
|
|
5746
|
+
"type": "bytes",
|
|
5747
|
+
"id": 620
|
|
5748
|
+
},
|
|
5749
|
+
"onekey_se01_boot_build_id": {
|
|
5750
|
+
"type": "string",
|
|
5751
|
+
"id": 621
|
|
5752
|
+
},
|
|
5753
|
+
"onekey_se02_version": {
|
|
5754
|
+
"type": "string",
|
|
5755
|
+
"id": 622
|
|
5756
|
+
},
|
|
5757
|
+
"onekey_se02_hash": {
|
|
5758
|
+
"type": "bytes",
|
|
5759
|
+
"id": 623
|
|
5760
|
+
},
|
|
5761
|
+
"onekey_se02_build_id": {
|
|
5762
|
+
"type": "string",
|
|
5763
|
+
"id": 624
|
|
5764
|
+
},
|
|
5765
|
+
"onekey_se02_boot_version": {
|
|
5766
|
+
"type": "string",
|
|
5767
|
+
"id": 625
|
|
5768
|
+
},
|
|
5769
|
+
"onekey_se02_boot_hash": {
|
|
5770
|
+
"type": "bytes",
|
|
5771
|
+
"id": 626
|
|
5772
|
+
},
|
|
5773
|
+
"onekey_se02_boot_build_id": {
|
|
5774
|
+
"type": "string",
|
|
5775
|
+
"id": 627
|
|
5776
|
+
},
|
|
5777
|
+
"onekey_se03_version": {
|
|
5778
|
+
"type": "string",
|
|
5779
|
+
"id": 628
|
|
5780
|
+
},
|
|
5781
|
+
"onekey_se03_hash": {
|
|
5782
|
+
"type": "bytes",
|
|
5783
|
+
"id": 629
|
|
5784
|
+
},
|
|
5785
|
+
"onekey_se03_build_id": {
|
|
5786
|
+
"type": "string",
|
|
5787
|
+
"id": 630
|
|
5788
|
+
},
|
|
5789
|
+
"onekey_se03_boot_version": {
|
|
5790
|
+
"type": "string",
|
|
5791
|
+
"id": 631
|
|
5792
|
+
},
|
|
5793
|
+
"onekey_se03_boot_hash": {
|
|
5794
|
+
"type": "bytes",
|
|
5795
|
+
"id": 632
|
|
5796
|
+
},
|
|
5797
|
+
"onekey_se03_boot_build_id": {
|
|
5798
|
+
"type": "string",
|
|
5799
|
+
"id": 633
|
|
5800
|
+
},
|
|
5801
|
+
"onekey_se04_version": {
|
|
5802
|
+
"type": "string",
|
|
5803
|
+
"id": 634
|
|
5804
|
+
},
|
|
5805
|
+
"onekey_se04_hash": {
|
|
5806
|
+
"type": "bytes",
|
|
5807
|
+
"id": 635
|
|
5808
|
+
},
|
|
5809
|
+
"onekey_se04_build_id": {
|
|
5810
|
+
"type": "string",
|
|
5811
|
+
"id": 636
|
|
5812
|
+
},
|
|
5813
|
+
"onekey_se04_boot_version": {
|
|
5814
|
+
"type": "string",
|
|
5815
|
+
"id": 637
|
|
5816
|
+
},
|
|
5817
|
+
"onekey_se04_boot_hash": {
|
|
5818
|
+
"type": "bytes",
|
|
5819
|
+
"id": 638
|
|
5820
|
+
},
|
|
5821
|
+
"onekey_se04_boot_build_id": {
|
|
5822
|
+
"type": "string",
|
|
5823
|
+
"id": 639
|
|
5824
|
+
},
|
|
5825
|
+
"onekey_se01_state": {
|
|
5826
|
+
"type": "OneKeySEState",
|
|
5827
|
+
"id": 640
|
|
5828
|
+
},
|
|
5829
|
+
"onekey_se02_state": {
|
|
5830
|
+
"type": "OneKeySEState",
|
|
5831
|
+
"id": 641
|
|
5832
|
+
},
|
|
5833
|
+
"onekey_se03_state": {
|
|
5834
|
+
"type": "OneKeySEState",
|
|
5835
|
+
"id": 642
|
|
5836
|
+
},
|
|
5837
|
+
"onekey_se04_state": {
|
|
5838
|
+
"type": "OneKeySEState",
|
|
5839
|
+
"id": 643
|
|
5736
5840
|
}
|
|
5737
5841
|
},
|
|
5738
5842
|
"nested": {
|
|
@@ -5774,6 +5878,12 @@
|
|
|
5774
5878
|
"THD89": 0,
|
|
5775
5879
|
"SE608A": 1
|
|
5776
5880
|
}
|
|
5881
|
+
},
|
|
5882
|
+
"OneKeySEState": {
|
|
5883
|
+
"values": {
|
|
5884
|
+
"BOOT": 0,
|
|
5885
|
+
"APP": 1
|
|
5886
|
+
}
|
|
5777
5887
|
}
|
|
5778
5888
|
}
|
|
5779
5889
|
},
|
|
@@ -24,7 +24,7 @@ import type {
|
|
|
24
24
|
import { DeviceModelToTypes } from '../types';
|
|
25
25
|
import { findLatestRelease, getReleaseChangelog, getReleaseStatus } from '../utils/release';
|
|
26
26
|
|
|
27
|
-
export type FirmwareField = 'firmware' | 'firmware-v2' | 'firmware-
|
|
27
|
+
export type FirmwareField = 'firmware' | 'firmware-v2' | 'firmware-v5';
|
|
28
28
|
|
|
29
29
|
export type MessageVersion = 'latest' | 'v1';
|
|
30
30
|
|
package/src/inject.ts
CHANGED
|
@@ -282,9 +282,4 @@ export const createCoreApi = (
|
|
|
282
282
|
call({ ...params, connectId, deviceId, method: 'nostrSignSchnorr' }),
|
|
283
283
|
lnurlAuth: (connectId, deviceId, params) =>
|
|
284
284
|
call({ ...params, connectId, deviceId, method: 'lnurlAuth' }),
|
|
285
|
-
|
|
286
|
-
nervosGetAddress: (connectId, deviceId, params) =>
|
|
287
|
-
call({ ...params, connectId, deviceId, method: 'nervosGetAddress' }),
|
|
288
|
-
nervosSignTransaction: (connectId, deviceId, params) =>
|
|
289
|
-
call({ ...params, connectId, deviceId, method: 'nervosSignTransaction' }),
|
|
290
285
|
});
|
package/src/types/api/export.ts
CHANGED
|
@@ -146,6 +146,3 @@ export type {
|
|
|
146
146
|
NexaSignInputParams,
|
|
147
147
|
NexaSignOutputParams,
|
|
148
148
|
} from './nexaSignTransaction';
|
|
149
|
-
|
|
150
|
-
export type { NervosAddress, NervosGetAddressParams } from './nervosGetAddress';
|
|
151
|
-
export type { NervosSignedTx, NervosSignTransactionParams } from './nervosSignTransaction';
|
package/src/types/api/index.ts
CHANGED
|
@@ -119,8 +119,6 @@ import { nostrDecryptMessage } from './nostrDecryptMessage';
|
|
|
119
119
|
import { nostrSignSchnorr } from './nostrSignSchnorr';
|
|
120
120
|
|
|
121
121
|
import { lnurlAuth } from './lnurlAuth';
|
|
122
|
-
import { nervosGetAddress } from './nervosGetAddress';
|
|
123
|
-
import { nervosSignTransaction } from './nervosSignTransaction';
|
|
124
122
|
|
|
125
123
|
export * from './export';
|
|
126
124
|
|
|
@@ -325,10 +323,4 @@ export type CoreApi = {
|
|
|
325
323
|
* Lightning Network
|
|
326
324
|
*/
|
|
327
325
|
lnurlAuth: typeof lnurlAuth;
|
|
328
|
-
|
|
329
|
-
/**
|
|
330
|
-
* Nervos Network
|
|
331
|
-
*/
|
|
332
|
-
nervosGetAddress: typeof nervosGetAddress;
|
|
333
|
-
nervosSignTransaction: typeof nervosSignTransaction;
|
|
334
326
|
};
|
package/src/types/settings.ts
CHANGED
|
@@ -66,7 +66,7 @@ export type DeviceTypeMap = {
|
|
|
66
66
|
[k in IDeviceType]: {
|
|
67
67
|
firmware: IFirmwareReleaseInfo[];
|
|
68
68
|
'firmware-v2'?: IFirmwareReleaseInfo[];
|
|
69
|
-
'firmware-
|
|
69
|
+
'firmware-v5'?: IFirmwareReleaseInfo[];
|
|
70
70
|
ble: IBLEFirmwareReleaseInfo[];
|
|
71
71
|
};
|
|
72
72
|
};
|
|
@@ -57,6 +57,7 @@ export const getDeviceType = (features?: Features): IDeviceType => {
|
|
|
57
57
|
const miniFlag = serialNo.slice(0, 2);
|
|
58
58
|
if (miniFlag.toLowerCase() === 'mi') return 'mini';
|
|
59
59
|
if (miniFlag.toLowerCase() === 'tc') return 'touch';
|
|
60
|
+
if (miniFlag.toLowerCase() === 'pr') return 'pro';
|
|
60
61
|
return 'classic';
|
|
61
62
|
};
|
|
62
63
|
|
|
@@ -85,7 +86,7 @@ export const getDeviceTypeByDeviceId = (deviceId?: string): IDeviceType => {
|
|
|
85
86
|
export const getDeviceUUID = (features: Features) => {
|
|
86
87
|
const deviceType = getDeviceType(features);
|
|
87
88
|
|
|
88
|
-
if (features
|
|
89
|
+
if (features.onekey_serial_no) return features.onekey_serial_no;
|
|
89
90
|
|
|
90
91
|
if (deviceType === 'classic') {
|
|
91
92
|
return features.onekey_serial ?? '';
|
|
@@ -290,18 +291,21 @@ export const getFirmwareUpdateField = ({
|
|
|
290
291
|
}
|
|
291
292
|
|
|
292
293
|
if (DeviceModelToTypes.model_mini.includes(deviceType)) {
|
|
293
|
-
return 'firmware-
|
|
294
|
+
return 'firmware-v5';
|
|
294
295
|
}
|
|
295
296
|
|
|
296
297
|
if (deviceType === 'touch') {
|
|
297
298
|
if (targetVersion) {
|
|
298
299
|
if (semver.eq(targetVersion, '4.0.0')) return 'firmware-v2';
|
|
299
|
-
if (semver.gt(targetVersion, '4.0.0')) return 'firmware-
|
|
300
|
+
if (semver.gt(targetVersion, '4.0.0')) return 'firmware-v5';
|
|
300
301
|
}
|
|
301
302
|
|
|
302
303
|
if (semver.lt(deviceFirmwareVersion.join('.'), '3.4.0')) return 'firmware';
|
|
303
304
|
|
|
304
|
-
return 'firmware-
|
|
305
|
+
return 'firmware-v5';
|
|
306
|
+
}
|
|
307
|
+
if (deviceType === 'pro') {
|
|
308
|
+
return 'firmware-v5';
|
|
305
309
|
}
|
|
306
310
|
return 'firmware';
|
|
307
311
|
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare function getBitcoinForkVersionRange(params: (string | undefined)[]): {
|
|
2
|
-
model_mini: {
|
|
3
|
-
min: string;
|
|
4
|
-
};
|
|
5
|
-
model_touch: {
|
|
6
|
-
min: string;
|
|
7
|
-
};
|
|
8
|
-
} | {
|
|
9
|
-
model_mini?: undefined;
|
|
10
|
-
model_touch?: undefined;
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=versionLimit.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"versionLimit.d.ts","sourceRoot":"","sources":["../../../../src/api/btc/helpers/versionLimit.ts"],"names":[],"mappings":"AAUA,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE;;;;;;;;;;EAcxE"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { NervosGetAddress as HardwareNervosGetAddress } from '@onekeyfe/hd-transport';
|
|
2
|
-
import { BaseMethod } from '../BaseMethod';
|
|
3
|
-
import type { NervosAddress } from '../../types';
|
|
4
|
-
export default class NervosGetAddress extends BaseMethod<HardwareNervosGetAddress[]> {
|
|
5
|
-
hasBundle: boolean;
|
|
6
|
-
init(): void;
|
|
7
|
-
getVersionRange(): {
|
|
8
|
-
model_mini: {
|
|
9
|
-
min: string;
|
|
10
|
-
};
|
|
11
|
-
model_touch: {
|
|
12
|
-
min: string;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
run(): Promise<NervosAddress | NervosAddress[]>;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=NervosGetAddress.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NervosGetAddress.d.ts","sourceRoot":"","sources":["../../../src/api/nervos/NervosGetAddress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,IAAI,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAG3F,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,OAAO,KAAK,EAA0B,aAAa,EAAE,MAAM,aAAa,CAAC;AAEzE,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,UAAU,CAAC,wBAAwB,EAAE,CAAC;IAClF,SAAS,UAAS;IAElB,IAAI;IA+BJ,eAAe;;;;;;;;IAWT,GAAG;CAsBV"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import type { NervosSignTx as HardwareNervosSignTx, TypedCall } from '@onekeyfe/hd-transport';
|
|
3
|
-
import { BaseMethod } from '../BaseMethod';
|
|
4
|
-
import type { NervosSignedTx } from '../../types';
|
|
5
|
-
import type { TypedResponseMessage } from '../../device/DeviceCommands';
|
|
6
|
-
type NervosSignTx = Omit<HardwareNervosSignTx, 'data_initial_chunk' | 'data_length'> & {
|
|
7
|
-
raw_tx: Buffer;
|
|
8
|
-
};
|
|
9
|
-
export default class NervosSignTransaction extends BaseMethod<NervosSignTx> {
|
|
10
|
-
hasBundle: boolean;
|
|
11
|
-
init(): void;
|
|
12
|
-
getVersionRange(): {
|
|
13
|
-
model_mini: {
|
|
14
|
-
min: string;
|
|
15
|
-
};
|
|
16
|
-
model_touch: {
|
|
17
|
-
min: string;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
chunkByteSize: number;
|
|
21
|
-
processTxRequest: (typedCall: TypedCall, res: TypedResponseMessage<'NervosSignedTx'> | TypedResponseMessage<'NervosTxRequest'>, data: Buffer, offset?: number) => Promise<NervosSignedTx>;
|
|
22
|
-
run(): Promise<NervosSignedTx>;
|
|
23
|
-
}
|
|
24
|
-
export {};
|
|
25
|
-
//# sourceMappingURL=NervosSignTransaction.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NervosSignTransaction.d.ts","sourceRoot":"","sources":["../../../src/api/nervos/NervosSignTransaction.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,YAAY,IAAI,oBAAoB,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAE9F,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,KAAK,EAA+B,cAAc,EAAE,MAAM,aAAa,CAAC;AAE/E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAExE,KAAK,YAAY,GAAG,IAAI,CAAC,oBAAoB,EAAE,oBAAoB,GAAG,aAAa,CAAC,GAAG;IACrF,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,UAAU,CAAC,YAAY,CAAC;IACzE,SAAS,UAAS;IAElB,IAAI;IAwBJ,eAAe;;;;;;;;IAWf,aAAa,SAAQ;IAErB,gBAAgB,cACH,SAAS,OACf,qBAAqB,gBAAgB,CAAC,GAAG,qBAAqB,iBAAiB,CAAC,QAC/E,MAAM,sBAEX,QAAQ,cAAc,CAAC,CAoCxB;IAEI,GAAG;CAiBV"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { NervosAddress as HardwareNervosAddress } from '@onekeyfe/hd-transport';
|
|
2
|
-
import type { CommonParams, Response } from '../params';
|
|
3
|
-
export type NervosAddress = {
|
|
4
|
-
path: string;
|
|
5
|
-
} & HardwareNervosAddress;
|
|
6
|
-
export type NervosGetAddressParams = {
|
|
7
|
-
path: string | number[];
|
|
8
|
-
network: string;
|
|
9
|
-
showOnOneKey?: boolean;
|
|
10
|
-
};
|
|
11
|
-
export declare function nervosGetAddress(connectId: string, deviceId: string, params: CommonParams & NervosGetAddressParams): Response<NervosAddress>;
|
|
12
|
-
export declare function nervosGetAddress(connectId: string, deviceId: string, params: CommonParams & {
|
|
13
|
-
bundle?: NervosGetAddressParams[];
|
|
14
|
-
}): Response<Array<NervosAddress>>;
|
|
15
|
-
//# sourceMappingURL=nervosGetAddress.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nervosGetAddress.d.ts","sourceRoot":"","sources":["../../../src/types/api/nervosGetAddress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,IAAI,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AACrF,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,qBAAqB,CAAC;AAE1B,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,YAAY,GAAG,sBAAsB,GAC5C,QAAQ,CAAC,aAAa,CAAC,CAAC;AAE3B,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,YAAY,GAAG;IAAE,MAAM,CAAC,EAAE,sBAAsB,EAAE,CAAA;CAAE,GAC3D,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { NervosSignedTx as HardwareNervosSignedTx } from '@onekeyfe/hd-transport';
|
|
2
|
-
import type { CommonParams, Response } from '../params';
|
|
3
|
-
export type NervosSignedTx = {
|
|
4
|
-
path: string;
|
|
5
|
-
} & HardwareNervosSignedTx;
|
|
6
|
-
export type NervosSignTransactionParams = {
|
|
7
|
-
path: string | number[];
|
|
8
|
-
network: string;
|
|
9
|
-
rawTx: string;
|
|
10
|
-
witnessHex: string;
|
|
11
|
-
};
|
|
12
|
-
export declare function nervosSignTransaction(connectId: string, deviceId: string, params: CommonParams & NervosSignTransactionParams): Response<NervosSignedTx>;
|
|
13
|
-
//# sourceMappingURL=nervosSignTransaction.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nervosSignTransaction.d.ts","sourceRoot":"","sources":["../../../src/types/api/nervosSignTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,IAAI,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AACvF,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,sBAAsB,CAAC;AAE3B,MAAM,MAAM,2BAA2B,GAAG;IACxC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAC3C,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,YAAY,GAAG,2BAA2B,GACjD,QAAQ,CAAC,cAAc,CAAC,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
function isCoinNameInList(coinName: string, coinNames: (string | undefined)[]) {
|
|
2
|
-
for (let i = 0; i < coinNames.length; i++) {
|
|
3
|
-
const coin_name = coinNames[i];
|
|
4
|
-
if (coin_name?.toLowerCase() === coinName?.toLowerCase()) {
|
|
5
|
-
return true;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
return false;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function getBitcoinForkVersionRange(params: (string | undefined)[]) {
|
|
12
|
-
if (isCoinNameInList('Neurai', params)) {
|
|
13
|
-
return {
|
|
14
|
-
model_mini: {
|
|
15
|
-
min: '3.7.0',
|
|
16
|
-
},
|
|
17
|
-
model_touch: {
|
|
18
|
-
min: '4.9.0',
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// No version restrictions for other coins
|
|
24
|
-
return {};
|
|
25
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import type { NervosGetAddress as HardwareNervosGetAddress } from '@onekeyfe/hd-transport';
|
|
2
|
-
import { UI_REQUEST } from '../../constants/ui-request';
|
|
3
|
-
import { serializedPath, validatePath } from '../helpers/pathUtils';
|
|
4
|
-
import { BaseMethod } from '../BaseMethod';
|
|
5
|
-
import { validateParams } from '../helpers/paramsValidator';
|
|
6
|
-
|
|
7
|
-
import type { NervosGetAddressParams, NervosAddress } from '../../types';
|
|
8
|
-
|
|
9
|
-
export default class NervosGetAddress extends BaseMethod<HardwareNervosGetAddress[]> {
|
|
10
|
-
hasBundle = false;
|
|
11
|
-
|
|
12
|
-
init() {
|
|
13
|
-
this.checkDeviceId = true;
|
|
14
|
-
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
15
|
-
|
|
16
|
-
this.hasBundle = !!this.payload?.bundle;
|
|
17
|
-
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
18
|
-
|
|
19
|
-
// check payload
|
|
20
|
-
validateParams(payload, [{ name: 'bundle', type: 'array' }]);
|
|
21
|
-
|
|
22
|
-
// init params
|
|
23
|
-
this.params = [];
|
|
24
|
-
payload.bundle.forEach((batch: NervosGetAddressParams) => {
|
|
25
|
-
const addressN = validatePath(batch.path, 3);
|
|
26
|
-
|
|
27
|
-
validateParams(batch, [
|
|
28
|
-
{ name: 'path', required: true },
|
|
29
|
-
{ name: 'showOnOneKey', type: 'boolean' },
|
|
30
|
-
{ name: 'network', type: 'string' },
|
|
31
|
-
]);
|
|
32
|
-
|
|
33
|
-
const showOnOneKey = batch.showOnOneKey ?? true;
|
|
34
|
-
|
|
35
|
-
this.params.push({
|
|
36
|
-
address_n: addressN,
|
|
37
|
-
show_display: showOnOneKey,
|
|
38
|
-
network: batch.network,
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
getVersionRange() {
|
|
44
|
-
return {
|
|
45
|
-
model_mini: {
|
|
46
|
-
min: '3.7.0',
|
|
47
|
-
},
|
|
48
|
-
model_touch: {
|
|
49
|
-
min: '4.9.0',
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
async run() {
|
|
55
|
-
const responses: NervosAddress[] = [];
|
|
56
|
-
|
|
57
|
-
for (let i = 0; i < this.params.length; i++) {
|
|
58
|
-
const param = this.params[i];
|
|
59
|
-
|
|
60
|
-
const res = await this.device.commands.typedCall('NervosGetAddress', 'NervosAddress', {
|
|
61
|
-
...param,
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
const { address } = res.message;
|
|
65
|
-
|
|
66
|
-
const result = {
|
|
67
|
-
path: serializedPath(param.address_n),
|
|
68
|
-
address,
|
|
69
|
-
};
|
|
70
|
-
responses.push(result);
|
|
71
|
-
this.postPreviousAddressMessage(result);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return Promise.resolve(this.hasBundle ? responses : responses[0]);
|
|
75
|
-
}
|
|
76
|
-
}
|