Module registry_sdk

Module registry_sdk 

Source
Expand description

Local registry SDK for program-test.

This module provides the minimal registry program SDK functionality needed for forester and compressible modules without requiring the devenv feature. It reimplements the necessary constants, PDA derivation, type definitions, and instruction builders locally to avoid anchor program dependencies.

Structs§

CompressAndCloseIndices
Indices for CompressAndClose operation (matches registry program’s definition).
EpochPda
EpochPda account structure for serialization.
ForesterConfig
Configuration for a forester.
ForesterEpochPda
ForesterEpochPda account structure for serialization.
ForesterPda
Forester PDA account structure.
ProtocolConfig
Protocol configuration.
ProtocolConfigPda
Protocol config PDA account structure. Includes Anchor’s 8-byte discriminator at the start.

Constants§

CLAIM_DISCRIMINATOR
Claim instruction discriminator
COMPRESS_AND_CLOSE_DISCRIMINATOR
CompressAndClose instruction discriminator
EPOCH_PDA_DISCRIMINATOR
EpochPda account discriminator
FINALIZE_REGISTRATION_DISCRIMINATOR
FinalizeRegistration instruction discriminator
FORESTER_EPOCH_PDA_DISCRIMINATOR
ForesterEpochPda account discriminator
FORESTER_EPOCH_SEED
FORESTER_PDA_DISCRIMINATOR
ForesterPda account discriminator
FORESTER_SEED
PROTOCOL_CONFIG_PDA_DISCRIMINATOR
ProtocolConfigPda account discriminator
PROTOCOL_CONFIG_PDA_SEED
REGISTER_FORESTER_DISCRIMINATOR
RegisterForester instruction discriminator
REGISTER_FORESTER_EPOCH_DISCRIMINATOR
RegisterForesterEpoch instruction discriminator
REGISTRY_PROGRAM_ID
Registry program ID
REPORT_WORK_DISCRIMINATOR
ReportWork instruction discriminator

Functions§

build_claim_instruction
Builds the Claim instruction.
build_compress_and_close_instruction
Builds the CompressAndClose instruction.
create_finalize_registration_instruction
Builds the FinalizeRegistration instruction.
create_register_forester_epoch_pda_instruction
Builds the RegisterForesterEpoch instruction.
create_register_forester_instruction
Builds the RegisterForester instruction.
deserialize_forester_pda
Deserializes a ForesterPda from account data. Skips the 8-byte Anchor discriminator automatically.
deserialize_protocol_config_pda
Deserializes a ProtocolConfigPda from account data. Skips the 8-byte Anchor discriminator automatically.
get_epoch_pda_address
Derives the epoch PDA address for a given epoch.
get_forester_epoch_pda
Derives the forester epoch PDA from forester PDA and epoch.
get_forester_epoch_pda_from_authority
Derives the forester epoch PDA from authority and epoch.
get_forester_pda
Derives the forester PDA for a given authority.
get_protocol_config_pda_address
Derives the protocol config PDA address.
protocol_config_for_tests
Creates a ProtocolConfig with a very long active phase (effectively infinite). This allows any slot to be in epoch 0’s active phase.
serialize_epoch_pda
Serializes an EpochPda to account data with Anchor discriminator.
serialize_forester_epoch_pda
Serializes a ForesterEpochPda to account data with Anchor discriminator.
serialize_forester_pda
Serializes a ForesterPda to account data with Anchor discriminator.
serialize_protocol_config_pda
Serializes a ProtocolConfigPda to account data with Anchor discriminator.
setup_test_protocol_accounts
Sets up protocol config, forester, and forester epoch accounts for testing. Uses a very long active phase so any slot is valid for epoch 0.