Skip to main content

AuthenticatedUserStorageService Actions

16 actions registered.

NameDeprecated
clearUserAssets
createDelegation
getAssetsWatchlist
getIdentitySharingConsent
getMarketingConsent
getNotificationPreferences
getUserAssets
hideTokens
importTokens
listDelegations
putIdentitySharingConsent
putMarketingConsent
putNotificationPreferences
revokeDelegation
setAssetsWatchlist
setUserAssets

AuthenticatedUserStorageService:clearUserAssets​

Package: @metamask/authenticated-user-storage

Wipes the user's custom tokens, restoring a clean slate (empty lists).

Parameters:

NameDescription
clientTypeOptional client type header.

Handler signature:

(clientType?: ClientType) => Promise<void>

AuthenticatedUserStorageService:createDelegation​

Package: @metamask/authenticated-user-storage

Stores a signed delegation record for the authenticated user.

Parameters:

NameDescription
submissionThe signed delegation and its metadata.
clientTypeOptional client type header.

Handler signature:

(submission: DelegationSubmission, clientType?: ClientType) => Promise<void>

AuthenticatedUserStorageService:getAssetsWatchlist​

Package: @metamask/authenticated-user-storage

Returns the assets-watchlist for the authenticated user.

Returns: The assets-watchlist blob, or null if none has been set (404).

Handler signature:

() => Promise<AssetsWatchlistBlob | null>

AuthenticatedUserStorageService:getIdentitySharingConsent​

Package: @metamask/authenticated-user-storage

Returns the identity-sharing consent for the authenticated user.

Returns: The granted-audience map, or null if none has been set (404).

Handler signature:

() => Promise<IdentitySharingConsent | null>

AuthenticatedUserStorageService:getMarketingConsent​

Package: @metamask/authenticated-user-storage

Returns the marketing consent for the authenticated user.

Returns: The marketing consent object, or null if none has been set (404).

Handler signature:

() => Promise<MarketingConsent | null>

AuthenticatedUserStorageService:getNotificationPreferences​

Package: @metamask/authenticated-user-storage

Returns the notification preferences for the authenticated user.

Returns: The notification preferences object, or null if none have been set (404).

Handler signature:

() => Promise<NotificationPreferences | null>

AuthenticatedUserStorageService:getUserAssets​

Package: @metamask/authenticated-user-storage

Returns the user-assets (custom tokens) blob for the authenticated user.

Returns: The user-assets blob, or null if none has been set (404).

Handler signature:

() => Promise<UserAssetsBlob | null>

AuthenticatedUserStorageService:hideTokens​

Package: @metamask/authenticated-user-storage

Hides custom tokens: adds the given identifiers to hiddenAssets (de-duplicated, order preserved) and removes them from importedAssets. Creates a fresh blob if none exists yet.

Parameters:

NameDescription
idsThe CAIP-19 asset identifiers of the tokens to hide.
clientTypeOptional client type header.

Returns: The resolved user-assets blob that was persisted.

Handler signature:

(ids: string[], clientType?: ClientType) => Promise<UserAssetsBlob>

AuthenticatedUserStorageService:importTokens​

Package: @metamask/authenticated-user-storage

Imports custom tokens: adds the given identifiers to importedAssets (de-duplicated, order preserved) and removes them from hiddenAssets. Creates a fresh blob if none exists yet.

Parameters:

NameDescription
idsThe CAIP-19 asset identifiers of the tokens to import.
clientTypeOptional client type header.

Returns: The resolved user-assets blob that was persisted.

Handler signature:

(ids: string[], clientType?: ClientType) => Promise<UserAssetsBlob>

AuthenticatedUserStorageService:listDelegations​

Package: @metamask/authenticated-user-storage

Returns all delegation records belonging to the authenticated user.

Returns: An array of delegation records, or an empty array if none exist.

Handler signature:

() => Promise<DelegationResponse[]>

AuthenticatedUserStorageService:putIdentitySharingConsent​

Package: @metamask/authenticated-user-storage

Grants or revokes identity-sharing consent for a single audience. Other audiences on the profile are left unchanged.

Parameters:

NameDescription
writeThe audience and whether it is granted.
clientTypeOptional client type header.

Handler signature:

(write: IdentitySharingConsentWrite, clientType?: ClientType) => Promise<void>

AuthenticatedUserStorageService:putMarketingConsent​

Package: @metamask/authenticated-user-storage

Creates or updates the marketing consent for the authenticated user.

Parameters:

NameDescription
consentThe full marketing consent object.
clientTypeOptional client type header.

Handler signature:

(consent: MarketingConsent, clientType?: ClientType) => Promise<void>

AuthenticatedUserStorageService:putNotificationPreferences​

Package: @metamask/authenticated-user-storage

Creates or updates the notification preferences for the authenticated user.

Parameters:

NameDescription
prefsThe full notification preferences object.
clientTypeOptional client type header.

Handler signature:

(prefs: NotificationPreferences, clientType?: ClientType) => Promise<void>

AuthenticatedUserStorageService:revokeDelegation​

Package: @metamask/authenticated-user-storage

Revokes (deletes) a delegation record.

Parameters:

NameDescription
delegationHashThe unique hash identifying the delegation.

Handler signature:

(delegationHash: string) => Promise<void>

AuthenticatedUserStorageService:setAssetsWatchlist​

Package: @metamask/authenticated-user-storage

Creates or updates the assets-watchlist for the authenticated user.

Parameters:

NameDescription
blobThe full assets-watchlist blob. The assets array may contain at most ASSETS_WATCHLIST_MAX_ASSETS CAIP-19 asset identifiers; this is enforced by assertAssetsWatchlistBlobForWrite before the request is sent.
clientTypeOptional client type header.

Handler signature:

(blob: AssetsWatchlistBlob, clientType?: ClientType) => Promise<void>

AuthenticatedUserStorageService:setUserAssets​

Package: @metamask/authenticated-user-storage

Creates or updates the user-assets (custom tokens) blob for the authenticated user. The blob is normalized (de-duplicated, conflicts resolved fail-open in favor of importedAssets) before it is sent.

Parameters:

NameDescription
blobThe full user-assets blob, with CAIP-19 asset identifiers.
clientTypeOptional client type header.

Handler signature:

(blob: UserAssetsBlob, clientType?: ClientType) => Promise<void>