Contents

hintPowerState#

Report the host system’s current power source.

Request:

The request args must be a HintPowerStateRequest object.

Response:

On success, the result is an empty object.

Side effects:

Records the host’s power state, which affects whether free opportunistic refreshes run. When the power source changes, running background tasks are woken up.

Details:

The power source controls whether wallet-core may refresh coins opportunistically, long before they expire: such early refreshes are only made when they are free of charge, and only on external power. The unknown power source never qualifies. When the power source changes, wallet-core restarts all running background tasks.

The reported power source is a transient observation: it is discarded when wallet-core restarts, and if no fresh hint arrives within 60 seconds the effective power source falls back to unknown. Clients should therefore re-report the power state periodically and after any change.

interface HintPowerStateRequest {
  // Currently observed power source of the host system.
  powerSource: WalletPowerSource;
}
// Power source of the host system, as observed by the client.
type WalletPowerSource = "external" | "battery" | "unknown";