watchAccounts
Subscribe to changes of the known accounts; returns an unsubscribe function.
Import
ts
import { watchAccounts } from "@0xcurvy/curvy-sdk/actions";Usage
ts
const unsubscribe = watchAccounts({ onChange: (accounts) => render(accounts) });Signature
ts
function watchAccounts(parameters: WatchAccountsParameters): () => voidReturns
() => void
The action resolves or returns the value shown in the signature.
Parameters
onChange
- Type:
(accounts: CurvyAccountData[]) => void - Required: yes
Invoked with the full account list whenever the set of accounts changes.
ts
const result = watchAccounts({
onChange,
});config
- Type:
CurvyConfig - Required: no
Curvy config to use. Defaults to the ambient config.
ts
const result = watchAccounts({
onChange,
config,
});Errors
Errors from config resolution and the underlying SDK operation are propagated to the caller.
Related
- Authentication guide
watchActiveAccount— Subscribe to changes of the active account; returns an unsubscribe function.