@onekeyfe/hwk-keystone-adapter 1.2.3-alpha.2 → 1.2.3-alpha.4
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/index.js +14 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1401,7 +1401,9 @@ var KeystoneAdapter = class _KeystoneAdapter {
|
|
|
1401
1401
|
if (!params) return (0, import_hwk_adapter_core3.failure)(import_hwk_adapter_core3.HardwareErrorCode.InvalidParams, "btcSignPsbt requires params");
|
|
1402
1402
|
if (!params.psbt)
|
|
1403
1403
|
return (0, import_hwk_adapter_core3.failure)(import_hwk_adapter_core3.HardwareErrorCode.InvalidParams, "btcSignPsbt requires params.psbt");
|
|
1404
|
-
if (
|
|
1404
|
+
if (!params.path)
|
|
1405
|
+
return (0, import_hwk_adapter_core3.failure)(import_hwk_adapter_core3.HardwareErrorCode.InvalidParams, "btcSignPsbt requires params.path");
|
|
1406
|
+
if (!isKeystoneSignableBtcAccountPath(splitAccountPath(params.path).accountPath)) {
|
|
1405
1407
|
return (0, import_hwk_adapter_core3.failure)(import_hwk_adapter_core3.HardwareErrorCode.DevicePathForbidden, KEYSTONE_BTC_ACCOUNT_FORBIDDEN_MESSAGE);
|
|
1406
1408
|
}
|
|
1407
1409
|
try {
|
|
@@ -1599,10 +1601,11 @@ var KeystoneAdapter = class _KeystoneAdapter {
|
|
|
1599
1601
|
}
|
|
1600
1602
|
// ---------------------------------------------------------------------------
|
|
1601
1603
|
// TRON — routed through `TronSignRequest`/`TronSignature` (see
|
|
1602
|
-
// urEngine/TronSignRequest.ts),
|
|
1603
|
-
//
|
|
1604
|
-
//
|
|
1605
|
-
// unverified response
|
|
1604
|
+
// urEngine/TronSignRequest.ts), whose key layout follows keystone-sdk-rust
|
|
1605
|
+
// (tags 5201/5202, firmware >= 2.5.0). The OneKey Pro air-gap encoding under
|
|
1606
|
+
// the same tag is a different layout the firmware rejects. Not keystone-sdk's
|
|
1607
|
+
// bundled `sdk.tron` module either (protobuf-based, unverified response
|
|
1608
|
+
// semantics).
|
|
1606
1609
|
// ---------------------------------------------------------------------------
|
|
1607
1610
|
async tronGetAddress(connectIdArg, deviceIdArg, paramsArg, book) {
|
|
1608
1611
|
const operationTarget = resolveHardwareOperationTarget(connectIdArg, paramsArg?.operationId);
|
|
@@ -1791,14 +1794,17 @@ var KeystoneAdapter = class _KeystoneAdapter {
|
|
|
1791
1794
|
if (!requestedByKey.size) {
|
|
1792
1795
|
return { book };
|
|
1793
1796
|
}
|
|
1794
|
-
|
|
1797
|
+
const operation = (0, import_hwk_adapter_core3.isHardwareOperationId)(params.operationId) ? this._operations.find(params.operationId) : void 0;
|
|
1798
|
+
const operationRoute = operation ? this._operationRoutes.get(operation.connectId) : void 0;
|
|
1799
|
+
const routedToQr = operationRoute?.operationId === operation?.operationId && operationRoute?.connectionType === "qr";
|
|
1800
|
+
if (this._forcedTransport !== "qr" && !routedToQr && !record?.usbSessionId && this._usbConnector && target.expectedWalletId) {
|
|
1795
1801
|
record = await this._tryUsbAttach(
|
|
1796
1802
|
target.expectedWalletId,
|
|
1797
1803
|
record?.masterFingerprint ?? target.expectedMasterFingerprint
|
|
1798
1804
|
) ?? record;
|
|
1799
1805
|
_KeystoneAdapter._throwIfAborted(signal);
|
|
1800
1806
|
}
|
|
1801
|
-
if (this._forcedTransport !== "qr" && record?.usbSessionId) {
|
|
1807
|
+
if (this._forcedTransport !== "qr" && !routedToQr && record?.usbSessionId) {
|
|
1802
1808
|
const bundleSessionId = record.usbSessionId;
|
|
1803
1809
|
const assertBundleSession = () => {
|
|
1804
1810
|
if (record?.usbSessionId !== bundleSessionId) {
|
|
@@ -2519,7 +2525,7 @@ var KeystoneAdapter = class _KeystoneAdapter {
|
|
|
2519
2525
|
_errorToFailure(err) {
|
|
2520
2526
|
if (err && typeof err === "object") {
|
|
2521
2527
|
const e = err;
|
|
2522
|
-
if (typeof e.code === "number") {
|
|
2528
|
+
if (typeof e.code === "number" && e.code >= 1e4 && e.code <= 99999) {
|
|
2523
2529
|
const { origin } = e;
|
|
2524
2530
|
return (0, import_hwk_adapter_core3.failure)(
|
|
2525
2531
|
e.code,
|