@metamask-previews/perps-controller 6.0.1-preview-e5cef32c6 → 6.1.0-preview-6d2aeda
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/CHANGELOG.md +10 -1
- package/dist/providers/HyperLiquidProvider.cjs +24 -18
- package/dist/providers/HyperLiquidProvider.cjs.map +1 -1
- package/dist/providers/HyperLiquidProvider.d.cts.map +1 -1
- package/dist/providers/HyperLiquidProvider.d.mts.map +1 -1
- package/dist/providers/HyperLiquidProvider.mjs +25 -19
- package/dist/providers/HyperLiquidProvider.mjs.map +1 -1
- package/dist/services/HyperLiquidWalletService.cjs +4 -1
- package/dist/services/HyperLiquidWalletService.cjs.map +1 -1
- package/dist/services/HyperLiquidWalletService.d.cts +1 -1
- package/dist/services/HyperLiquidWalletService.d.cts.map +1 -1
- package/dist/services/HyperLiquidWalletService.d.mts +1 -1
- package/dist/services/HyperLiquidWalletService.d.mts.map +1 -1
- package/dist/services/HyperLiquidWalletService.mjs +4 -1
- package/dist/services/HyperLiquidWalletService.mjs.map +1 -1
- package/dist/services/RewardsIntegrationService.cjs +11 -2
- package/dist/services/RewardsIntegrationService.cjs.map +1 -1
- package/dist/services/RewardsIntegrationService.d.cts.map +1 -1
- package/dist/services/RewardsIntegrationService.d.mts.map +1 -1
- package/dist/services/RewardsIntegrationService.mjs +11 -2
- package/dist/services/RewardsIntegrationService.mjs.map +1 -1
- package/dist/services/TradingReadinessCache.cjs +2 -1
- package/dist/services/TradingReadinessCache.cjs.map +1 -1
- package/dist/services/TradingReadinessCache.d.cts +2 -1
- package/dist/services/TradingReadinessCache.d.cts.map +1 -1
- package/dist/services/TradingReadinessCache.d.mts +2 -1
- package/dist/services/TradingReadinessCache.d.mts.map +1 -1
- package/dist/services/TradingReadinessCache.mjs +2 -1
- package/dist/services/TradingReadinessCache.mjs.map +1 -1
- package/dist/services/TradingService.cjs +41 -0
- package/dist/services/TradingService.cjs.map +1 -1
- package/dist/services/TradingService.d.cts.map +1 -1
- package/dist/services/TradingService.d.mts.map +1 -1
- package/dist/services/TradingService.mjs +41 -0
- package/dist/services/TradingService.mjs.map +1 -1
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.cts +7 -2
- package/dist/types/index.d.cts.map +1 -1
- package/dist/types/index.d.mts +7 -2
- package/dist/types/index.d.mts.map +1 -1
- package/dist/types/index.mjs.map +1 -1
- package/dist/utils/errorUtils.cjs +24 -3
- package/dist/utils/errorUtils.cjs.map +1 -1
- package/dist/utils/errorUtils.d.cts +8 -0
- package/dist/utils/errorUtils.d.cts.map +1 -1
- package/dist/utils/errorUtils.d.mts +8 -0
- package/dist/utils/errorUtils.d.mts.map +1 -1
- package/dist/utils/errorUtils.mjs +22 -2
- package/dist/utils/errorUtils.mjs.map +1 -1
- package/dist/utils/hyperLiquidAbstraction.cjs +23 -0
- package/dist/utils/hyperLiquidAbstraction.cjs.map +1 -0
- package/dist/utils/hyperLiquidAbstraction.d.cts +11 -0
- package/dist/utils/hyperLiquidAbstraction.d.cts.map +1 -0
- package/dist/utils/hyperLiquidAbstraction.d.mts +11 -0
- package/dist/utils/hyperLiquidAbstraction.d.mts.map +1 -0
- package/dist/utils/hyperLiquidAbstraction.mjs +19 -0
- package/dist/utils/hyperLiquidAbstraction.mjs.map +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,11 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [6.1.0]
|
|
11
|
+
|
|
10
12
|
### Changed
|
|
11
13
|
|
|
14
|
+
- Pass the perps builder base fee into rewards discount resolution and treat unhydrated rewards subscription state as retryable instead of a definitive no-discount result ([#8803](https://github.com/MetaMask/core/pull/8803))
|
|
12
15
|
- Bump `@metamask/controller-utils` from `^12.0.0` to `^12.1.0` ([#8774](https://github.com/MetaMask/core/pull/8774))
|
|
13
16
|
- Bump `@metamask/transaction-controller` from `^65.3.0` to `^65.4.0` ([#8796](https://github.com/MetaMask/core/pull/8796))
|
|
14
17
|
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- Defer signing-backed HyperLiquid unified-account setup for hardware wallets across migratable abstraction modes, including Ledger, Trezor, OneKey, Lattice, and QR keyrings, to avoid repeated signing prompts while browsing ([#8803](https://github.com/MetaMask/core/pull/8803))
|
|
21
|
+
- Improve logging and retry classification for failed cancel/close/TP-SL operations and SDK-wrapped keyring-locked errors ([#8803](https://github.com/MetaMask/core/pull/8803))
|
|
22
|
+
|
|
15
23
|
## [6.0.1]
|
|
16
24
|
|
|
17
25
|
### Changed
|
|
@@ -290,7 +298,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
290
298
|
|
|
291
299
|
- Bump `@metamask/controller-utils` from `^11.18.0` to `^11.19.0` ([#7995](https://github.com/MetaMask/core/pull/7995))
|
|
292
300
|
|
|
293
|
-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/perps-controller@6.0
|
|
301
|
+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/perps-controller@6.1.0...HEAD
|
|
302
|
+
[6.1.0]: https://github.com/MetaMask/core/compare/@metamask/perps-controller@6.0.1...@metamask/perps-controller@6.1.0
|
|
294
303
|
[6.0.1]: https://github.com/MetaMask/core/compare/@metamask/perps-controller@6.0.0...@metamask/perps-controller@6.0.1
|
|
295
304
|
[6.0.0]: https://github.com/MetaMask/core/compare/@metamask/perps-controller@5.0.0...@metamask/perps-controller@6.0.0
|
|
296
305
|
[5.0.0]: https://github.com/MetaMask/core/compare/@metamask/perps-controller@4.0.0...@metamask/perps-controller@5.0.0
|
|
@@ -29,6 +29,7 @@ const types_1 = require("../types/index.cjs");
|
|
|
29
29
|
const hyperliquid_types_1 = require("../types/hyperliquid-types.cjs");
|
|
30
30
|
const accountUtils_1 = require("../utils/accountUtils.cjs");
|
|
31
31
|
const errorUtils_1 = require("../utils/errorUtils.cjs");
|
|
32
|
+
const hyperLiquidAbstraction_1 = require("../utils/hyperLiquidAbstraction.cjs");
|
|
32
33
|
const hyperLiquidAdapter_1 = require("../utils/hyperLiquidAdapter.cjs");
|
|
33
34
|
const hyperLiquidValidation_1 = require("../utils/hyperLiquidValidation.cjs");
|
|
34
35
|
const marketDataTransform_1 = require("../utils/marketDataTransform.cjs");
|
|
@@ -143,7 +144,7 @@ class HyperLiquidProvider {
|
|
|
143
144
|
* - Builder fee approval (required for orders)
|
|
144
145
|
* - Referral code setup (attribution)
|
|
145
146
|
*
|
|
146
|
-
* These operations are DEFERRED from ensureReady() to avoid
|
|
147
|
+
* These operations are DEFERRED from ensureReady() to avoid hardware wallet prompt spam
|
|
147
148
|
* when users are just viewing the Perps section (critical for hardware wallets).
|
|
148
149
|
*
|
|
149
150
|
* Call this method before any trading operation (placeOrder, cancelOrder, etc.)
|
|
@@ -3863,7 +3864,8 @@ async function _HyperLiquidProvider_ensureUnifiedAccountEnabled(options) {
|
|
|
3863
3864
|
const userAddress = await __classPrivateFieldGet(this, _HyperLiquidProvider_walletService, "f").getUserAddressWithDefault();
|
|
3864
3865
|
const network = __classPrivateFieldGet(this, _HyperLiquidProvider_clientService, "f").isTestnetMode() ? 'testnet' : 'mainnet';
|
|
3865
3866
|
// Check global cache first to avoid repeated signing requests
|
|
3866
|
-
// This is CRITICAL for hardware wallets to prevent
|
|
3867
|
+
// This is CRITICAL for hardware wallets to prevent repeated signing prompts
|
|
3868
|
+
// while browsing.
|
|
3867
3869
|
const cachedStatus = TradingReadinessCache_1.TradingReadinessCache.get(network, userAddress);
|
|
3868
3870
|
if (cachedStatus?.attempted) {
|
|
3869
3871
|
__classPrivateFieldGet(this, _HyperLiquidProvider_deps, "f").debugLogger.log('HyperLiquidProvider: Unified Account setup already attempted (from global cache)', {
|
|
@@ -3928,12 +3930,12 @@ async function _HyperLiquidProvider_ensureUnifiedAccountEnabled(options) {
|
|
|
3928
3930
|
completeInFlight();
|
|
3929
3931
|
return;
|
|
3930
3932
|
}
|
|
3931
|
-
// Defer
|
|
3933
|
+
// Defer signing-backed transitions until the user attempts an action.
|
|
3932
3934
|
// Cache is intentionally left untouched so the next entry re-evaluates;
|
|
3933
3935
|
// the read-only userAbstraction call is cheap and gated by the in-flight
|
|
3934
3936
|
// lock, preventing concurrent prompts.
|
|
3935
|
-
if (currentMode
|
|
3936
|
-
__classPrivateFieldGet(this, _HyperLiquidProvider_deps, "f").debugLogger.log('HyperLiquidProvider: Deferring
|
|
3937
|
+
if ((0, hyperLiquidAbstraction_1.shouldDeferUnifiedAccountSetup)(currentMode, allowUserSigning)) {
|
|
3938
|
+
__classPrivateFieldGet(this, _HyperLiquidProvider_deps, "f").debugLogger.log('HyperLiquidProvider: Deferring unified account migration to action time', { user: userAddress, network, mode: currentMode });
|
|
3937
3939
|
completeInFlight();
|
|
3938
3940
|
return;
|
|
3939
3941
|
}
|
|
@@ -3996,8 +3998,9 @@ async function _HyperLiquidProvider_ensureUnifiedAccountEnabled(options) {
|
|
|
3996
3998
|
completeInFlight();
|
|
3997
3999
|
}
|
|
3998
4000
|
catch (error) {
|
|
3999
|
-
//
|
|
4000
|
-
|
|
4001
|
+
// HyperLiquid wraps wallet signing failures and preserves KEYRING_LOCKED
|
|
4002
|
+
// in `cause`, so classify the full chain and leave retry caches empty.
|
|
4003
|
+
if ((0, errorUtils_1.isKeyringLockedError)(error)) {
|
|
4001
4004
|
__classPrivateFieldGet(this, _HyperLiquidProvider_deps, "f").debugLogger.log('[ensureUnifiedAccountEnabled] Keyring locked, will retry later');
|
|
4002
4005
|
__classPrivateFieldSet(this, _HyperLiquidProvider_unifiedAccountSetupNeedsRetry, true, "f");
|
|
4003
4006
|
completeInFlight();
|
|
@@ -4082,10 +4085,10 @@ async function _HyperLiquidProvider_ensureReady() {
|
|
|
4082
4085
|
await __classPrivateFieldGet(this, _HyperLiquidProvider_instances, "m", _HyperLiquidProvider_buildAssetMapping).call(this);
|
|
4083
4086
|
}
|
|
4084
4087
|
// Attempt Unified Account migration as early as possible so users aren't
|
|
4085
|
-
// blocked when they try to trade. Software
|
|
4086
|
-
//
|
|
4087
|
-
//
|
|
4088
|
-
//
|
|
4088
|
+
// blocked when they try to trade. Software wallets can complete the
|
|
4089
|
+
// signing-backed migration during initial setup so the first trade sees
|
|
4090
|
+
// the unified balance. Hardware wallets remain deferred to action time to
|
|
4091
|
+
// avoid repeated signing prompts while browsing.
|
|
4089
4092
|
await __classPrivateFieldGet(this, _HyperLiquidProvider_instances, "m", _HyperLiquidProvider_ensureUnifiedAccountEnabled).call(this, {
|
|
4090
4093
|
allowUserSigning: !__classPrivateFieldGet(this, _HyperLiquidProvider_walletService, "f").isSelectedHardwareWallet(),
|
|
4091
4094
|
});
|
|
@@ -5158,10 +5161,11 @@ async function _HyperLiquidProvider_ensureBuilderFeeApproval() {
|
|
|
5158
5161
|
const userAddress = await __classPrivateFieldGet(this, _HyperLiquidProvider_walletService, "f").getUserAddressWithDefault();
|
|
5159
5162
|
const cacheKey = __classPrivateFieldGet(this, _HyperLiquidProvider_instances, "m", _HyperLiquidProvider_getCacheKey).call(this, network, userAddress);
|
|
5160
5163
|
// Check GLOBAL cache first to avoid repeated signing requests across reconnections
|
|
5161
|
-
// This is CRITICAL for hardware wallets to prevent
|
|
5164
|
+
// This is CRITICAL for hardware wallets to prevent repeated signing prompts
|
|
5165
|
+
// while browsing.
|
|
5162
5166
|
const globalCached = TradingReadinessCache_1.PerpsSigningCache.getBuilderFee(network, userAddress);
|
|
5163
5167
|
if (globalCached?.attempted) {
|
|
5164
|
-
__classPrivateFieldGet(this, _HyperLiquidProvider_deps, "f").debugLogger.log('[ensureBuilderFeeApproval] Using global cache (prevents
|
|
5168
|
+
__classPrivateFieldGet(this, _HyperLiquidProvider_deps, "f").debugLogger.log('[ensureBuilderFeeApproval] Using global cache (prevents hardware wallet prompt spam)', { network, success: globalCached.success });
|
|
5165
5169
|
if (globalCached.success) {
|
|
5166
5170
|
__classPrivateFieldGet(this, _HyperLiquidProvider_builderFeeCheckCache, "f").set(cacheKey, true);
|
|
5167
5171
|
}
|
|
@@ -5222,8 +5226,9 @@ async function _HyperLiquidProvider_ensureBuilderFeeApproval() {
|
|
|
5222
5226
|
completeInFlight();
|
|
5223
5227
|
}
|
|
5224
5228
|
catch (error) {
|
|
5225
|
-
//
|
|
5226
|
-
|
|
5229
|
+
// HyperLiquid wraps wallet signing failures and preserves KEYRING_LOCKED
|
|
5230
|
+
// in `cause`, so classify the full chain and leave retry caches empty.
|
|
5231
|
+
if ((0, errorUtils_1.isKeyringLockedError)(error)) {
|
|
5227
5232
|
__classPrivateFieldGet(this, _HyperLiquidProvider_deps, "f").debugLogger.log('[ensureBuilderFeeApproval] Keyring locked, will retry later');
|
|
5228
5233
|
completeInFlight();
|
|
5229
5234
|
return;
|
|
@@ -6054,7 +6059,7 @@ async function _HyperLiquidProvider_ensureReferralSet() {
|
|
|
6054
6059
|
// Check GLOBAL cache first
|
|
6055
6060
|
const globalCached = TradingReadinessCache_1.PerpsSigningCache.getReferral(network, userAddress);
|
|
6056
6061
|
if (globalCached?.attempted) {
|
|
6057
|
-
__classPrivateFieldGet(this, _HyperLiquidProvider_deps, "f").debugLogger.log('[ensureReferralSet] Using global cache (prevents
|
|
6062
|
+
__classPrivateFieldGet(this, _HyperLiquidProvider_deps, "f").debugLogger.log('[ensureReferralSet] Using global cache (prevents hardware wallet prompt spam)', { network, success: globalCached.success });
|
|
6058
6063
|
return;
|
|
6059
6064
|
}
|
|
6060
6065
|
// Check if another provider is currently attempting this
|
|
@@ -6111,8 +6116,9 @@ async function _HyperLiquidProvider_ensureReferralSet() {
|
|
|
6111
6116
|
completeInFlight();
|
|
6112
6117
|
}
|
|
6113
6118
|
catch (error) {
|
|
6114
|
-
//
|
|
6115
|
-
|
|
6119
|
+
// HyperLiquid wraps wallet signing failures and preserves KEYRING_LOCKED
|
|
6120
|
+
// in `cause`, so classify the full chain and leave retry caches empty.
|
|
6121
|
+
if ((0, errorUtils_1.isKeyringLockedError)(error)) {
|
|
6116
6122
|
__classPrivateFieldGet(this, _HyperLiquidProvider_deps, "f").debugLogger.log('[ensureReferralSet] Keyring locked, will retry later');
|
|
6117
6123
|
completeInFlight();
|
|
6118
6124
|
return;
|