@parity/light.js
Version:
A high-level reactive JS library optimized for light clients
34 lines (30 loc) • 933 B
text/typescript
// Copyright 2015-2019 Parity Technologies (UK) Ltd.
// This file is part of Parity.
//
// SPDX-License-Identifier: MIT
import { AccountsInfo, Address, FrequencyObservableOptions } from '../types';
import createPubsubObservable from './utils/createPubsubObservable';
/**
* Observable that emits each time the default account changes
*
* @param options - Options to pass to {@link FrequencyObservable}.
*/
export function onAccountsChanged$ (options?: FrequencyObservableOptions) {
return createPubsubObservable<Address[]>(
'eth_accounts',
'eth_accounts',
options
);
}
/**
* Observable that emits each time the default account changes
*
* @param options - Options to pass to {@link FrequencyObservable}.
*/
export function onAccountsInfoChanged$ (options?: FrequencyObservableOptions) {
return createPubsubObservable<AccountsInfo>(
'parity_accountsInfo',
'parity_accountsInfo',
options
);
}