@onekeyfe/hwk-ledger-adapter 1.2.8-alpha.113 → 1.2.8-alpha.114
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.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +12 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -4961,6 +4961,14 @@ var METHOD_PREFIX_TO_APP_NAME = {
|
|
|
4961
4961
|
tron: "Tron",
|
|
4962
4962
|
zcash: "Zcash"
|
|
4963
4963
|
};
|
|
4964
|
+
function withOpenAppName(event, data, appName) {
|
|
4965
|
+
if (event !== "ui-event") return data;
|
|
4966
|
+
const uiEvent = data;
|
|
4967
|
+
if (uiEvent.type !== EConnectorInteraction3.ConfirmOpenApp || uiEvent.payload.appName) {
|
|
4968
|
+
return data;
|
|
4969
|
+
}
|
|
4970
|
+
return { ...uiEvent, payload: { ...uiEvent.payload, appName } };
|
|
4971
|
+
}
|
|
4964
4972
|
var HARDWARE_ERROR_CODE_VALUES = new Set(
|
|
4965
4973
|
Object.values(HardwareErrorCode7).filter((value) => typeof value === "number")
|
|
4966
4974
|
);
|
|
@@ -5769,8 +5777,8 @@ var LedgerConnectorBase = class {
|
|
|
5769
5777
|
// ---------------------------------------------------------------------------
|
|
5770
5778
|
/**
|
|
5771
5779
|
* Return a per-call ctx with the chain's Ledger app name pre-bound to
|
|
5772
|
-
* wrapError, so chain handlers don't need to repeat
|
|
5773
|
-
*
|
|
5780
|
+
* UI prompts and wrapError, so chain handlers don't need to repeat the name.
|
|
5781
|
+
* Falls through unchanged for unknown methods.
|
|
5774
5782
|
*/
|
|
5775
5783
|
_ctxForMethod(method) {
|
|
5776
5784
|
const prefix = /^(evm|btc|sol|tron|zcash)/.exec(method)?.[1];
|
|
@@ -5778,7 +5786,8 @@ var LedgerConnectorBase = class {
|
|
|
5778
5786
|
if (!defaultAppName) return this._ctx;
|
|
5779
5787
|
return {
|
|
5780
5788
|
...this._ctx,
|
|
5781
|
-
wrapError: (err, opts) => this._wrapError(err, { defaultAppName, ...opts })
|
|
5789
|
+
wrapError: (err, opts) => this._wrapError(err, { defaultAppName, ...opts }),
|
|
5790
|
+
emit: (event, data) => this._ctx.emit(event, withOpenAppName(event, data, defaultAppName))
|
|
5782
5791
|
};
|
|
5783
5792
|
}
|
|
5784
5793
|
_wrapError(err, opts) {
|