Skip to main content

SnapRegistryController Actions

6 actions registered.

NameDeprecated
get
getMetadata
getState
requestPeriodicUpdate
requestUpdate
resolveVersion

SnapRegistryController:get​

Package: @metamask/snaps-controllers

Handler signature:

(snaps: SnapRegistryRequest, skipRefetch?: boolean) => Promise<Record<string, SnapRegistryResult>>

SnapRegistryController:getMetadata​

Package: @metamask/snaps-controllers

Get metadata for the given snap ID, if available, without updating registry.

Parameters:

NameDescription
snapIdThe ID of the snap to get metadata for.

Returns: The metadata for the given snap ID, or null if the snap is not verified.

Handler signature:

(snapId: string) => SnapRegistryMetadata | null

SnapRegistryController:getState​

Package: @metamask/snaps-controllers

Handler signature:

() => SnapRegistryControllerState

SnapRegistryController:requestPeriodicUpdate​

Package: @metamask/snaps-controllers

Request a periodic update of the registry database.

This useful for updating the database with a longer interval than the recent fetch threshold, which can help to reduce the number of fetches while still keeping the database reasonably up to date.

Handler signature:

() => Promise<void>

SnapRegistryController:requestUpdate​

Package: @metamask/snaps-controllers

Triggers an update of the registry database.

If an existing update is in progress this function will await that update.

Handler signature:

() => Promise<void>

SnapRegistryController:resolveVersion​

Package: @metamask/snaps-controllers

Find an allowlisted version within a specified version range. Otherwise return the version range itself.

Parameters:

NameDescription
snapIdThe ID of the snap we are trying to resolve a version for.
versionRangeThe version range.
refetchAn optional flag used to determine if we are refetching the registry.

Returns: An allowlisted version within the specified version range if available otherwise returns the input version range.

Handler signature:

(snapId: string, versionRange: SemVerRange, refetch?: boolean) => Promise<SemVerRange>