GeolocationController Actions
4 actions registered.
| Name | Deprecated |
|---|---|
getGeolocation | |
getGeolocationData | |
getState | |
refreshGeolocation |
GeolocationController:getGeolocation
Package: @metamask/geolocation-controller
Returns the geolocation code. Delegates to the
GeolocationApiService for network fetching and caching, then
updates controller state with the result.
Best-effort: if the fetch fails, the last known location code (or
UNKNOWN_LOCATION) is returned rather than throwing.
Returns: The ISO 3166-2 location code string.
Handler signature:
() => Promise<string>
GeolocationController:getGeolocationData
Package: @metamask/geolocation-controller
Returns the country, region, and timezone for the current client.
Delegates to the GeolocationApiService for network fetching and
caching, then updates controller state with the result.
Unlike getGeolocation, this rejects when resolution fails instead
of returning a stale value, so callers can distinguish a fresh result from
a failed lookup (and, for example, omit location rather than enrich with a
previous session's data).
Returns: The geolocation data, where each field is null when it could not be determined.
Handler signature:
() => Promise<GeolocationData>
GeolocationController:getState
Package: @metamask/geolocation-controller
Retrieves the state of the GeolocationController.
Handler signature:
() => GeolocationControllerState
GeolocationController:refreshGeolocation
Package: @metamask/geolocation-controller
Forces a fresh geolocation fetch, bypassing the service's cache.
Best-effort: if the fetch fails, the last known location code (or
UNKNOWN_LOCATION) is returned rather than throwing.
Returns: The ISO 3166-2 location code string.
Handler signature:
() => Promise<string>