ClientWithSubscribeToIdentity

type ClientWithSubscribeToIdentity = object;

Represents a client that advertises client.identity as reactive.

A plugin that can mutate client.identity over time installs this sibling function so that reactive consumers can re-read the capability without having to know which plugin installed it.

The listener is invoked whenever the observable value of client.identity may have changed; consumers should re-read client.identity to get the current value.

Example

import { type ClientWithIdentity, type ClientWithSubscribeToIdentity } from '@solana/plugin-interfaces';
 
function observeIdentity(client: ClientWithIdentity & ClientWithSubscribeToIdentity) {
    return client.subscribeToIdentity(() => {
        console.log('identity is now', client.identity);
    });
}

See

Properties

subscribeToIdentity

readonly subscribeToIdentity: SubscribeToFn;

Registers a listener to be called whenever client.identity may have changed. Returns an unsubscribe function.

On this page