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

fetchAmountDelegatedForSigner

Reads the total micro-STX delegated to a signer-manager for one reward cycle, from protocol bonds and STX-only staking. Wraps the pox-5 read-only get-amount-delegated-for-signer, which reads the signer-delegated-per-cycle map.


Usage

import { fetchAmountDelegatedForSigner, fetchPoxInfo, fetchSignerSetFirstItem } from '@stacks/bitcoin-staking';

const { rewardCycleId: rewardCycle } = await fetchPoxInfo({ network: 'mainnet' });
// Any signer-manager in this cycle's signer set
const signerManager = await fetchSignerSetFirstItem({ rewardCycle, network: 'mainnet' });

if (signerManager) {
  const ustx = await fetchAmountDelegatedForSigner({ signerManager, rewardCycle, network: 'mainnet' });
}

Notes


Signature

opts is a NetworkClientParam plus signerManager and rewardCycle.


Returns

Promise<bigint>

Resolves to an amount in micro-STX.


Parameters

opts.signerManager (required)

  • Type: string

Contract principal of the signer-manager, in the form <address>.<contract-name>. pox-5 keys signer state by this principal.

opts.rewardCycle (required)

  • Type: number

Reward cycle to read.

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?