fetchSignerInfo
Reads the signer key registered for a signer-manager. Wraps the pox-5 read-only get-signer-info, which reads the signers map.
Usage
import { fetchPoxInfo, fetchSignerInfo, fetchSignerSetFirstItem } from '@stacks/bitcoin-staking';
const { rewardCycleId: rewardCycle } = await fetchPoxInfo({ network: 'mainnet' });
const signerManager = await fetchSignerSetFirstItem({ rewardCycle, network: 'mainnet' });
if (signerManager) {
const info = await fetchSignerInfo({ signerManager, network: 'mainnet' });
info?.signerKey; // 33-byte compressed public key, hex
}Notes
register-signerwrites the entry. Only the signer-manager contract can call it, and the key needs an active signer key grant (register-signer).The stored value is a 33-byte compressed public key (signers).
signerKeyis lowercase hex without a0xprefix.revoke-signer-grantleaves this entry in place (revoke-signer-grant). Use fetchVerifySignerKeyGrant to check that the grant is still active.A non-2xx response throws an
Errorwhose message starts withError calling read-only function.and includes the status code and URL. If the node reports that the call failed, theErrormessage is the node'scause.
Signature
opts is a NetworkClientParam plus signerManager.
Returns
Promise<{ signerKey: string } | undefined>
Resolves to the registered key, or undefined when the signer-manager has not registered.
signerKey
string
Compressed secp256k1 public key, 33 bytes as lowercase hex
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.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?