fetchRewardsPaused
Reads the pox-5 rewards-paused data-var and returns true once the pause admin has called pause-rewards.
Usage
import { fetchRewardsPaused } from '@stacks/bitcoin-staking';
const paused = await fetchRewardsPaused({ network: 'mainnet' }); // false on mainnet when this was writtenNotes
Reads the
rewards-pauseddata-var through the node's/v2/data_varendpoint. pox-5 has no read-only accessor for it.While it is
true,claim-rewardsfails withERR_REWARDS_PAUSED (u53)(L2404).The pause is one-way. pox-5 has no unpause function, and the contract's comment states that recovery requires a hard fork (L486-L497).
A non-2xx response throws an
Errorwhose message starts withError fetching rewards-paused.and includes the status code and URL.
Signature
function fetchRewardsPaused(opts?: NetworkClientParam): Promise<boolean>;opts is a NetworkClientParam.
Returns
Promise<boolean>
true if signer reward claims are paused, false otherwise.
Parameters
opts.network (optional)
Type:
StacksNetworkName | StacksNetwork
The network to query: a name such as 'mainnet' or 'testnet', or a StacksNetwork object. Defaults to 'mainnet'.
opts.client (optional)
Type:
{ baseUrl?: string; fetch?: FetchFn }
Overrides the API base URL or the fetch function, for example to query your own node. Fields you set replace the network's defaults.
Was this helpful?