@metamask-previews/authenticated-user-storage 4.1.0-preview-8cc0f94 → 4.1.0-preview-377206492

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 CHANGED
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ### Added
11
+
12
+ - Add optional `DryRunPreference` type and `dryRun` field to `NotificationPreferences`, with the `DEFAULT_DRY_RUN_PREFERENCES` constant ([#10704](https://github.com/MetaMask/core/pull/10704))
13
+
10
14
  ### Changed
11
15
 
12
16
  - Bump `@metamask/base-data-service` from `^2.0.0` to `^2.1.0` ([#10502](https://github.com/MetaMask/core/pull/10502))
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  export { getAuthenticatedStorageUrl, AuthenticatedUserStorageService, } from './authenticated-user-storage.js';
2
- export { ASSETS_WATCHLIST_MAX_ASSETS, DEFAULT_AGENTIC_CLI_PREFERENCES, DEFAULT_PRICE_ALERT_PREFERENCES, } from './validators.js';
2
+ export { ASSETS_WATCHLIST_MAX_ASSETS, DEFAULT_AGENTIC_CLI_PREFERENCES, DEFAULT_DRY_RUN_PREFERENCES, DEFAULT_PRICE_ALERT_PREFERENCES, } from './validators.js';
3
3
  export type { AuthenticatedUserStorageActions, AuthenticatedUserStorageCacheUpdatedEvent, AuthenticatedUserStorageEvents, AuthenticatedUserStorageGranularCacheUpdatedEvent, AuthenticatedUserStorageInvalidateQueriesAction, AuthenticatedUserStorageMessenger, } from './authenticated-user-storage.js';
4
4
  export type { AuthenticatedUserStorageServiceListDelegationsAction, AuthenticatedUserStorageServiceCreateDelegationAction, AuthenticatedUserStorageServiceRevokeDelegationAction, AuthenticatedUserStorageServiceGetNotificationPreferencesAction, AuthenticatedUserStorageServicePutNotificationPreferencesAction, AuthenticatedUserStorageServiceGetMarketingConsentAction, AuthenticatedUserStorageServicePutMarketingConsentAction, AuthenticatedUserStorageServiceGetIdentitySharingConsentAction, AuthenticatedUserStorageServicePutIdentitySharingConsentAction, AuthenticatedUserStorageServiceGetAssetsWatchlistAction, AuthenticatedUserStorageServiceSetAssetsWatchlistAction, } from './authenticated-user-storage-method-action-types.js';
5
5
  export { getUserStorageApiUrl } from './env.js';
6
6
  export type { Environment } from './env.js';
7
- export type { Caveat, SignedDelegation, DelegationMetadata, DelegationSubmission, DelegationResponse, WalletActivityAccount, WalletActivityPreference, MarketingConsent, IdentitySharingAudience, IdentitySharingConsent, IdentitySharingConsentWrite, MarketingPreference, PerpsWatchlistExchange, PerpsWatchlistMarkets, PerpsPreference, SocialAIPreference, AgenticCliPreference, PriceAlertPreference, NotificationPreferences, AssetsWatchlistBlob, ClientType, } from './types.js';
7
+ export type { Caveat, SignedDelegation, DelegationMetadata, DelegationSubmission, DelegationResponse, WalletActivityAccount, WalletActivityPreference, MarketingConsent, IdentitySharingAudience, IdentitySharingConsent, IdentitySharingConsentWrite, MarketingPreference, PerpsWatchlistExchange, PerpsWatchlistMarkets, PerpsPreference, SocialAIPreference, AgenticCliPreference, DryRunPreference, PriceAlertPreference, NotificationPreferences, AssetsWatchlistBlob, ClientType, } from './types.js';
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,+BAA+B,GAChC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,2BAA2B,EAC3B,+BAA+B,EAC/B,+BAA+B,GAChC,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,+BAA+B,EAC/B,yCAAyC,EACzC,8BAA8B,EAC9B,iDAAiD,EACjD,+CAA+C,EAC/C,iCAAiC,GAClC,MAAM,iCAAiC,CAAC;AACzC,YAAY,EACV,oDAAoD,EACpD,qDAAqD,EACrD,qDAAqD,EACrD,+DAA+D,EAC/D,+DAA+D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,EACN,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,qBAAqB,EACrB,wBAAwB,EACxB,gBAAgB,EAChB,uBAAuB,EACvB,sBAAsB,EACtB,2BAA2B,EAC3B,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACrB,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,uBAAuB,EACvB,mBAAmB,EACnB,UAAU,GACX,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  export { getAuthenticatedStorageUrl, AuthenticatedUserStorageService, } from './authenticated-user-storage.js';
2
- export { ASSETS_WATCHLIST_MAX_ASSETS, DEFAULT_AGENTIC_CLI_PREFERENCES, DEFAULT_PRICE_ALERT_PREFERENCES, } from './validators.js';
2
+ export { ASSETS_WATCHLIST_MAX_ASSETS, DEFAULT_AGENTIC_CLI_PREFERENCES, DEFAULT_DRY_RUN_PREFERENCES, DEFAULT_PRICE_ALERT_PREFERENCES, } from './validators.js';
3
3
  export { getUserStorageApiUrl } from './env.js';
4
4
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,+BAA+B,GAChC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,2BAA2B,EAC3B,+BAA+B,EAC/B,+BAA+B,GAChC,MAAM,iBAAiB,CAAC;AAsBzB,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC","sourcesContent":["export {\n getAuthenticatedStorageUrl,\n AuthenticatedUserStorageService,\n} from './authenticated-user-storage.js';\nexport {\n ASSETS_WATCHLIST_MAX_ASSETS,\n DEFAULT_AGENTIC_CLI_PREFERENCES,\n DEFAULT_PRICE_ALERT_PREFERENCES,\n} from './validators.js';\nexport type {\n AuthenticatedUserStorageActions,\n AuthenticatedUserStorageCacheUpdatedEvent,\n AuthenticatedUserStorageEvents,\n AuthenticatedUserStorageGranularCacheUpdatedEvent,\n AuthenticatedUserStorageInvalidateQueriesAction,\n AuthenticatedUserStorageMessenger,\n} from './authenticated-user-storage.js';\nexport type {\n AuthenticatedUserStorageServiceListDelegationsAction,\n AuthenticatedUserStorageServiceCreateDelegationAction,\n AuthenticatedUserStorageServiceRevokeDelegationAction,\n AuthenticatedUserStorageServiceGetNotificationPreferencesAction,\n AuthenticatedUserStorageServicePutNotificationPreferencesAction,\n AuthenticatedUserStorageServiceGetMarketingConsentAction,\n AuthenticatedUserStorageServicePutMarketingConsentAction,\n AuthenticatedUserStorageServiceGetIdentitySharingConsentAction,\n AuthenticatedUserStorageServicePutIdentitySharingConsentAction,\n AuthenticatedUserStorageServiceGetAssetsWatchlistAction,\n AuthenticatedUserStorageServiceSetAssetsWatchlistAction,\n} from './authenticated-user-storage-method-action-types.js';\nexport { getUserStorageApiUrl } from './env.js';\nexport type { Environment } from './env.js';\nexport type {\n Caveat,\n SignedDelegation,\n DelegationMetadata,\n DelegationSubmission,\n DelegationResponse,\n WalletActivityAccount,\n WalletActivityPreference,\n MarketingConsent,\n IdentitySharingAudience,\n IdentitySharingConsent,\n IdentitySharingConsentWrite,\n MarketingPreference,\n PerpsWatchlistExchange,\n PerpsWatchlistMarkets,\n PerpsPreference,\n SocialAIPreference,\n AgenticCliPreference,\n PriceAlertPreference,\n NotificationPreferences,\n AssetsWatchlistBlob,\n ClientType,\n} from './types.js';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,+BAA+B,GAChC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,2BAA2B,EAC3B,+BAA+B,EAC/B,2BAA2B,EAC3B,+BAA+B,GAChC,MAAM,iBAAiB,CAAC;AAsBzB,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC","sourcesContent":["export {\n getAuthenticatedStorageUrl,\n AuthenticatedUserStorageService,\n} from './authenticated-user-storage.js';\nexport {\n ASSETS_WATCHLIST_MAX_ASSETS,\n DEFAULT_AGENTIC_CLI_PREFERENCES,\n DEFAULT_DRY_RUN_PREFERENCES,\n DEFAULT_PRICE_ALERT_PREFERENCES,\n} from './validators.js';\nexport type {\n AuthenticatedUserStorageActions,\n AuthenticatedUserStorageCacheUpdatedEvent,\n AuthenticatedUserStorageEvents,\n AuthenticatedUserStorageGranularCacheUpdatedEvent,\n AuthenticatedUserStorageInvalidateQueriesAction,\n AuthenticatedUserStorageMessenger,\n} from './authenticated-user-storage.js';\nexport type {\n AuthenticatedUserStorageServiceListDelegationsAction,\n AuthenticatedUserStorageServiceCreateDelegationAction,\n AuthenticatedUserStorageServiceRevokeDelegationAction,\n AuthenticatedUserStorageServiceGetNotificationPreferencesAction,\n AuthenticatedUserStorageServicePutNotificationPreferencesAction,\n AuthenticatedUserStorageServiceGetMarketingConsentAction,\n AuthenticatedUserStorageServicePutMarketingConsentAction,\n AuthenticatedUserStorageServiceGetIdentitySharingConsentAction,\n AuthenticatedUserStorageServicePutIdentitySharingConsentAction,\n AuthenticatedUserStorageServiceGetAssetsWatchlistAction,\n AuthenticatedUserStorageServiceSetAssetsWatchlistAction,\n} from './authenticated-user-storage-method-action-types.js';\nexport { getUserStorageApiUrl } from './env.js';\nexport type { Environment } from './env.js';\nexport type {\n Caveat,\n SignedDelegation,\n DelegationMetadata,\n DelegationSubmission,\n DelegationResponse,\n WalletActivityAccount,\n WalletActivityPreference,\n MarketingConsent,\n IdentitySharingAudience,\n IdentitySharingConsent,\n IdentitySharingConsentWrite,\n MarketingPreference,\n PerpsWatchlistExchange,\n PerpsWatchlistMarkets,\n PerpsPreference,\n SocialAIPreference,\n AgenticCliPreference,\n DryRunPreference,\n PriceAlertPreference,\n NotificationPreferences,\n AssetsWatchlistBlob,\n ClientType,\n} from './types.js';\n"]}
package/dist/types.d.ts CHANGED
@@ -89,6 +89,10 @@ export type PriceAlertPreference = {
89
89
  inAppNotificationsEnabled: boolean;
90
90
  pushNotificationsEnabled: boolean;
91
91
  };
92
+ export type DryRunPreference = {
93
+ inAppNotificationsEnabled: boolean;
94
+ pushNotificationsEnabled: boolean;
95
+ };
92
96
  /**
93
97
  * Notification preferences for the authenticated user.
94
98
  */
@@ -99,6 +103,7 @@ export type NotificationPreferences = {
99
103
  socialAI: SocialAIPreference;
100
104
  agenticCli: AgenticCliPreference;
101
105
  priceAlerts: PriceAlertPreference;
106
+ dryRun?: DryRunPreference;
102
107
  };
103
108
  /** Marketing consent for the authenticated user (master toggle). */
104
109
  export type MarketingConsent = {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAM3C,gDAAgD;AAChD,MAAM,MAAM,MAAM,GAAG;IACnB,6DAA6D;IAC7D,QAAQ,EAAE,GAAG,CAAC;IACd,8CAA8C;IAC9C,KAAK,EAAE,GAAG,CAAC;IACX,kDAAkD;IAClD,IAAI,EAAE,GAAG,CAAC;CACX,CAAC;AAEF,oCAAoC;AACpC,MAAM,MAAM,gBAAgB,GAAG;IAC7B,0DAA0D;IAC1D,QAAQ,EAAE,GAAG,CAAC;IACd,qDAAqD;IACrD,SAAS,EAAE,GAAG,CAAC;IACf,8DAA8D;IAC9D,SAAS,EAAE,GAAG,CAAC;IACf,0DAA0D;IAC1D,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,mDAAmD;IACnD,IAAI,EAAE,GAAG,CAAC;IACV,2DAA2D;IAC3D,SAAS,EAAE,GAAG,CAAC;CAChB,CAAC;AAEF,6CAA6C;AAC7C,MAAM,MAAM,kBAAkB,GAAG;IAC/B,yEAAyE;IACzE,cAAc,EAAE,GAAG,CAAC;IACpB,4CAA4C;IAC5C,UAAU,EAAE,GAAG,CAAC;IAChB,mDA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c,EAAE,wBAAwB,CAAC;IACzC,SAAS,EAAE,mBAAmB,CAAC;IAC/B,KAAK,EAAE,eAAe,CAAC;IACvB,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,UAAU,EAAE,oBAAoB,CAAC;IACjC,WAAW,EAAE,oBAAoB,CAAC;IAClC,MAAM,CAAC,EAAE,gBAAgB,CAAC;CAC3B,CAAC;AAMF,oEAAoE;AACpE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,uBAAuB,EAAE,OAAO,CAAC;CAClC,CAAC;AAMF,kEAAkE;AAClE,MAAM,MAAM,uBAAuB,GAAG,KAAK,GAAG,MAAM,CAAC;AAErD;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,wEAAwE;AACxE,MAAM,MAAM,2BAA2B,GAAG;IACxC,QAAQ,EAAE,uBAAuB,CAAC;IAClC,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAUF,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAM3D,6CAA6C;AAC7C,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Hex } from '@metamask/utils';\n\n// ---------------------------------------------------------------------------\n// Delegations\n// ---------------------------------------------------------------------------\n\n/** A single caveat attached to a delegation. */\nexport type Caveat = {\n /** Address of the caveat enforcer contract (0x-prefixed). */\n enforcer: Hex;\n /** ABI-encoded caveat terms (0x-prefixed). */\n terms: Hex;\n /** ABI-encoded caveat arguments (0x-prefixed). */\n args: Hex;\n};\n\n/** An EIP-712 signed delegation. */\nexport type SignedDelegation = {\n /** Address the delegation is granted to (0x-prefixed). */\n delegate: Hex;\n /** Address granting the delegation (0x-prefixed). */\n delegator: Hex;\n /** Root authority or parent delegation hash (0x-prefixed). */\n authority: Hex;\n /** Caveats restricting how the delegation may be used. */\n caveats: Caveat[];\n /** Unique salt to prevent replay (0x-prefixed). */\n salt: Hex;\n /** EIP-712 signature over the delegation (0x-prefixed). */\n signature: Hex;\n};\n\n/** Metadata associated with a delegation. */\nexport type DelegationMetadata = {\n /** Keccak-256 hash uniquely identifying the delegation (0x-prefixed). */\n delegationHash: Hex;\n /** Chain ID in hex format (0x-prefixed). */\n chainIdHex: Hex;\n /** Token allowance in hex format (0x-prefixed). */\n allowance: Hex;\n /** Symbol of the token (e.g. \"USDC\"). */\n tokenSymbol: string;\n /** Token contract address (0x-prefixed). */\n tokenAddress: Hex;\n /** Type of delegation. */\n type: string;\n};\n\n/** Request body for submitting a new delegation. */\nexport type DelegationSubmission = {\n signedDelegation: SignedDelegation;\n metadata: DelegationMetadata;\n};\n\n/** A stored delegation record returned by the API. */\nexport type DelegationResponse = {\n signedDelegation: SignedDelegation;\n metadata: DelegationMetadata;\n};\n\n// ---------------------------------------------------------------------------\n// Preferences\n// ---------------------------------------------------------------------------\n\n/** Wallet activity tracking for a single address. */\nexport type WalletActivityAccount = {\n /** Wallet address to track activity for (0x-prefixed). */\n address: Hex;\n enabled: boolean;\n};\n\nexport type AgenticCliPreference = {\n inAppNotificationsEnabled: boolean;\n pushNotificationsEnabled: boolean;\n};\n\nexport type WalletActivityPreference = {\n inAppNotificationsEnabled: boolean;\n pushNotificationsEnabled: boolean;\n accounts: WalletActivityAccount[];\n};\n\nexport type MarketingPreference = {\n inAppNotificationsEnabled: boolean;\n pushNotificationsEnabled: boolean;\n};\n\nexport type PerpsWatchlistExchange = {\n testnet: string[];\n mainnet: string[];\n};\n\nexport type PerpsWatchlistMarkets = {\n hyperliquid: PerpsWatchlistExchange;\n};\n\nexport type PerpsPreference = {\n inAppNotificationsEnabled: boolean;\n pushNotificationsEnabled: boolean;\n watchlistMarkets?: PerpsWatchlistMarkets;\n};\n\nexport type SocialAIPreference = {\n inAppNotificationsEnabled: boolean;\n pushNotificationsEnabled: boolean;\n txAmountLimit?: number;\n mutedTraderProfileIds: string[];\n};\n\nexport type PriceAlertPreference = {\n inAppNotificationsEnabled: boolean;\n pushNotificationsEnabled: boolean;\n};\n\n/**\n * Notification preferences for the authenticated user.\n */\nexport type NotificationPreferences = {\n walletActivity: WalletActivityPreference;\n marketing: MarketingPreference;\n perps: PerpsPreference;\n socialAI: SocialAIPreference;\n agenticCli: AgenticCliPreference;\n priceAlerts: PriceAlertPreference;\n};\n\n// ---------------------------------------------------------------------------\n// Marketing consent\n// ---------------------------------------------------------------------------\n\n/** Marketing consent for the authenticated user (master toggle). */\nexport type MarketingConsent = {\n marketingConsentEnabled: boolean;\n};\n\n// ---------------------------------------------------------------------------\n// Identity-sharing consent\n// ---------------------------------------------------------------------------\n\n/** Partner audience that may receive verified identity claims. */\nexport type IdentitySharingAudience = 'kyc' | 'iron';\n\n/**\n * Granted identity-sharing audiences for the authenticated user.\n * Only granted keys are present; a missing key is not granted.\n */\nexport type IdentitySharingConsent = {\n kyc?: boolean;\n iron?: boolean;\n};\n\n/** Body for granting or revoking a single identity-sharing audience. */\nexport type IdentitySharingConsentWrite = {\n audience: IdentitySharingAudience;\n granted: boolean;\n};\n\n// ---------------------------------------------------------------------------\n// Assets watchlist\n// ---------------------------------------------------------------------------\n\n// `AssetsWatchlistBlob` is inferred from `AssetsWatchlistBlobSchema` in\n// `./validators` and re-exported here so the public type surface remains in\n// `./types`. Keeping the runtime schema and the static type co-located in\n// one file keeps the two in lock-step.\nexport type { AssetsWatchlistBlob } from './validators.js';\n\n// ---------------------------------------------------------------------------\n// Shared\n// ---------------------------------------------------------------------------\n\n/** The type of client making the request. */\nexport type ClientType = 'extension' | 'mobile' | 'portfolio';\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Hex } from '@metamask/utils';\n\n// ---------------------------------------------------------------------------\n// Delegations\n// ---------------------------------------------------------------------------\n\n/** A single caveat attached to a delegation. */\nexport type Caveat = {\n /** Address of the caveat enforcer contract (0x-prefixed). */\n enforcer: Hex;\n /** ABI-encoded caveat terms (0x-prefixed). */\n terms: Hex;\n /** ABI-encoded caveat arguments (0x-prefixed). */\n args: Hex;\n};\n\n/** An EIP-712 signed delegation. */\nexport type SignedDelegation = {\n /** Address the delegation is granted to (0x-prefixed). */\n delegate: Hex;\n /** Address granting the delegation (0x-prefixed). */\n delegator: Hex;\n /** Root authority or parent delegation hash (0x-prefixed). */\n authority: Hex;\n /** Caveats restricting how the delegation may be used. */\n caveats: Caveat[];\n /** Unique salt to prevent replay (0x-prefixed). */\n salt: Hex;\n /** EIP-712 signature over the delegation (0x-prefixed). */\n signature: Hex;\n};\n\n/** Metadata associated with a delegation. */\nexport type DelegationMetadata = {\n /** Keccak-256 hash uniquely identifying the delegation (0x-prefixed). */\n delegationHash: Hex;\n /** Chain ID in hex format (0x-prefixed). */\n chainIdHex: Hex;\n /** Token allowance in hex format (0x-prefixed). */\n allowance: Hex;\n /** Symbol of the token (e.g. \"USDC\"). */\n tokenSymbol: string;\n /** Token contract address (0x-prefixed). */\n tokenAddress: Hex;\n /** Type of delegation. */\n type: string;\n};\n\n/** Request body for submitting a new delegation. */\nexport type DelegationSubmission = {\n signedDelegation: SignedDelegation;\n metadata: DelegationMetadata;\n};\n\n/** A stored delegation record returned by the API. */\nexport type DelegationResponse = {\n signedDelegation: SignedDelegation;\n metadata: DelegationMetadata;\n};\n\n// ---------------------------------------------------------------------------\n// Preferences\n// ---------------------------------------------------------------------------\n\n/** Wallet activity tracking for a single address. */\nexport type WalletActivityAccount = {\n /** Wallet address to track activity for (0x-prefixed). */\n address: Hex;\n enabled: boolean;\n};\n\nexport type AgenticCliPreference = {\n inAppNotificationsEnabled: boolean;\n pushNotificationsEnabled: boolean;\n};\n\nexport type WalletActivityPreference = {\n inAppNotificationsEnabled: boolean;\n pushNotificationsEnabled: boolean;\n accounts: WalletActivityAccount[];\n};\n\nexport type MarketingPreference = {\n inAppNotificationsEnabled: boolean;\n pushNotificationsEnabled: boolean;\n};\n\nexport type PerpsWatchlistExchange = {\n testnet: string[];\n mainnet: string[];\n};\n\nexport type PerpsWatchlistMarkets = {\n hyperliquid: PerpsWatchlistExchange;\n};\n\nexport type PerpsPreference = {\n inAppNotificationsEnabled: boolean;\n pushNotificationsEnabled: boolean;\n watchlistMarkets?: PerpsWatchlistMarkets;\n};\n\nexport type SocialAIPreference = {\n inAppNotificationsEnabled: boolean;\n pushNotificationsEnabled: boolean;\n txAmountLimit?: number;\n mutedTraderProfileIds: string[];\n};\n\nexport type PriceAlertPreference = {\n inAppNotificationsEnabled: boolean;\n pushNotificationsEnabled: boolean;\n};\n\nexport type DryRunPreference = {\n inAppNotificationsEnabled: boolean;\n pushNotificationsEnabled: boolean;\n};\n\n/**\n * Notification preferences for the authenticated user.\n */\nexport type NotificationPreferences = {\n walletActivity: WalletActivityPreference;\n marketing: MarketingPreference;\n perps: PerpsPreference;\n socialAI: SocialAIPreference;\n agenticCli: AgenticCliPreference;\n priceAlerts: PriceAlertPreference;\n dryRun?: DryRunPreference;\n};\n\n// ---------------------------------------------------------------------------\n// Marketing consent\n// ---------------------------------------------------------------------------\n\n/** Marketing consent for the authenticated user (master toggle). */\nexport type MarketingConsent = {\n marketingConsentEnabled: boolean;\n};\n\n// ---------------------------------------------------------------------------\n// Identity-sharing consent\n// ---------------------------------------------------------------------------\n\n/** Partner audience that may receive verified identity claims. */\nexport type IdentitySharingAudience = 'kyc' | 'iron';\n\n/**\n * Granted identity-sharing audiences for the authenticated user.\n * Only granted keys are present; a missing key is not granted.\n */\nexport type IdentitySharingConsent = {\n kyc?: boolean;\n iron?: boolean;\n};\n\n/** Body for granting or revoking a single identity-sharing audience. */\nexport type IdentitySharingConsentWrite = {\n audience: IdentitySharingAudience;\n granted: boolean;\n};\n\n// ---------------------------------------------------------------------------\n// Assets watchlist\n// ---------------------------------------------------------------------------\n\n// `AssetsWatchlistBlob` is inferred from `AssetsWatchlistBlobSchema` in\n// `./validators` and re-exported here so the public type surface remains in\n// `./types`. Keeping the runtime schema and the static type co-located in\n// one file keeps the two in lock-step.\nexport type { AssetsWatchlistBlob } from './validators.js';\n\n// ---------------------------------------------------------------------------\n// Shared\n// ---------------------------------------------------------------------------\n\n/** The type of client making the request. */\nexport type ClientType = 'extension' | 'mobile' | 'portfolio';\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { Infer } from '@metamask/superstruct';
2
- import type { AgenticCliPreference, DelegationResponse, IdentitySharingConsent, IdentitySharingConsentWrite, MarketingConsent, NotificationPreferences, PriceAlertPreference } from './types.js';
2
+ import type { AgenticCliPreference, DelegationResponse, DryRunPreference, IdentitySharingConsent, IdentitySharingConsentWrite, MarketingConsent, NotificationPreferences, PriceAlertPreference } from './types.js';
3
3
  /**
4
4
  * Default Agentic CLI notification preferences for consumers building a
5
5
  * fresh `NotificationPreferences` object.
@@ -10,6 +10,11 @@ export declare const DEFAULT_AGENTIC_CLI_PREFERENCES: AgenticCliPreference;
10
10
  * fresh `NotificationPreferences` object.
11
11
  */
12
12
  export declare const DEFAULT_PRICE_ALERT_PREFERENCES: PriceAlertPreference;
13
+ /**
14
+ * Default dry-run notification preferences for consumers building a fresh
15
+ * `NotificationPreferences` object.
16
+ */
17
+ export declare const DEFAULT_DRY_RUN_PREFERENCES: DryRunPreference;
13
18
  /**
14
19
  * Maximum number of entries allowed in an assets-watchlist on write. Reads
15
20
  * are lenient: a server payload exceeding this size will still validate as
@@ -1 +1 @@
1
- {"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../src/validators.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAgBnD,OAAO,KAAK,EACV,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,2BAA2B,EAC3B,gBAAgB,EAChB,uBAAuB,EACvB,oBAAoB,EACrB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AAED;;;;;;;;;GASG;AACH,wBAAgB,iCAAiC,CAC/C,IAAI,EAAE,OAAO,GACZ,OAAO,CAAC,IAAI,IAAI,mBAAmB,CAErC"}
@@ -70,6 +70,10 @@ const PriceAlertPreferenceSchema = type({
70
70
  inAppNotificationsEnabled: boolean(),
71
71
  pushNotificationsEnabled: boolean(),
72
72
  });
73
+ const DryRunPreferenceSchema = type({
74
+ inAppNotificationsEnabled: boolean(),
75
+ pushNotificationsEnabled: boolean(),
76
+ });
73
77
  const NotificationPreferencesSchema = type({
74
78
  walletActivity: WalletActivityPreferenceSchema,
75
79
  marketing: MarketingPreferenceSchema,
@@ -77,6 +81,7 @@ const NotificationPreferencesSchema = type({
77
81
  socialAI: SocialAIPreferenceSchema,
78
82
  agenticCli: AgenticCliPreferenceSchema,
79
83
  priceAlerts: PriceAlertPreferenceSchema,
84
+ dryRun: optional(DryRunPreferenceSchema),
80
85
  });
81
86
  const MarketingConsentSchema = type({
82
87
  marketingConsentEnabled: boolean(),
@@ -105,6 +110,14 @@ export const DEFAULT_PRICE_ALERT_PREFERENCES = {
105
110
  inAppNotificationsEnabled: true,
106
111
  pushNotificationsEnabled: true,
107
112
  };
113
+ /**
114
+ * Default dry-run notification preferences for consumers building a fresh
115
+ * `NotificationPreferences` object.
116
+ */
117
+ export const DEFAULT_DRY_RUN_PREFERENCES = {
118
+ inAppNotificationsEnabled: true,
119
+ pushNotificationsEnabled: true,
120
+ };
108
121
  /**
109
122
  * Maximum number of entries allowed in an assets-watchlist on write. Reads
110
123
  * are lenient: a server payload exceeding this size will still validate as
@@ -1 +1 @@
1
- {"version":3,"file":"validators.js","sourceRoot":"","sources":["../src/validators.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,EACL,MAAM,EACN,MAAM,EACN,OAAO,EACP,KAAK,EACL,OAAO,EACP,MAAM,EACN,QAAQ,EACR,OAAO,EACP,IAAI,EACJ,MAAM,EACN,IAAI,GACL,MAAM,uBAAuB,CAAC;AAY/B;;;;;G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;GAKG;AACH,MAAM,UAAU,4BAA4B,CAC1C,IAAa;IAEb,MAAM,CAAC,IAAI,EAAE,4BAA4B,CAAC,CAAC;AAC7C,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,oCAAoC,CAClD,IAAa;IAEb,MAAM,CAAC,IAAI,EAAE,iCAAiC,CAAC,CAAC;AAClD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB,CACvC,IAAa;IAEb,MAAM,CAAC,IAAI,EAAE,yBAAyB,CAAC,CAAC;AAC1C,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,iCAAiC,CAC/C,IAAa;IAEb,MAAM,CAAC,IAAI,EAAE,8BAA8B,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport {\n array,\n assert,\n assign,\n boolean,\n enums,\n literal,\n number,\n optional,\n pattern,\n size,\n string,\n type,\n} from '@metamask/superstruct';\n\nimport type {\n AgenticCliPreference,\n DelegationResponse,\n IdentitySharingConsent,\n IdentitySharingConsentWrite,\n MarketingConsent,\n NotificationPreferences,\n PriceAlertPreference,\n} from './types.js';\n\n/**\n * Matches a 0x-prefixed hex string with zero or more hex digits.\n * Unlike `StrictHexStruct` from `@metamask/utils` (which requires at least\n * one digit after the prefix), this also accepts `\"0x\"` — the standard\n * encoding for empty bytes that the delegation API returns.\n */\nconst HexDataStruct = pattern(string(), /^0x[0-9a-f]*$/iu);\n\nconst CaveatSchema = type({\n enforcer: HexDataStruct,\n terms: HexDataStruct,\n args: HexDataStruct,\n});\n\nconst SignedDelegationSchema = type({\n delegate: HexDataStruct,\n delegator: HexDataStruct,\n authority: HexDataStruct,\n caveats: array(CaveatSchema),\n salt: HexDataStruct,\n signature: HexDataStruct,\n});\n\nconst DelegationMetadataSchema = type({\n delegationHash: HexDataStruct,\n chainIdHex: HexDataStruct,\n allowance: HexDataStruct,\n tokenSymbol: string(),\n tokenAddress: HexDataStruct,\n type: string(),\n});\n\nconst DelegationResponseSchema = type({\n signedDelegation: SignedDelegationSchema,\n metadata: DelegationMetadataSchema,\n});\n\nconst WalletActivityAccountSchema = type({\n address: HexDataStruct,\n enabled: boolean(),\n});\n\nconst WalletActivityPreferenceSchema = type({\n inAppNotificationsEnabled: boolean(),\n pushNotificationsEnabled: boolean(),\n accounts: array(WalletActivityAccountSchema),\n});\n\nconst MarketingPreferenceSchema = type({\n inAppNotificationsEnabled: boolean(),\n pushNotificationsEnabled: boolean(),\n});\n\nconst PerpsWatchlistExchangeSchema = type({\n testnet: array(string()),\n mainnet: array(string()),\n});\n\nconst PerpsWatchlistMarketsSchema = type({\n hyperliquid: PerpsWatchlistExchangeSchema,\n});\n\nconst PerpsPreferenceSchema = type({\n inAppNotificationsEnabled: boolean(),\n pushNotificationsEnabled: boolean(),\n watchlistMarkets: optional(PerpsWatchlistMarketsSchema),\n});\n\nconst SocialAIPreferenceSchema = type({\n inAppNotificationsEnabled: boolean(),\n pushNotificationsEnabled: boolean(),\n txAmountLimit: optional(number()),\n mutedTraderProfileIds: array(string()),\n});\n\nconst AgenticCliPreferenceSchema = type({\n inAppNotificationsEnabled: boolean(),\n pushNotificationsEnabled: boolean(),\n});\n\nconst PriceAlertPreferenceSchema = type({\n inAppNotificationsEnabled: boolean(),\n pushNotificationsEnabled: boolean(),\n});\n\nconst NotificationPreferencesSchema = type({\n walletActivity: WalletActivityPreferenceSchema,\n marketing: MarketingPreferenceSchema,\n perps: PerpsPreferenceSchema,\n socialAI: SocialAIPreferenceSchema,\n agenticCli: AgenticCliPreferenceSchema,\n priceAlerts: PriceAlertPreferenceSchema,\n});\n\nconst MarketingConsentSchema = type({\n marketingConsentEnabled: boolean(),\n});\n\nconst IdentitySharingConsentSchema = type({\n kyc: optional(boolean()),\n iron: optional(boolean()),\n});\n\nconst IdentitySharingConsentWriteSchema = type({\n audience: enums(['kyc', 'iron']),\n granted: boolean(),\n});\n\n/**\n * Default Agentic CLI notification preferences for consumers building a\n * fresh `NotificationPreferences` object.\n */\nexport const DEFAULT_AGENTIC_CLI_PREFERENCES: AgenticCliPreference = {\n inAppNotificationsEnabled: true,\n pushNotificationsEnabled: true,\n};\n\n/**\n * Default price-alert notification preferences for consumers building a\n * fresh `NotificationPreferences` object.\n */\nexport const DEFAULT_PRICE_ALERT_PREFERENCES: PriceAlertPreference = {\n inAppNotificationsEnabled: true,\n pushNotificationsEnabled: true,\n};\n\n/**\n * Maximum number of entries allowed in an assets-watchlist on write. Reads\n * are lenient: a server payload exceeding this size will still validate as\n * an `AssetsWatchlistBlob`. Encoded into\n * {@link AssetsWatchlistBlobWriteSchema}.\n */\nexport const ASSETS_WATCHLIST_MAX_ASSETS = 100;\n\n/**\n * The shape we accept on the way **in** from the server. Lenient by design:\n * a malformed payload throws, but a well-formed payload with more than\n * {@link ASSETS_WATCHLIST_MAX_ASSETS} assets is still considered valid so we\n * don't reject existing server-side data.\n */\nconst AssetsWatchlistBlobSchema = type({\n version: literal(1),\n assets: array(string()),\n});\n\n/**\n * The shape we accept on the way **out** to the server. Extends\n * {@link AssetsWatchlistBlobSchema} with a hard cap on `assets.length`.\n * Validation failures throw a `StructError`, e.g.\n * `\"At path: assets -- Expected a array with a length between \\`0\\` and\n * \\`100\\` but received one with a length of \\`N\\`\"`.\n */\nconst AssetsWatchlistBlobWriteSchema = assign(\n AssetsWatchlistBlobSchema,\n type({\n assets: size(array(string()), 0, ASSETS_WATCHLIST_MAX_ASSETS),\n }),\n);\n\n/**\n * The authenticated user's assets-watchlist: a mutable per-user singleton\n * blob.\n *\n * Each entry is a CAIP-19 asset identifier\n * (e.g. `eip155:1/erc20:0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48`).\n *\n * The `version` literal is carried inside the blob (not in the URL) so the\n * schema can evolve in a backwards-compatible way; bumping the version\n * indicates a different `assets` element shape.\n *\n * Inferred from {@link AssetsWatchlistBlobSchema} so the runtime schema and\n * the static type stay in lock-step. The size constraint on writes is\n * enforced by {@link AssetsWatchlistBlobWriteSchema} and is not encoded in\n * this static type (TypeScript cannot express \"array of length ≤ N\").\n */\nexport type AssetsWatchlistBlob = Infer<typeof AssetsWatchlistBlobSchema>;\n\n/**\n * Asserts that the given value is a valid `DelegationResponse[]`.\n *\n * @param data - The unknown value to validate.\n * @throws If the value does not match the expected schema.\n */\nexport function assertDelegationResponseArray(\n data: unknown,\n): asserts data is DelegationResponse[] {\n assert(data, array(DelegationResponseSchema));\n}\n\n/**\n * Asserts that the given value is a valid `NotificationPreferences`.\n *\n * @param data - The unknown value to validate.\n * @throws If the value does not match the expected schema.\n */\nexport function assertNotificationPreferences(\n data: unknown,\n): asserts data is NotificationPreferences {\n assert(data, NotificationPreferencesSchema);\n}\n\n/**\n * Asserts that the given value is a valid `MarketingConsent`.\n *\n * @param data - The unknown value to validate.\n * @throws If the value does not match the expected schema.\n */\nexport function assertMarketingConsent(\n data: unknown,\n): asserts data is MarketingConsent {\n assert(data, MarketingConsentSchema);\n}\n\n/**\n * Asserts that the given value is a valid `IdentitySharingConsent`.\n *\n * @param data - The unknown value to validate.\n * @throws If the value does not match the expected schema.\n */\nexport function assertIdentitySharingConsent(\n data: unknown,\n): asserts data is IdentitySharingConsent {\n assert(data, IdentitySharingConsentSchema);\n}\n\n/**\n * Asserts that the given value is a valid `IdentitySharingConsentWrite`\n * before it is sent to the API.\n *\n * @param data - The unknown value to validate.\n * @throws A `StructError` if `audience` is not `kyc` or `iron`, or if\n * `granted` is missing or not a boolean.\n */\nexport function assertIdentitySharingConsentForWrite(\n data: unknown,\n): asserts data is IdentitySharingConsentWrite {\n assert(data, IdentitySharingConsentWriteSchema);\n}\n\n/**\n * Asserts that the given value is a valid `AssetsWatchlistBlob` (read-side,\n * lenient).\n *\n * @param data - The unknown value to validate.\n * @throws If the value does not match the expected schema.\n */\nexport function assertAssetsWatchlistBlob(\n data: unknown,\n): asserts data is AssetsWatchlistBlob {\n assert(data, AssetsWatchlistBlobSchema);\n}\n\n/**\n * Asserts that the given value is a valid `AssetsWatchlistBlob` for\n * **writes**. In addition to the structural checks performed by\n * {@link assertAssetsWatchlistBlob}, this enforces that `assets` contains at\n * most {@link ASSETS_WATCHLIST_MAX_ASSETS} entries.\n *\n * @param data - The unknown value to validate.\n * @throws A `StructError` if the value does not match the expected schema\n * (including the size constraint).\n */\nexport function assertAssetsWatchlistBlobForWrite(\n data: unknown,\n): asserts data is AssetsWatchlistBlob {\n assert(data, AssetsWatchlistBlobWriteSchema);\n}\n"]}
1
+ {"version":3,"file":"validators.js","sourceRoot":"","sources":["../src/validators.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,EACL,MAAM,EACN,MAAM,EACN,OAAO,EACP,KAAK,EACL,OAAO,EACP,MAAM,EACN,QAAQ,EACR,OAAO,EACP,IAAI,EACJ,MAAM,EACN,IAAI,GACL,MAAM,uBAAuB,CAAC;AAa/B;;;;;GAKG;AACH,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,EAAE,EAAE,iBAAiB,CAAC,CAAC;AAE3D,MAAM,YAAY,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,aAAa;IACvB,KAAK,EAAE,aAAa;IACpB,IAAI,EAAE,aAAa;CACpB,CAAC,CAAC;AAEH,MAAM,sBAAsB,GAAG,IAAI,CAAC;IAClC,QAAQ,EAAE,aAAa;IACvB,SAAS,EAAE,aAAa;IACxB,SAAS,EAAE,aAAa;IACxB,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC;IAC5B,IAAI,EAAE,aAAa;IACnB,SAAS,EAAE,aAAa;CACzB,CAAC,CAAC;AAEH,MAAM,wBAAwB,GAAG,IAAI,CAAC;IACpC,cAAc,EAAE,aAAa;IAC7B,UAAU,EAAE,aAAa;IACzB,SAAS,EAAE,aAAa;IACxB,WAAW,EAAE,MAAM,EAAE;IACrB,YAAY,EAAE,aAAa;IAC3B,IAAI,EAAE,MAAM,EAAE;CACf,CAAC,CAAC;AAEH,MAAM,wBAAwB,GAAG,IAAI,CAAC;IACpC,gBAAgB,EAAE,sB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CAAC,IAAI,EAAE,8BAA8B,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport {\n array,\n assert,\n assign,\n boolean,\n enums,\n literal,\n number,\n optional,\n pattern,\n size,\n string,\n type,\n} from '@metamask/superstruct';\n\nimport type {\n AgenticCliPreference,\n DelegationResponse,\n DryRunPreference,\n IdentitySharingConsent,\n IdentitySharingConsentWrite,\n MarketingConsent,\n NotificationPreferences,\n PriceAlertPreference,\n} from './types.js';\n\n/**\n * Matches a 0x-prefixed hex string with zero or more hex digits.\n * Unlike `StrictHexStruct` from `@metamask/utils` (which requires at least\n * one digit after the prefix), this also accepts `\"0x\"` — the standard\n * encoding for empty bytes that the delegation API returns.\n */\nconst HexDataStruct = pattern(string(), /^0x[0-9a-f]*$/iu);\n\nconst CaveatSchema = type({\n enforcer: HexDataStruct,\n terms: HexDataStruct,\n args: HexDataStruct,\n});\n\nconst SignedDelegationSchema = type({\n delegate: HexDataStruct,\n delegator: HexDataStruct,\n authority: HexDataStruct,\n caveats: array(CaveatSchema),\n salt: HexDataStruct,\n signature: HexDataStruct,\n});\n\nconst DelegationMetadataSchema = type({\n delegationHash: HexDataStruct,\n chainIdHex: HexDataStruct,\n allowance: HexDataStruct,\n tokenSymbol: string(),\n tokenAddress: HexDataStruct,\n type: string(),\n});\n\nconst DelegationResponseSchema = type({\n signedDelegation: SignedDelegationSchema,\n metadata: DelegationMetadataSchema,\n});\n\nconst WalletActivityAccountSchema = type({\n address: HexDataStruct,\n enabled: boolean(),\n});\n\nconst WalletActivityPreferenceSchema = type({\n inAppNotificationsEnabled: boolean(),\n pushNotificationsEnabled: boolean(),\n accounts: array(WalletActivityAccountSchema),\n});\n\nconst MarketingPreferenceSchema = type({\n inAppNotificationsEnabled: boolean(),\n pushNotificationsEnabled: boolean(),\n});\n\nconst PerpsWatchlistExchangeSchema = type({\n testnet: array(string()),\n mainnet: array(string()),\n});\n\nconst PerpsWatchlistMarketsSchema = type({\n hyperliquid: PerpsWatchlistExchangeSchema,\n});\n\nconst PerpsPreferenceSchema = type({\n inAppNotificationsEnabled: boolean(),\n pushNotificationsEnabled: boolean(),\n watchlistMarkets: optional(PerpsWatchlistMarketsSchema),\n});\n\nconst SocialAIPreferenceSchema = type({\n inAppNotificationsEnabled: boolean(),\n pushNotificationsEnabled: boolean(),\n txAmountLimit: optional(number()),\n mutedTraderProfileIds: array(string()),\n});\n\nconst AgenticCliPreferenceSchema = type({\n inAppNotificationsEnabled: boolean(),\n pushNotificationsEnabled: boolean(),\n});\n\nconst PriceAlertPreferenceSchema = type({\n inAppNotificationsEnabled: boolean(),\n pushNotificationsEnabled: boolean(),\n});\n\nconst DryRunPreferenceSchema = type({\n inAppNotificationsEnabled: boolean(),\n pushNotificationsEnabled: boolean(),\n});\n\nconst NotificationPreferencesSchema = type({\n walletActivity: WalletActivityPreferenceSchema,\n marketing: MarketingPreferenceSchema,\n perps: PerpsPreferenceSchema,\n socialAI: SocialAIPreferenceSchema,\n agenticCli: AgenticCliPreferenceSchema,\n priceAlerts: PriceAlertPreferenceSchema,\n dryRun: optional(DryRunPreferenceSchema),\n});\n\nconst MarketingConsentSchema = type({\n marketingConsentEnabled: boolean(),\n});\n\nconst IdentitySharingConsentSchema = type({\n kyc: optional(boolean()),\n iron: optional(boolean()),\n});\n\nconst IdentitySharingConsentWriteSchema = type({\n audience: enums(['kyc', 'iron']),\n granted: boolean(),\n});\n\n/**\n * Default Agentic CLI notification preferences for consumers building a\n * fresh `NotificationPreferences` object.\n */\nexport const DEFAULT_AGENTIC_CLI_PREFERENCES: AgenticCliPreference = {\n inAppNotificationsEnabled: true,\n pushNotificationsEnabled: true,\n};\n\n/**\n * Default price-alert notification preferences for consumers building a\n * fresh `NotificationPreferences` object.\n */\nexport const DEFAULT_PRICE_ALERT_PREFERENCES: PriceAlertPreference = {\n inAppNotificationsEnabled: true,\n pushNotificationsEnabled: true,\n};\n\n/**\n * Default dry-run notification preferences for consumers building a fresh\n * `NotificationPreferences` object.\n */\nexport const DEFAULT_DRY_RUN_PREFERENCES: DryRunPreference = {\n inAppNotificationsEnabled: true,\n pushNotificationsEnabled: true,\n};\n\n/**\n * Maximum number of entries allowed in an assets-watchlist on write. Reads\n * are lenient: a server payload exceeding this size will still validate as\n * an `AssetsWatchlistBlob`. Encoded into\n * {@link AssetsWatchlistBlobWriteSchema}.\n */\nexport const ASSETS_WATCHLIST_MAX_ASSETS = 100;\n\n/**\n * The shape we accept on the way **in** from the server. Lenient by design:\n * a malformed payload throws, but a well-formed payload with more than\n * {@link ASSETS_WATCHLIST_MAX_ASSETS} assets is still considered valid so we\n * don't reject existing server-side data.\n */\nconst AssetsWatchlistBlobSchema = type({\n version: literal(1),\n assets: array(string()),\n});\n\n/**\n * The shape we accept on the way **out** to the server. Extends\n * {@link AssetsWatchlistBlobSchema} with a hard cap on `assets.length`.\n * Validation failures throw a `StructError`, e.g.\n * `\"At path: assets -- Expected a array with a length between \\`0\\` and\n * \\`100\\` but received one with a length of \\`N\\`\"`.\n */\nconst AssetsWatchlistBlobWriteSchema = assign(\n AssetsWatchlistBlobSchema,\n type({\n assets: size(array(string()), 0, ASSETS_WATCHLIST_MAX_ASSETS),\n }),\n);\n\n/**\n * The authenticated user's assets-watchlist: a mutable per-user singleton\n * blob.\n *\n * Each entry is a CAIP-19 asset identifier\n * (e.g. `eip155:1/erc20:0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48`).\n *\n * The `version` literal is carried inside the blob (not in the URL) so the\n * schema can evolve in a backwards-compatible way; bumping the version\n * indicates a different `assets` element shape.\n *\n * Inferred from {@link AssetsWatchlistBlobSchema} so the runtime schema and\n * the static type stay in lock-step. The size constraint on writes is\n * enforced by {@link AssetsWatchlistBlobWriteSchema} and is not encoded in\n * this static type (TypeScript cannot express \"array of length ≤ N\").\n */\nexport type AssetsWatchlistBlob = Infer<typeof AssetsWatchlistBlobSchema>;\n\n/**\n * Asserts that the given value is a valid `DelegationResponse[]`.\n *\n * @param data - The unknown value to validate.\n * @throws If the value does not match the expected schema.\n */\nexport function assertDelegationResponseArray(\n data: unknown,\n): asserts data is DelegationResponse[] {\n assert(data, array(DelegationResponseSchema));\n}\n\n/**\n * Asserts that the given value is a valid `NotificationPreferences`.\n *\n * @param data - The unknown value to validate.\n * @throws If the value does not match the expected schema.\n */\nexport function assertNotificationPreferences(\n data: unknown,\n): asserts data is NotificationPreferences {\n assert(data, NotificationPreferencesSchema);\n}\n\n/**\n * Asserts that the given value is a valid `MarketingConsent`.\n *\n * @param data - The unknown value to validate.\n * @throws If the value does not match the expected schema.\n */\nexport function assertMarketingConsent(\n data: unknown,\n): asserts data is MarketingConsent {\n assert(data, MarketingConsentSchema);\n}\n\n/**\n * Asserts that the given value is a valid `IdentitySharingConsent`.\n *\n * @param data - The unknown value to validate.\n * @throws If the value does not match the expected schema.\n */\nexport function assertIdentitySharingConsent(\n data: unknown,\n): asserts data is IdentitySharingConsent {\n assert(data, IdentitySharingConsentSchema);\n}\n\n/**\n * Asserts that the given value is a valid `IdentitySharingConsentWrite`\n * before it is sent to the API.\n *\n * @param data - The unknown value to validate.\n * @throws A `StructError` if `audience` is not `kyc` or `iron`, or if\n * `granted` is missing or not a boolean.\n */\nexport function assertIdentitySharingConsentForWrite(\n data: unknown,\n): asserts data is IdentitySharingConsentWrite {\n assert(data, IdentitySharingConsentWriteSchema);\n}\n\n/**\n * Asserts that the given value is a valid `AssetsWatchlistBlob` (read-side,\n * lenient).\n *\n * @param data - The unknown value to validate.\n * @throws If the value does not match the expected schema.\n */\nexport function assertAssetsWatchlistBlob(\n data: unknown,\n): asserts data is AssetsWatchlistBlob {\n assert(data, AssetsWatchlistBlobSchema);\n}\n\n/**\n * Asserts that the given value is a valid `AssetsWatchlistBlob` for\n * **writes**. In addition to the structural checks performed by\n * {@link assertAssetsWatchlistBlob}, this enforces that `assets` contains at\n * most {@link ASSETS_WATCHLIST_MAX_ASSETS} entries.\n *\n * @param data - The unknown value to validate.\n * @throws A `StructError` if the value does not match the expected schema\n * (including the size constraint).\n */\nexport function assertAssetsWatchlistBlobForWrite(\n data: unknown,\n): asserts data is AssetsWatchlistBlob {\n assert(data, AssetsWatchlistBlobWriteSchema);\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/authenticated-user-storage",
3
- "version": "4.1.0-preview-8cc0f94",
3
+ "version": "4.1.0-preview-377206492",
4
4
  "description": "SDK for authenticated (non-encrypted) user storage endpoints",
5
5
  "keywords": [
6
6
  "Ethereum",