@onekeyfe/hwk-adapter-core 1.2.10 → 1.2.11-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-Z574MVAT.mjs → chunk-5AIX6YY5.mjs} +2 -2
- package/dist/{chunk-UFNTICCX.js → chunk-EJIHCWWH.js} +9 -2
- package/dist/chunk-EJIHCWWH.js.map +1 -0
- package/dist/{chunk-P7RDL34T.js → chunk-MVP46CIZ.js} +3 -3
- package/dist/{chunk-P7RDL34T.js.map → chunk-MVP46CIZ.js.map} +1 -1
- package/dist/{chunk-V2OHL2JS.mjs → chunk-VKP46GTC.mjs} +8 -1
- package/dist/chunk-VKP46GTC.mjs.map +1 -0
- package/dist/{errors-DednD9bG.d.mts → errors-Cl6Q5lqG.d.mts} +10 -8
- package/dist/{errors-DednD9bG.d.ts → errors-Cl6Q5lqG.d.ts} +10 -8
- package/dist/errors.d.mts +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/errors.js +2 -2
- package/dist/errors.mjs +1 -1
- package/dist/index.d.mts +9 -3
- package/dist/index.d.ts +9 -3
- package/dist/index.js +57 -32
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -2
- package/dist/index.mjs.map +1 -1
- package/dist/ui-events.js +3 -3
- package/dist/ui-events.mjs +2 -2
- package/package.json +2 -2
- package/dist/chunk-UFNTICCX.js.map +0 -1
- package/dist/chunk-V2OHL2JS.mjs.map +0 -1
- /package/dist/{chunk-Z574MVAT.mjs.map → chunk-5AIX6YY5.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -10,16 +10,17 @@ import {
|
|
|
10
10
|
UI_REQUEST_TIMEOUT_TAG,
|
|
11
11
|
UI_RESPONSE,
|
|
12
12
|
UiRequestRegistry
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-5AIX6YY5.mjs";
|
|
14
14
|
import {
|
|
15
15
|
HardwareErrorCode,
|
|
16
16
|
ORPHAN_ELIGIBLE_ERROR_CODES,
|
|
17
17
|
createHwkError,
|
|
18
18
|
defaultOriginForCode,
|
|
19
19
|
defaultRecoveryForCode,
|
|
20
|
+
isHardwareErrorCode,
|
|
20
21
|
isHwkRecoveryHint,
|
|
21
22
|
operationMayHaveCompletedParams
|
|
22
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-VKP46GTC.mjs";
|
|
23
24
|
|
|
24
25
|
// src/types/response.ts
|
|
25
26
|
function success(payload) {
|
|
@@ -846,6 +847,28 @@ var TypedEventEmitter = class {
|
|
|
846
847
|
}
|
|
847
848
|
};
|
|
848
849
|
|
|
850
|
+
// src/types/electronBle.ts
|
|
851
|
+
var isSerializedError = (value) => typeof value === "object" && value !== null && !(value instanceof Error) && typeof value.message === "string";
|
|
852
|
+
var restoreHostError = ({ message, code, params }) => isHardwareErrorCode(code) ? createHwkError({ code, message, ...params ? { params } : {} }) : new Error(message);
|
|
853
|
+
function rehydrateElectronBleErrors(bridge) {
|
|
854
|
+
const wrapped = Object.create(bridge);
|
|
855
|
+
for (const key of Object.keys(bridge)) {
|
|
856
|
+
if (typeof bridge[key] === "function") {
|
|
857
|
+
Object.defineProperty(wrapped, key, {
|
|
858
|
+
value: (...args) => {
|
|
859
|
+
const method = bridge[key];
|
|
860
|
+
const result = method.apply(bridge, args);
|
|
861
|
+
if (typeof result?.then !== "function") return result;
|
|
862
|
+
return Promise.resolve(result).catch((error) => {
|
|
863
|
+
throw isSerializedError(error) ? restoreHostError(error) : error;
|
|
864
|
+
});
|
|
865
|
+
}
|
|
866
|
+
});
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
return wrapped;
|
|
870
|
+
}
|
|
871
|
+
|
|
849
872
|
// src/utils/requestSaveDeviceBinding.ts
|
|
850
873
|
function emitDeviceBindingStatus(emitter, selectionRequestId, status) {
|
|
851
874
|
emitter.emit(UI_REQUEST.DEVICE_BINDING_STATUS, {
|
|
@@ -1759,6 +1782,7 @@ export {
|
|
|
1759
1782
|
hexToBytes,
|
|
1760
1783
|
isAllNetworkMethodName,
|
|
1761
1784
|
isConnectionLost,
|
|
1785
|
+
isHardwareErrorCode,
|
|
1762
1786
|
isHardwareOperationId,
|
|
1763
1787
|
isHwkRecoveryHint,
|
|
1764
1788
|
isKnownNonTargetHardwareVendor,
|
|
@@ -1772,6 +1796,7 @@ export {
|
|
|
1772
1796
|
pickConnectionContext,
|
|
1773
1797
|
prepareSolanaOffchainMessageV1,
|
|
1774
1798
|
rehydrateConnectorError,
|
|
1799
|
+
rehydrateElectronBleErrors,
|
|
1775
1800
|
requestBleDeviceSelection,
|
|
1776
1801
|
requestSaveDeviceBinding,
|
|
1777
1802
|
resolveHardwareOperationTarget,
|