fetchBondAdmin
Reads the pox-5 bond-admin data-var and returns the principal that can set up protocol bonds and transfer the role.
Usage
import { fetchBondAdmin } from '@stacks/bitcoin-staking';
const bondAdmin = await fetchBondAdmin({ network: 'mainnet' });Notes
Reads the
bond-admindata-var through the node's/v2/data_varendpoint. pox-5 has no read-only accessor for it.The value changes when
set-bond-adminsucceeds, so read it rather than caching it. On networks other than mainnet, the node sets the initial value from its configuration before deploying pox-5.A non-2xx response throws an
Errorwhose message starts withError fetching bond-admin.and includes the status code and URL.
Signature
function fetchBondAdmin(opts?: NetworkClientParam): Promise<string>;opts is a NetworkClientParam.
Returns
Promise<string>
The bond-admin principal as a Stacks address string. A contract principal comes back as <address>.<contract-name>.
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?