@onekeyfe/hd-core 1.0.39-alpha.9 → 1.1.1-alpha.0
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/cardano/CardanoSignMessage.d.ts +5 -0
- package/dist/api/cardano/CardanoSignMessage.d.ts.map +1 -1
- package/dist/api/tron/TronSignTransaction.d.ts +2 -0
- package/dist/api/tron/TronSignTransaction.d.ts.map +1 -1
- package/dist/events/ui-request.d.ts +2 -1
- package/dist/events/ui-request.d.ts.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +37 -4
- package/dist/types/api/cardanoSignMessage.d.ts +3 -0
- package/dist/types/api/cardanoSignMessage.d.ts.map +1 -1
- package/dist/types/api/tronSignTransaction.d.ts +1 -0
- package/dist/types/api/tronSignTransaction.d.ts.map +1 -1
- package/dist/utils/capabilitieUtils.d.ts +5 -0
- package/dist/utils/capabilitieUtils.d.ts.map +1 -0
- package/dist/utils/deviceInfoUtils.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/api/cardano/CardanoSignMessage.ts +15 -0
- package/src/api/tron/TronSignTransaction.ts +21 -0
- package/src/core/index.ts +1 -1
- package/src/data/messages/messages.json +4 -0
- package/src/events/ui-request.ts +2 -0
- package/src/types/api/cardanoSignMessage.ts +3 -0
- package/src/types/api/tronSignTransaction.ts +1 -0
- package/src/utils/capabilitieUtils.ts +12 -0
- package/src/utils/deviceInfoUtils.ts +4 -2
|
@@ -9,6 +9,11 @@ export default class CardanoSignMessage extends BaseMethod<CardanoSignMessagePar
|
|
|
9
9
|
min: string;
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
|
+
getAddressTypeVersionRange(): {
|
|
13
|
+
pro: {
|
|
14
|
+
min: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
12
17
|
run(): Promise<import("packages/hd-transport/dist").CardanoMessageSignature>;
|
|
13
18
|
}
|
|
14
19
|
//# sourceMappingURL=CardanoSignMessage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardanoSignMessage.d.ts","sourceRoot":"","sources":["../../../src/api/cardano/CardanoSignMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAK3C,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAE9E,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,UAAU,CAAC,wBAAwB,CAAC;IAClF,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,IAAI;
|
|
1
|
+
{"version":3,"file":"CardanoSignMessage.d.ts","sourceRoot":"","sources":["../../../src/api/cardano/CardanoSignMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAK3C,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAE9E,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,UAAU,CAAC,wBAAwB,CAAC;IAClF,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,IAAI;IA2BJ,eAAe;;;;;IAQf,0BAA0B;;;;;IAQpB,GAAG;CAcV"}
|
|
@@ -12,6 +12,8 @@ export default class TronSignTransaction extends BaseMethod<TronSignTx> {
|
|
|
12
12
|
};
|
|
13
13
|
getFixDataTypeVersionRange(): DeviceFirmwareRange;
|
|
14
14
|
checkFixDataTypeSupportVoteWitnessError(): void;
|
|
15
|
+
supportDelegateResourceLockPeriodVersionRange(): DeviceFirmwareRange;
|
|
16
|
+
checkSupportDelegateContractLockPeriod(): void;
|
|
15
17
|
run(): Promise<import("@onekeyfe/hd-transport").TronSignedTx>;
|
|
16
18
|
}
|
|
17
19
|
//# sourceMappingURL=TronSignTransaction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TronSignTransaction.d.ts","sourceRoot":"","sources":["../../../src/api/tron/TronSignTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAIpD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAEtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,UAAU,CAAC,UAAU,CAAC;IACrE,OAAO,CAAC,EAAE,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,UAAU;
|
|
1
|
+
{"version":3,"file":"TronSignTransaction.d.ts","sourceRoot":"","sources":["../../../src/api/tron/TronSignTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAIpD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAEtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,UAAU,CAAC,UAAU,CAAC;IACrE,OAAO,CAAC,EAAE,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,UAAU;IA6G7D,IAAI;IAyBJ,eAAe;;;;;IAQf,0BAA0B,IAAI,mBAAmB;IAWjD,uCAAuC;IASvC,6CAA6C,IAAI,mBAAmB;IAQpE,sCAAsC;IAWhC,GAAG;CAUV"}
|
|
@@ -11,6 +11,7 @@ export declare const UI_REQUEST: {
|
|
|
11
11
|
readonly REQUEST_PASSPHRASE_ON_DEVICE: "ui-request_passphrase_on_device";
|
|
12
12
|
readonly REQUEST_DEVICE_IN_BOOTLOADER_FOR_WEB_DEVICE: "ui-request_select_device_in_bootloader_for_web_device";
|
|
13
13
|
readonly CLOSE_UI_WINDOW: "ui-close_window";
|
|
14
|
+
readonly CLOSE_UI_PIN_WINDOW: "ui-close_pin_window";
|
|
14
15
|
readonly DEVICE_PROGRESS: "ui-device_progress";
|
|
15
16
|
readonly BLUETOOTH_PERMISSION: "ui-bluetooth_permission";
|
|
16
17
|
readonly BLUETOOTH_UNSUPPORTED: "ui-bluetooth_unsupported";
|
|
@@ -35,7 +36,7 @@ export declare const UI_REQUEST: {
|
|
|
35
36
|
readonly NOT_USE_ONEKEY_DEVICE: "ui-device_please_use_onekey_device";
|
|
36
37
|
};
|
|
37
38
|
export interface UiRequestWithoutPayload {
|
|
38
|
-
type: typeof UI_REQUEST.CLOSE_UI_WINDOW | typeof UI_REQUEST.BLUETOOTH_PERMISSION | typeof UI_REQUEST.BLUETOOTH_UNSUPPORTED | typeof UI_REQUEST.BLUETOOTH_POWERED_OFF | typeof UI_REQUEST.BLUETOOTH_CHARACTERISTIC_NOTIFY_CHANGE_FAILURE | typeof UI_REQUEST.LOCATION_PERMISSION | typeof UI_REQUEST.LOCATION_SERVICE_PERMISSION | typeof UI_REQUEST.FIRMWARE_PROCESSING | typeof UI_REQUEST.WEB_DEVICE_PROMPT_ACCESS_PERMISSION;
|
|
39
|
+
type: typeof UI_REQUEST.CLOSE_UI_WINDOW | typeof UI_REQUEST.CLOSE_UI_PIN_WINDOW | typeof UI_REQUEST.BLUETOOTH_PERMISSION | typeof UI_REQUEST.BLUETOOTH_UNSUPPORTED | typeof UI_REQUEST.BLUETOOTH_POWERED_OFF | typeof UI_REQUEST.BLUETOOTH_CHARACTERISTIC_NOTIFY_CHANGE_FAILURE | typeof UI_REQUEST.LOCATION_PERMISSION | typeof UI_REQUEST.LOCATION_SERVICE_PERMISSION | typeof UI_REQUEST.FIRMWARE_PROCESSING | typeof UI_REQUEST.WEB_DEVICE_PROMPT_ACCESS_PERMISSION;
|
|
39
40
|
payload?: typeof undefined;
|
|
40
41
|
}
|
|
41
42
|
export interface UiRequestFirmwareProgressing {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui-request.d.ts","sourceRoot":"","sources":["../../src/events/ui-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,eAAO,MAAM,QAAQ,aAAa,CAAC;AAEnC,eAAO,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"ui-request.d.ts","sourceRoot":"","sources":["../../src/events/ui-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,eAAO,MAAM,QAAQ,aAAa,CAAC;AAEnC,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwCb,CAAC;AAEX,MAAM,WAAW,uBAAuB;IACtC,IAAI,EACA,OAAO,UAAU,CAAC,eAAe,GACjC,OAAO,UAAU,CAAC,mBAAmB,GACrC,OAAO,UAAU,CAAC,oBAAoB,GACtC,OAAO,UAAU,CAAC,qBAAqB,GACvC,OAAO,UAAU,CAAC,qBAAqB,GACvC,OAAO,UAAU,CAAC,8CAA8C,GAChE,OAAO,UAAU,CAAC,mBAAmB,GACrC,OAAO,UAAU,CAAC,2BAA2B,GAC7C,OAAO,UAAU,CAAC,mBAAmB,GACrC,OAAO,UAAU,CAAC,mCAAmC,CAAC;IAC1D,OAAO,CAAC,EAAE,OAAO,SAAS,CAAC;CAC5B;AAED,MAAM,WAAW,4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,oCAAoC;IACnE,uBAAuB,4BAA4B;IACnD,0BAA0B,+BAA+B;IACzD,uCAAuC,4CAA4C;IAEnF,sBAAsB,2BAA2B;IACjD,qBAAqB,0BAA0B;IAC/C,oCAAoC,yCAAyC;IAC7E,eAAe,oBAAoB;IACnC,oBAAoB,yBAAyB;IAC7C,iBAAiB,sBAAsB;IACvC,kBAAkB,uBAAuB;IACzC,gBAAgB,qBAAqB;IACrC,uBAAuB,4BAA4B;IACnD,iBAAiB,sBAAsB;IACvC,wBAAwB,6BAA6B;IACrD,gBAAgB,qBAAqB;IACrC,uBAAuB,4BAA4B;CACpD;AAED,MAAM,MAAM,yBAAyB,GAAG,GAAG,wBAAwB,EAAE,CAAC;AAEtE,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG;IAAE,KAAK,EAAE,OAAO,QAAQ,CAAA;CAAE,CAAC;AAElE,eAAO,MAAM,eAAe,EAAE,gBAAgB,CAAC,OAAO,QAAQ,EAAE,OAAO,CAK5D,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1325,6 +1325,7 @@ type TronDelegateResourceContract = {
|
|
|
1325
1325
|
balance?: number;
|
|
1326
1326
|
receiverAddress?: string;
|
|
1327
1327
|
lock?: boolean;
|
|
1328
|
+
lockPeriod?: number;
|
|
1328
1329
|
};
|
|
1329
1330
|
type TronUnDelegateResourceContract = {
|
|
1330
1331
|
resource?: TronResourceCode;
|
|
@@ -1688,6 +1689,7 @@ type CardanoSignMessageMethodParams = {
|
|
|
1688
1689
|
message: string;
|
|
1689
1690
|
derivationType: number;
|
|
1690
1691
|
networkId: number;
|
|
1692
|
+
addressType?: Messages.CardanoAddressType;
|
|
1691
1693
|
};
|
|
1692
1694
|
declare function cardanoSignMessage(connectId: string, deviceId: string, params: CommonParams & CardanoSignMessageMethodParams): Response<CardanoMessageSignature>;
|
|
1693
1695
|
|
|
@@ -2474,6 +2476,7 @@ declare const UI_REQUEST: {
|
|
|
2474
2476
|
readonly REQUEST_PASSPHRASE_ON_DEVICE: "ui-request_passphrase_on_device";
|
|
2475
2477
|
readonly REQUEST_DEVICE_IN_BOOTLOADER_FOR_WEB_DEVICE: "ui-request_select_device_in_bootloader_for_web_device";
|
|
2476
2478
|
readonly CLOSE_UI_WINDOW: "ui-close_window";
|
|
2479
|
+
readonly CLOSE_UI_PIN_WINDOW: "ui-close_pin_window";
|
|
2477
2480
|
readonly DEVICE_PROGRESS: "ui-device_progress";
|
|
2478
2481
|
readonly BLUETOOTH_PERMISSION: "ui-bluetooth_permission";
|
|
2479
2482
|
readonly BLUETOOTH_UNSUPPORTED: "ui-bluetooth_unsupported";
|
|
@@ -2498,7 +2501,7 @@ declare const UI_REQUEST: {
|
|
|
2498
2501
|
readonly NOT_USE_ONEKEY_DEVICE: "ui-device_please_use_onekey_device";
|
|
2499
2502
|
};
|
|
2500
2503
|
interface UiRequestWithoutPayload {
|
|
2501
|
-
type: typeof UI_REQUEST.CLOSE_UI_WINDOW | typeof UI_REQUEST.BLUETOOTH_PERMISSION | typeof UI_REQUEST.BLUETOOTH_UNSUPPORTED | typeof UI_REQUEST.BLUETOOTH_POWERED_OFF | typeof UI_REQUEST.BLUETOOTH_CHARACTERISTIC_NOTIFY_CHANGE_FAILURE | typeof UI_REQUEST.LOCATION_PERMISSION | typeof UI_REQUEST.LOCATION_SERVICE_PERMISSION | typeof UI_REQUEST.FIRMWARE_PROCESSING | typeof UI_REQUEST.WEB_DEVICE_PROMPT_ACCESS_PERMISSION;
|
|
2504
|
+
type: typeof UI_REQUEST.CLOSE_UI_WINDOW | typeof UI_REQUEST.CLOSE_UI_PIN_WINDOW | typeof UI_REQUEST.BLUETOOTH_PERMISSION | typeof UI_REQUEST.BLUETOOTH_UNSUPPORTED | typeof UI_REQUEST.BLUETOOTH_POWERED_OFF | typeof UI_REQUEST.BLUETOOTH_CHARACTERISTIC_NOTIFY_CHANGE_FAILURE | typeof UI_REQUEST.LOCATION_PERMISSION | typeof UI_REQUEST.LOCATION_SERVICE_PERMISSION | typeof UI_REQUEST.FIRMWARE_PROCESSING | typeof UI_REQUEST.WEB_DEVICE_PROMPT_ACCESS_PERMISSION;
|
|
2502
2505
|
payload?: typeof undefined;
|
|
2503
2506
|
}
|
|
2504
2507
|
interface UiRequestFirmwareProgressing {
|
package/dist/index.js
CHANGED
|
@@ -6,11 +6,11 @@ var semver = require('semver');
|
|
|
6
6
|
var hdShared = require('@onekeyfe/hd-shared');
|
|
7
7
|
var axios = require('axios');
|
|
8
8
|
var lodash = require('lodash');
|
|
9
|
+
var hdTransport = require('@onekeyfe/hd-transport');
|
|
9
10
|
var ByteBuffer = require('bytebuffer');
|
|
10
11
|
var BigNumber = require('bignumber.js');
|
|
11
12
|
var utils = require('@noble/hashes/utils');
|
|
12
13
|
var blake2s = require('@noble/hashes/blake2s');
|
|
13
|
-
var hdTransport = require('@onekeyfe/hd-transport');
|
|
14
14
|
var sha256 = require('@noble/hashes/sha256');
|
|
15
15
|
var JSZip = require('jszip');
|
|
16
16
|
var sha3 = require('@noble/hashes/sha3');
|
|
@@ -1032,6 +1032,8 @@ const DeviceTypeToModels = {
|
|
|
1032
1032
|
[hdShared.EDeviceType.Unknown]: [],
|
|
1033
1033
|
};
|
|
1034
1034
|
|
|
1035
|
+
const existCapability = (features, capability) => { var _a; return (_a = features === null || features === void 0 ? void 0 : features.capabilities) === null || _a === void 0 ? void 0 : _a.includes(capability); };
|
|
1036
|
+
|
|
1035
1037
|
const getDeviceType = (features) => {
|
|
1036
1038
|
if (!features || typeof features !== 'object') {
|
|
1037
1039
|
return hdShared.EDeviceType.Unknown;
|
|
@@ -1139,14 +1141,15 @@ const getMethodVersionRange = (features, getVersionRange) => {
|
|
|
1139
1141
|
return versionRange;
|
|
1140
1142
|
};
|
|
1141
1143
|
const getFirmwareType = (features) => {
|
|
1144
|
+
var _a;
|
|
1142
1145
|
if (!features) {
|
|
1143
1146
|
return hdShared.EFirmwareType.Universal;
|
|
1144
1147
|
}
|
|
1145
1148
|
if (features.fw_vendor === 'OneKey Bitcoin-only') {
|
|
1146
1149
|
return hdShared.EFirmwareType.BitcoinOnly;
|
|
1147
1150
|
}
|
|
1148
|
-
return features.capabilities.length > 0 &&
|
|
1149
|
-
!features.
|
|
1151
|
+
return ((_a = features === null || features === void 0 ? void 0 : features.capabilities) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
|
|
1152
|
+
!existCapability(features, hdTransport.Enum_Capability.Capability_Bitcoin_like)
|
|
1150
1153
|
? hdShared.EFirmwareType.BitcoinOnly
|
|
1151
1154
|
: hdShared.EFirmwareType.Universal;
|
|
1152
1155
|
};
|
|
@@ -12871,6 +12874,10 @@ var nested$1 = {
|
|
|
12871
12874
|
lock: {
|
|
12872
12875
|
type: "bool",
|
|
12873
12876
|
id: 5
|
|
12877
|
+
},
|
|
12878
|
+
lock_period: {
|
|
12879
|
+
type: "uint64",
|
|
12880
|
+
id: 6
|
|
12874
12881
|
}
|
|
12875
12882
|
}
|
|
12876
12883
|
},
|
|
@@ -25728,6 +25735,7 @@ const UI_REQUEST = {
|
|
|
25728
25735
|
REQUEST_PASSPHRASE_ON_DEVICE: 'ui-request_passphrase_on_device',
|
|
25729
25736
|
REQUEST_DEVICE_IN_BOOTLOADER_FOR_WEB_DEVICE: 'ui-request_select_device_in_bootloader_for_web_device',
|
|
25730
25737
|
CLOSE_UI_WINDOW: 'ui-close_window',
|
|
25738
|
+
CLOSE_UI_PIN_WINDOW: 'ui-close_pin_window',
|
|
25731
25739
|
DEVICE_PROGRESS: 'ui-device_progress',
|
|
25732
25740
|
BLUETOOTH_PERMISSION: 'ui-bluetooth_permission',
|
|
25733
25741
|
BLUETOOTH_UNSUPPORTED: 'ui-bluetooth_unsupported',
|
|
@@ -33471,6 +33479,7 @@ class TronSignTransaction extends BaseMethod {
|
|
|
33471
33479
|
balance: tx.contract.delegateResourceContract.balance,
|
|
33472
33480
|
receiver_address: tx.contract.delegateResourceContract.receiverAddress,
|
|
33473
33481
|
lock: tx.contract.delegateResourceContract.lock,
|
|
33482
|
+
lock_period: tx.contract.delegateResourceContract.lockPeriod,
|
|
33474
33483
|
},
|
|
33475
33484
|
};
|
|
33476
33485
|
}
|
|
@@ -33554,9 +33563,23 @@ class TronSignTransaction extends BaseMethod {
|
|
|
33554
33563
|
const { cancel_all_unfreeze_v2_contract, vote_witness_contract } = this.params.contract;
|
|
33555
33564
|
this.checkFeatureVersionLimit(() => !lodash.isEmpty(data) || !!cancel_all_unfreeze_v2_contract || !!vote_witness_contract, () => this.getFixDataTypeVersionRange());
|
|
33556
33565
|
}
|
|
33566
|
+
supportDelegateResourceLockPeriodVersionRange() {
|
|
33567
|
+
return {
|
|
33568
|
+
pro: {
|
|
33569
|
+
min: '4.15.0',
|
|
33570
|
+
},
|
|
33571
|
+
};
|
|
33572
|
+
}
|
|
33573
|
+
checkSupportDelegateContractLockPeriod() {
|
|
33574
|
+
const { delegate_resource_contract } = this.params.contract;
|
|
33575
|
+
this.checkFeatureVersionLimit(() => !!delegate_resource_contract &&
|
|
33576
|
+
delegate_resource_contract.lock_period !== undefined &&
|
|
33577
|
+
delegate_resource_contract.lock_period !== null, () => this.supportDelegateResourceLockPeriodVersionRange());
|
|
33578
|
+
}
|
|
33557
33579
|
run() {
|
|
33558
33580
|
return __awaiter(this, void 0, void 0, function* () {
|
|
33559
33581
|
this.checkFixDataTypeSupportVoteWitnessError();
|
|
33582
|
+
this.checkSupportDelegateContractLockPeriod();
|
|
33560
33583
|
const response = yield this.device.commands.typedCall('TronSignTx', 'TronSignedTx', Object.assign({}, this.params));
|
|
33561
33584
|
return Promise.resolve(response.message);
|
|
33562
33585
|
});
|
|
@@ -35568,6 +35591,7 @@ class CardanoSignMessage extends BaseMethod {
|
|
|
35568
35591
|
{ name: 'message', type: 'string', required: true },
|
|
35569
35592
|
{ name: 'derivationType', type: 'number' },
|
|
35570
35593
|
{ name: 'networkId', type: 'number', required: true },
|
|
35594
|
+
{ name: 'addressType', type: 'number' },
|
|
35571
35595
|
]);
|
|
35572
35596
|
const addressN = validatePath(payload.path, 3);
|
|
35573
35597
|
this.params = {
|
|
@@ -35577,6 +35601,7 @@ class CardanoSignMessage extends BaseMethod {
|
|
|
35577
35601
|
? payload.derivationType
|
|
35578
35602
|
: hdTransport.Messages.CardanoDerivationType.ICARUS,
|
|
35579
35603
|
network_id: payload.networkId,
|
|
35604
|
+
address_type: payload.addressType,
|
|
35580
35605
|
};
|
|
35581
35606
|
}
|
|
35582
35607
|
getVersionRange() {
|
|
@@ -35586,8 +35611,16 @@ class CardanoSignMessage extends BaseMethod {
|
|
|
35586
35611
|
},
|
|
35587
35612
|
};
|
|
35588
35613
|
}
|
|
35614
|
+
getAddressTypeVersionRange() {
|
|
35615
|
+
return {
|
|
35616
|
+
pro: {
|
|
35617
|
+
min: '4.9.3',
|
|
35618
|
+
},
|
|
35619
|
+
};
|
|
35620
|
+
}
|
|
35589
35621
|
run() {
|
|
35590
35622
|
return __awaiter(this, void 0, void 0, function* () {
|
|
35623
|
+
this.checkFeatureVersionLimit(() => this.params.address_type !== null && this.params.address_type !== undefined, () => this.getAddressTypeVersionRange());
|
|
35591
35624
|
const res = yield this.device.commands.typedCall('CardanoSignMessage', 'CardanoMessageSignature', this.params);
|
|
35592
35625
|
return res.message;
|
|
35593
35626
|
});
|
|
@@ -38585,7 +38618,7 @@ const onCallDevice = (context, message, method) => __awaiter(void 0, void 0, voi
|
|
|
38585
38618
|
DevicePool.clearDeviceCache(method.payload.connectId);
|
|
38586
38619
|
return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceCheckPassphraseStateError));
|
|
38587
38620
|
}
|
|
38588
|
-
postMessage(createUiMessage(UI_REQUEST.
|
|
38621
|
+
postMessage(createUiMessage(UI_REQUEST.CLOSE_UI_PIN_WINDOW));
|
|
38589
38622
|
}
|
|
38590
38623
|
try {
|
|
38591
38624
|
yield method.checkSafetyLevelOnTestNet();
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import type { CardanoMessageSignature } from '@onekeyfe/hd-transport';
|
|
2
2
|
import type { CommonParams, Response } from '../params';
|
|
3
|
+
import { PROTO } from '../../constants';
|
|
3
4
|
export type CardanoSignMessageParams = {
|
|
4
5
|
address_n: number[];
|
|
5
6
|
message: string;
|
|
6
7
|
derivation_type: number;
|
|
7
8
|
network_id: number;
|
|
9
|
+
address_type: number;
|
|
8
10
|
};
|
|
9
11
|
export type CardanoSignMessageMethodParams = {
|
|
10
12
|
path: string;
|
|
11
13
|
message: string;
|
|
12
14
|
derivationType: number;
|
|
13
15
|
networkId: number;
|
|
16
|
+
addressType?: PROTO.CardanoAddressType;
|
|
14
17
|
};
|
|
15
18
|
export declare function cardanoSignMessage(connectId: string, deviceId: string, params: CommonParams & CardanoSignMessageMethodParams): Response<CardanoMessageSignature>;
|
|
16
19
|
//# sourceMappingURL=cardanoSignMessage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cardanoSignMessage.d.ts","sourceRoot":"","sources":["../../../src/types/api/cardanoSignMessage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"cardanoSignMessage.d.ts","sourceRoot":"","sources":["../../../src/types/api/cardanoSignMessage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAExC,MAAM,MAAM,wBAAwB,GAAG;IACrC,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;C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AAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,WAAW,EAAE,eAAe,CAAC;CAC9B,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,mBAAmB,CACzC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,YAAY,GAAG,yBAAyB,GAC/C,QAAQ,CAAC,YAAY,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Enum_Capability } from '@onekeyfe/hd-transport';
|
|
2
|
+
import { Features } from '../types/device';
|
|
3
|
+
export declare const existCapability: (features: Features, capability: Enum_Capability) => boolean;
|
|
4
|
+
export declare const requireCapability: (features: Features, capability: Enum_Capability) => void;
|
|
5
|
+
//# sourceMappingURL=capabilitieUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilitieUtils.d.ts","sourceRoot":"","sources":["../../src/utils/capabilitieUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,eAAO,MAAM,eAAe,aAAc,QAAQ,cAAc,eAAe,YAEjC,CAAC;AAE/C,eAAO,MAAM,iBAAiB,aAAc,QAAQ,cAAc,eAAe,SAIhF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deviceInfoUtils.d.ts","sourceRoot":"","sources":["../../src/utils/deviceInfoUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,aAAa,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"deviceInfoUtils.d.ts","sourceRoot":"","sources":["../../src/utils/deviceInfoUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAIjE,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAMnF,eAAO,MAAM,aAAa,cAAe,QAAQ,KAAG,WAiDnD,CAAC;AAMF,eAAO,MAAM,sBAAsB,UAAW,MAAM,KAAG,WAYtD,CAAC;AAMF,eAAO,MAAM,gBAAgB,cAAe,QAAQ,KAAG,MAAM,GAAG,IAG/D,CAAC;AAKF,eAAO,MAAM,aAAa,aAAc,QAAQ,WAG/C,CAAC;AAKF,eAAO,MAAM,cAAc,cAAe,QAAQ,kBAkBjD,CAAC;AAMF,eAAO,MAAM,qBAAqB,aACtB,QAAQ,GAAG,SAAS,iCACC,WAAW,GAAG,YAAY,KAAK,aAAa,GAAG,SAAS,KACtF,aAAa,GAAG,SAwBlB,CAAC;AAEF,eAAO,MAAM,eAAe,aAAc,QAAQ,GAAG,SAAS,kBAY7D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1-alpha.0",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "OneKey",
|
|
6
6
|
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"url": "https://github.com/OneKeyHQ/hardware-js-sdk/issues"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@onekeyfe/hd-shared": "^1.
|
|
29
|
-
"@onekeyfe/hd-transport": "^1.
|
|
28
|
+
"@onekeyfe/hd-shared": "^1.1.1-alpha.0",
|
|
29
|
+
"@onekeyfe/hd-transport": "^1.1.1-alpha.0",
|
|
30
30
|
"axios": "^0.27.2",
|
|
31
31
|
"bignumber.js": "^9.0.2",
|
|
32
32
|
"bytebuffer": "^5.0.1",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"@types/web-bluetooth": "^0.0.21",
|
|
47
47
|
"ripple-keypairs": "^1.1.4"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "92d6391f8f61027fd1a31bed18240fcfa75357ab"
|
|
50
50
|
}
|
|
@@ -20,6 +20,7 @@ export default class CardanoSignMessage extends BaseMethod<CardanoSignMessagePar
|
|
|
20
20
|
{ name: 'message', type: 'string', required: true },
|
|
21
21
|
{ name: 'derivationType', type: 'number' },
|
|
22
22
|
{ name: 'networkId', type: 'number', required: true },
|
|
23
|
+
{ name: 'addressType', type: 'number' },
|
|
23
24
|
]);
|
|
24
25
|
|
|
25
26
|
const addressN = validatePath(payload.path, 3);
|
|
@@ -32,6 +33,7 @@ export default class CardanoSignMessage extends BaseMethod<CardanoSignMessagePar
|
|
|
32
33
|
? payload.derivationType
|
|
33
34
|
: PROTO.CardanoDerivationType.ICARUS,
|
|
34
35
|
network_id: payload.networkId,
|
|
36
|
+
address_type: payload.addressType,
|
|
35
37
|
};
|
|
36
38
|
}
|
|
37
39
|
|
|
@@ -43,7 +45,20 @@ export default class CardanoSignMessage extends BaseMethod<CardanoSignMessagePar
|
|
|
43
45
|
};
|
|
44
46
|
}
|
|
45
47
|
|
|
48
|
+
getAddressTypeVersionRange() {
|
|
49
|
+
return {
|
|
50
|
+
pro: {
|
|
51
|
+
min: '4.9.3',
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
46
56
|
async run() {
|
|
57
|
+
this.checkFeatureVersionLimit(
|
|
58
|
+
() => this.params.address_type !== null && this.params.address_type !== undefined,
|
|
59
|
+
() => this.getAddressTypeVersionRange()
|
|
60
|
+
);
|
|
61
|
+
|
|
47
62
|
const res = await this.device.commands.typedCall(
|
|
48
63
|
'CardanoSignMessage',
|
|
49
64
|
'CardanoMessageSignature',
|
|
@@ -67,6 +67,7 @@ export default class TronSignTransaction extends BaseMethod<TronSignTx> {
|
|
|
67
67
|
balance: tx.contract.delegateResourceContract.balance,
|
|
68
68
|
receiver_address: tx.contract.delegateResourceContract.receiverAddress,
|
|
69
69
|
lock: tx.contract.delegateResourceContract.lock,
|
|
70
|
+
lock_period: tx.contract.delegateResourceContract.lockPeriod,
|
|
70
71
|
},
|
|
71
72
|
};
|
|
72
73
|
}
|
|
@@ -170,8 +171,28 @@ export default class TronSignTransaction extends BaseMethod<TronSignTx> {
|
|
|
170
171
|
);
|
|
171
172
|
}
|
|
172
173
|
|
|
174
|
+
supportDelegateResourceLockPeriodVersionRange(): DeviceFirmwareRange {
|
|
175
|
+
return {
|
|
176
|
+
pro: {
|
|
177
|
+
min: '4.15.0',
|
|
178
|
+
},
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
checkSupportDelegateContractLockPeriod() {
|
|
183
|
+
const { delegate_resource_contract } = this.params.contract;
|
|
184
|
+
this.checkFeatureVersionLimit(
|
|
185
|
+
() =>
|
|
186
|
+
!!delegate_resource_contract &&
|
|
187
|
+
delegate_resource_contract.lock_period !== undefined &&
|
|
188
|
+
delegate_resource_contract.lock_period !== null,
|
|
189
|
+
() => this.supportDelegateResourceLockPeriodVersionRange()
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
|
|
173
193
|
async run() {
|
|
174
194
|
this.checkFixDataTypeSupportVoteWitnessError();
|
|
195
|
+
this.checkSupportDelegateContractLockPeriod();
|
|
175
196
|
|
|
176
197
|
const response = await this.device.commands.typedCall('TronSignTx', 'TronSignedTx', {
|
|
177
198
|
...this.params,
|
package/src/core/index.ts
CHANGED
|
@@ -358,7 +358,7 @@ const onCallDevice = async (
|
|
|
358
358
|
}
|
|
359
359
|
|
|
360
360
|
// close pin popup window
|
|
361
|
-
postMessage(createUiMessage(UI_REQUEST.
|
|
361
|
+
postMessage(createUiMessage(UI_REQUEST.CLOSE_UI_PIN_WINDOW));
|
|
362
362
|
}
|
|
363
363
|
|
|
364
364
|
// Automatic check safety_check level for Kovan, Ropsten, Rinkeby, Goerli test networks.
|
|
@@ -11509,6 +11509,10 @@
|
|
|
11509
11509
|
"lock": {
|
|
11510
11510
|
"type": "bool",
|
|
11511
11511
|
"id": 5
|
|
11512
|
+
},
|
|
11513
|
+
"lock_period": {
|
|
11514
|
+
"type": "uint64",
|
|
11515
|
+
"id": 6
|
|
11512
11516
|
}
|
|
11513
11517
|
}
|
|
11514
11518
|
},
|
package/src/events/ui-request.ts
CHANGED
|
@@ -15,6 +15,7 @@ export const UI_REQUEST = {
|
|
|
15
15
|
'ui-request_select_device_in_bootloader_for_web_device',
|
|
16
16
|
|
|
17
17
|
CLOSE_UI_WINDOW: 'ui-close_window',
|
|
18
|
+
CLOSE_UI_PIN_WINDOW: 'ui-close_pin_window',
|
|
18
19
|
DEVICE_PROGRESS: 'ui-device_progress',
|
|
19
20
|
|
|
20
21
|
BLUETOOTH_PERMISSION: 'ui-bluetooth_permission',
|
|
@@ -49,6 +50,7 @@ export const UI_REQUEST = {
|
|
|
49
50
|
export interface UiRequestWithoutPayload {
|
|
50
51
|
type:
|
|
51
52
|
| typeof UI_REQUEST.CLOSE_UI_WINDOW
|
|
53
|
+
| typeof UI_REQUEST.CLOSE_UI_PIN_WINDOW
|
|
52
54
|
| typeof UI_REQUEST.BLUETOOTH_PERMISSION
|
|
53
55
|
| typeof UI_REQUEST.BLUETOOTH_UNSUPPORTED
|
|
54
56
|
| typeof UI_REQUEST.BLUETOOTH_POWERED_OFF
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { CardanoMessageSignature } from '@onekeyfe/hd-transport';
|
|
2
2
|
import type { CommonParams, Response } from '../params';
|
|
3
|
+
import { PROTO } from '../../constants';
|
|
3
4
|
|
|
4
5
|
export type CardanoSignMessageParams = {
|
|
5
6
|
address_n: number[];
|
|
6
7
|
message: string;
|
|
7
8
|
derivation_type: number;
|
|
8
9
|
network_id: number;
|
|
10
|
+
address_type: number;
|
|
9
11
|
};
|
|
10
12
|
|
|
11
13
|
export type CardanoSignMessageMethodParams = {
|
|
@@ -13,6 +15,7 @@ export type CardanoSignMessageMethodParams = {
|
|
|
13
15
|
message: string;
|
|
14
16
|
derivationType: number;
|
|
15
17
|
networkId: number;
|
|
18
|
+
addressType?: PROTO.CardanoAddressType;
|
|
16
19
|
};
|
|
17
20
|
|
|
18
21
|
export declare function cardanoSignMessage(
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Enum_Capability } from '@onekeyfe/hd-transport';
|
|
2
|
+
import { Features } from '../types/device';
|
|
3
|
+
|
|
4
|
+
export const existCapability = (features: Features, capability: Enum_Capability) =>
|
|
5
|
+
// @ts-expect-error
|
|
6
|
+
features?.capabilities?.includes(capability);
|
|
7
|
+
|
|
8
|
+
export const requireCapability = (features: Features, capability: Enum_Capability) => {
|
|
9
|
+
if (!existCapability(features, capability)) {
|
|
10
|
+
throw new Error(`Capability ${capability} is required`);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { isEmpty } from 'lodash';
|
|
2
2
|
import { EDeviceType, EFirmwareType } from '@onekeyfe/hd-shared';
|
|
3
|
+
import { Enum_Capability } from '@onekeyfe/hd-transport';
|
|
3
4
|
import { DeviceModelToTypes } from '../types';
|
|
4
5
|
|
|
5
6
|
import type { Features, IDeviceModel, IDeviceType, IVersionRange } from '../types';
|
|
7
|
+
import { existCapability } from './capabilitieUtils';
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
10
|
* get device type by features
|
|
@@ -157,8 +159,8 @@ export const getFirmwareType = (features: Features | undefined) => {
|
|
|
157
159
|
return EFirmwareType.BitcoinOnly;
|
|
158
160
|
}
|
|
159
161
|
// old firmware
|
|
160
|
-
return features
|
|
161
|
-
!features.
|
|
162
|
+
return features?.capabilities?.length > 0 &&
|
|
163
|
+
!existCapability(features, Enum_Capability.Capability_Bitcoin_like)
|
|
162
164
|
? EFirmwareType.BitcoinOnly
|
|
163
165
|
: EFirmwareType.Universal;
|
|
164
166
|
};
|