For the complete documentation index, see llms.txt. This page is also available as Markdown.

fetchEligibleSetBondAdmin

Dry-runs the only check of pox-5 set-bond-admin: that the caller is the current bond admin. Reads the admin with fetchBondAdmin and compares. Run it before buildSetBondAdmin.


Usage

import { fetchEligibleSetBondAdmin } from '@stacks/bitcoin-staking';

const result = await fetchEligibleSetBondAdmin({
  caller: 'SP72DMR3MJKS7RVBY33JVV7EEJSQ1PYDVKDP10FX', // initial mainnet bond-admin in the pox-5 source
  network: 'mainnet',
});

if (!result.ok) console.log(result.reasons); // [1]: Pox5ErrorCode.Unauthorized

Notes

  • Mirrors set-bond-admin, which asserts contract-caller equals the bond-admin data-var and otherwise fails with ERR_UNAUTHORIZED (u1).

  • The comparison is an exact string match against the current bond-admin principal.

  • Throws if the /v2/data_var read returns a non-2xx response.

Reference Link


Signature

opts also takes the NetworkClientParam fields.


Returns

Promise<EligibilityResult>

Resolves to an EligibilityResult: { ok: true } if caller is the current bond admin, otherwise { ok: false, reasons: [Pox5ErrorCode.Unauthorized] }.


Parameters

opts.caller (required)

  • Type: string

The principal that would send the transaction (the contract's contract-caller).

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?