Skip to main content

Crate satrush_client

Crate satrush_client 

Source

Modules§

accounts
This code was AUTOGENERATED using the codama library. Please DO NOT EDIT THIS FILE, instead use visitors to add features, then rerun codama to update it.
gpa
getProgramAccounts queries: scan the program’s accounts by discriminator (account type) plus field filters, returning decoded accounts.
instructions
This code was AUTOGENERATED using the codama library. Please DO NOT EDIT THIS FILE, instead use visitors to add features, then rerun codama to update it.
test_utils
Mock swap route support for validation environments.
types
This code was AUTOGENERATED using the codama library. Please DO NOT EDIT THIS FILE, instead use visitors to add features, then rerun codama to update it.

Structs§

BtcSharesValue
BTC value of a sats-vault share amount, as computed by sats_to_btc.
DecodedAccount

Enums§

BtcSharesValueError
BtcToSatsError
MaybeAccount
SatrushError

Constants§

ASSOCIATED_TOKEN_PROGRAM_ID
SPL Associated Token Account program.
SATRUSH_ID
satrush program ID.
SLOT_HASHES_ID
SlotHashes sysvar.
SYSTEM_PROGRAM_ID
System program.
TILE_COUNT
Number of selectable tiles on the board.
TOKEN_PROGRAM_ID
SPL Token program.

Functions§

btc_to_sats
Shares minted for depositing btc_amount BTC into a vault holding vault_amount BTC with vault_shares shares issued (SatsVault::btc_amount / SatsVault::btc_shares): 1:1 while no shares exist, otherwise scaled by the vault’s shares / assets ratio and floored. Errors when the vault has shares but no BTC, or the result exceeds u64::MAX.
get_associated_token_address
Derive the canonical associated token account for wallet holding mint.
get_board_address
get_claim_usd_instruction
claim_usd: withdraw amount of the miner authority’s unclaimed USD winnings from the board’s USD pool to the authority’s USD account. No exit fee — the full amount transfers.
get_create_board_instruction
create_board: the board singleton, its USD/BTC pools and the initial round (id 1). Signed by the config’s admin authority.
get_create_epoch_vault_instruction
create_epoch_vault: the epoch vault singleton, its USD/BTC pools and the first iteration (id 1).
get_create_one_btc_vault_instruction
create_one_btc_vault: the 1 BTC vault singleton, its USD/BTC pools and the first iteration (id 1).
get_create_satrush_config_instruction
create_satrush_config: the config PDA holding authorities, mints and fee parameters. authority pays and must equal the program’s upgrade authority.
get_create_sats_vault_instruction
create_sats_vault: the sats vault singleton and its BTC reserve pool.
get_create_treasury_instruction
create_treasury: the treasury singleton and its USD fee pool.
get_deploy_public_instruction
deploy_public: stake amount USD (base units, gross of fees) on the tiles in selection_mask for round round_id, as the miner authority. The round must be the board’s current one and open for deploys; the miner profile and deployment record PDAs are created by the instruction.
get_epoch_vault_address
get_epoch_vault_entry_address
get_epoch_vault_iteration_address
get_epoch_vault_page_address
get_event_authority_address
Anchor’s event-CPI authority PDA — the extra signer every #[event_cpi] instruction takes alongside the program account.
get_miner_address
get_one_btc_vault_address
get_one_btc_vault_iteration_address
get_public_deployment_address
get_rotate_round_instruction
rotate_round: reveal current_round_id’s winning tile and deploy round current_round_id + 1 as the board’s new active round. Signed by the config’s round authority; valid once the current round’s window elapsed.
get_round_address
get_satrush_config_address
get_sats_vault_address
get_settle_deploy_public_instruction
settle_deploy_public: settle the miner authority’s deployment in a Settled round — credit winnings (USD + sats vault shares) and hashrate points to the miner profile, then close the deployment account, returning its rent. Valid for losing deployments too (they still earn hashrate points).
get_swap_round_stake_instruction
swap_round_stake: relay a pre-built aggregator route that converts part of the revealed round’s USD into BTC. swap_data and route_accounts are the route’s opaque instruction data and account list; the on-chain handler enforces the economics against observed balance deltas. Signed by the config’s round authority.
get_treasury_address
get_update_board_round_duration_instruction
update_board_round_duration: overwrite the board’s round_duration (slots). Applies to future round activations only; the active round keeps its window. Signed by the config’s admin authority.
sats_to_btc
BTC value of shares against a vault holding vault_amount BTC with vault_shares shares issued (SatsVault::btc_amount / SatsVault::btc_shares). claim_fee_bps is SatrushConfig::sats_vault_claim_fee_bps; pass 0 when only the gross value matters. Zero shares value to zero without error; shares exceeding vault_shares is rejected.
selection_mask_from_tiles
Convert a fixed-size array of tile selections into the packed u32 selection mask expected by deploy_public: bit i is set when tiles[i] is true.
tiles_from_selection_mask
Inverse of selection_mask_from_tiles: unpack a u32 selection mask into a per-tile boolean array. Bits above TILE_COUNT are ignored.